Don't force package_revision.h rebuild without the reason

Mon, 17 Feb 2014 18:45:39 +0100

author
Tomasz Wasilczyk <twasilczyk@pidgin.im>
date
Mon, 17 Feb 2014 18:45:39 +0100
changeset 35580
6e0a95d839bb
parent 35579
da76dcd7e5a6
child 35581
2638707f038e

Don't force package_revision.h rebuild without the reason

Makefile.am file | annotate | diff | comparison | revisions
--- a/Makefile.am	Mon Feb 17 18:17:56 2014 +0100
+++ b/Makefile.am	Mon Feb 17 18:45:39 2014 +0100
@@ -82,17 +82,23 @@
 GNT_DIR=finch
 endif
 
-# This is phony, so that we always try to rebuild it.  If it succeeds
-# in calculating changes, it produces its target; otherwise, its
-# target does not exist.
-.PHONY: package_revision_raw.txt
+# We always try to rebuild all objects that depends on this dummy target.
+.FORCE:
+
 # if both attempts fail, then we need to remove the empty file that >
 # creates, and also make sure that the shell command exits
 # successfully; the rm -f ensures both
-package_revision_raw.txt:
+package_revision_raw.txt: .FORCE
 	$(AM_V_GEN)REAL_BLDDIR=$$PWD/$(top_builddir); \
-	(hg --cwd $(srcdir) id -i --debug) 2>/dev/null >$@ \
-	|| rm -f $@
+	(hg --cwd $(srcdir) id -i --debug) 2>/dev/null >$@.new \
+	|| rm -f $@.new
+	$(AM_V_at)if test -f $@.new; then \
+		if ! diff $@ $@.new > /dev/null; then \
+			mv $@.new $@; \
+		else \
+			rm $@.new; \
+		fi \
+	fi
 package_revision.h: package_revision_raw.txt
 	$(AM_V_GEN)if test -f $<; then \
 	  echo "#define REVISION \"`cat $<`\"" > $@; \

mercurial