aboutsummaryrefslogtreecommitdiffhomepage
path: root/Makefile.am
diff options
context:
space:
mode:
authorGravatar John Hood <cgull@glup.org>2015-07-07 19:07:56 -0400
committerGravatar John Hood <cgull@glup.org>2015-07-07 19:09:09 -0400
commitfce56ae6fe8ea7b7736aa15cceca946e6625093a (patch)
tree4a677d04edb73f1bec1de75c0f55758da319b13a /Makefile.am
parent7f7a1beb0ffc9c09d1633d7b24441f971b56cafa (diff)
Improve Makefile generation of version files.
Remove bad automake dependency causing double execution. Properly update the version in the non-Git case. Git commands are now in a condition-expression, won't break build. Test that we're in repo root (i.e., our own and not somebody else's). Do `git describe --always` to handle shallow Git clones. Signed-off-by: John Hood <cgull@glup.org>
Diffstat (limited to 'Makefile.am')
-rw-r--r--Makefile.am15
1 files changed, 8 insertions, 7 deletions
diff --git a/Makefile.am b/Makefile.am
index db32e5b..1ebaf57 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,21 +1,22 @@
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
CLANG_SCAN_BUILD = scan-build
.PHONY: VERSION
VERSION:
- @set -e; if [ ! -f VERSION ]; then echo @PACKAGE_STRING@ > VERSION; fi
- @set -e; if git status > /dev/null 2>&1; then \
- git describe --dirty > VERSION.new; \
- if ! diff -q VERSION VERSION.new > /dev/null 2>&1; then \
- mv -f VERSION.new VERSION; \
+ @echo @PACKAGE_STRING@ > VERSION.dist
+ @set -e; if git describe --dirty --always > VERSION.git 2>&1 && \
+ [ -z `git rev-parse --show-prefix` ]; then \
+ if ! diff -q VERSION.git VERSION > /dev/null 2>&1; then \
+ mv -f VERSION.git VERSION; \
fi; \
+ elif ! diff -q VERSION.dist VERSION > /dev/null 2>&1; then \
+ mv -f VERSION.dist VERSION; \
fi
- @rm -f VERSION.new
+ @rm -f VERSION.dist VERSION.git
version.h: VERSION
@printf '#define BUILD_VERSION "%s"\n' "$$(cat VERSION)" > version.h.new