r4011 - trunk/varnish-cache/lib/libvarnish

tfheen at projects.linpro.no tfheen at projects.linpro.no
Mon Mar 30 14:39:05 CEST 2009


Author: tfheen
Date: 2009-03-30 14:39:05 +0200 (Mon, 30 Mar 2009)
New Revision: 4011

Modified:
   trunk/varnish-cache/lib/libvarnish/Makefile.am
Log:
Fix svn_version.c generation so we only regenerate it if the revision has actually changed

Modified: trunk/varnish-cache/lib/libvarnish/Makefile.am
===================================================================
--- trunk/varnish-cache/lib/libvarnish/Makefile.am	2009-03-30 11:31:08 UTC (rev 4010)
+++ trunk/varnish-cache/lib/libvarnish/Makefile.am	2009-03-30 12:39:05 UTC (rev 4011)
@@ -33,11 +33,19 @@
 
 DISTCLEANFILES = svn_version.c
 svn_version.c: FORCE
-	echo '#include <libvarnish.h>' > svn_version.c
-	echo 'const char* svn_version(void)' >> svn_version.c
-	echo -n '{ const char* SVN_Version = "' >> svn_version.c
-	svnversion -n $(top_srcdir)          >> svn_version.c
-	echo '"; return SVN_Version; }'      >> svn_version.c
+	V="$(shell svnversion -n $(top_srcdir))" \
+	H="$(shell head -n 1 svn_version.c || true)"; \
+	if [ "/* $$V */" != "$$H" ]; then \
+		( \
+		  echo "/* $$V */" ;\
+		  echo "#include <libvarnish.h>" ;\
+		  echo "const char* svn_version(void)" ;\
+		  echo "{" ;\
+		  echo "	const char* SVN_Version = \"$$V\";" ;\
+		  echo "	return SVN_Version;" ;\
+		  echo "}" ;\
+		) > svn_version.c ; \
+	fi
 FORCE:
 
 if ENABLE_TESTS



More information about the varnish-commit mailing list