Makefile.am: fixup version file generation

Signed-off-by: John Hood <cgull@glup.org>
This commit is contained in:
John Hood
2015-06-09 22:00:42 -04:00
parent c58642dd63
commit 39c8b04c97
+10 -7
View File
@@ -8,17 +8,20 @@ CLANG_SCAN_BUILD = scan-build
.PHONY: VERSION .PHONY: VERSION
VERSION: VERSION:
@-[ -f VERSION ] || echo @PACKAGE_STRING@ > VERSION @set -e; if [ ! -f VERSION ]; then echo @PACKAGE_STRING@ > VERSION; fi
@-git status > /dev/null 2>&1 && \ @set -e; if git status > /dev/null 2>&1; then \
git describe --dirty > VERSION.new && \ git describe --dirty > VERSION.new; \
! diff -q VERSION VERSION.new > /dev/null && \ if ! diff -q VERSION VERSION.new > /dev/null 2>&1; then \
mv VERSION.new VERSION mv -f VERSION.new VERSION; \
fi; \
fi
@rm -f VERSION.new @rm -f VERSION.new
version.h: VERSION version.h: VERSION
@printf '#define BUILD_VERSION "%s"\n' "$$(cat VERSION)" > version.h.new @printf '#define BUILD_VERSION "%s"\n' "$$(cat VERSION)" > version.h.new
@-! diff -q version.h version.h.new > /dev/null && \ @set -e; if ! diff -q version.h version.h.new > /dev/null 2>&1; then \
mv version.h.new version.h mv -f version.h.new version.h; \
fi
@rm -f version.h.new @rm -f version.h.new
clean-local: clean-local: