/pidgin/main: ad46974535ba: Backport makefile fix to not regener...

Tomasz Wasilczyk twasilczyk at pidgin.im
Tue May 6 06:25:55 EDT 2014


Changeset: ad46974535ba11abff7e2f2c084370782c376600
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2014-05-06 12:24 +0200
Branch:	 release-2.x.y
URL: https://hg.pidgin.im/pidgin/main/rev/ad46974535ba

Description:

Backport makefile fix to not regenerate revision on each make

diffstat:

 Makefile.am |  24 +++++++++++++++---------
 1 files changed, 15 insertions(+), 9 deletions(-)

diffs (42 lines):

diff --git a/Makefile.am b/Makefile.am
--- a/Makefile.am
+++ b/Makefile.am
@@ -84,23 +84,29 @@ if ENABLE_GNT
 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 $<`\"" > $@; \
+		echo "#define REVISION \"`cat $<`\"" > $@; \
 	fi
 	$(AM_V_at)if test ! -f $@ -a -f $(srcdir)/$@; then \
-	  cp $(srcdir)/$@ $@; \
+		cp $(srcdir)/$@ $@; \
 	fi
 	$(AM_V_at)test -f $@ || echo "#define REVISION \"unknown\"" > $@
 



More information about the Commits mailing list