From 39c8b04c9725170b09e9316dac631a2a1e302b70 Mon Sep 17 00:00:00 2001 From: John Hood Date: Tue, 9 Jun 2015 22:00:42 -0400 Subject: [PATCH] Makefile.am: fixup version file generation Signed-off-by: John Hood --- Makefile.am | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Makefile.am b/Makefile.am index 1d7b297..ba19344 100644 --- a/Makefile.am +++ b/Makefile.am @@ -8,17 +8,20 @@ CLANG_SCAN_BUILD = scan-build .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 + @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; \ + fi; \ + fi @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 + @set -e; if ! diff -q version.h version.h.new > /dev/null 2>&1; then \ + mv -f version.h.new version.h; \ + fi @rm -f version.h.new clean-local: