aboutsummaryrefslogtreecommitdiffhomepage
path: root/Makefile.am
diff options
context:
space:
mode:
authorGravatar john hood <cgull@glup.org>2015-05-18 18:56:40 -0400
committerGravatar John Hood <cgull@glup.org>2015-05-25 03:46:48 -0400
commitf3073bbe5dafb892ce0c1c93dd246233eaa73309 (patch)
treec99361781ad7f4a8f220e507d51896b9565f53eb /Makefile.am
parente0138bdb2b48f509260e349ca6c7ef3065cd1f00 (diff)
Add git commit version info
Diffstat (limited to 'Makefile.am')
-rw-r--r--Makefile.am21
1 files changed, 21 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index c6e9142..930fcfa 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,3 +1,24 @@
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = src scripts man conf
EXTRA_DIST = autogen.sh ocb-license.html README.md COPYING.iOS
+nodist_noinst_HEADERS = version.h
+BUILT_SOURCES = version.h
+
+.PHONY: VERSION
+
+VERSION:
+ @-[ -f VERSION ] || echo @PACKAGE_STRING@ > VERSION
+ @-git status > /dev/null 2>&1 && \
+ git describe --dirty > VERSION.new && \
+ ! diff -q VERSION VERSION.new > /dev/null && \
+ mv VERSION.new VERSION
+ @rm -f VERSION.new
+
+version.h: VERSION
+ @printf '#define BUILD_VERSION "%s"\n' "$$(cat VERSION)" > version.h.new
+ @-! diff -q version.h version.h.new > /dev/null && \
+ mv version.h.new version.h
+ @rm -f version.h.new
+
+clean-local:
+ @rm -f version.h VERSION