[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] note GNU-make-ism in FAQ

From: Peter Samuelson <peter_at_p12n.org>
Date: 2006-02-27 22:32:41 CET

[Philip Martin]
> >> SVNDEF = -D'SVN_REV="$(shell svnversion -n .)"'
> >> CFLAGS = $(SVNDEF) ... continue with your other flags ...

> >> printf("this program was compiled from SVN revision %s\n",SVN_REV);

> I don't think we should be recommending that because I think it
> causes the svnversion command to get run each time the compiler is
> invoked.

Also, we should warn readers that $(shell) is specific to GNU make.
But while we're using features that may be GNU-specific, we can fix
your objection by using := rather than = in the assignment.

Peter

[[[
* www/faq.html (version-value-in-source): Use := in example Makefile
  for efficiency. Clarify use of GNU-make-ism.
]]]
Index: faq.html
===================================================================
--- faq.html (revisione 18638)
+++ faq.html (copia locale)
@@ -1526,9 +1526,9 @@
 <p>
 You can incorporate it into your build or release process to get the
 information you need into the source itself. For example, in a build
-environment based on <tt>make</tt>, add <a
+environment based on <tt>GNU&nbsp;make</tt>, add <a
 href="http://subversion.tigris.org/servlets/ReadMsg?list=dev&msgNo=112564"
->something like this</a> to your <tt>Makefile</tt>:</p>
+>something like this</a> to your <tt>Makefile</tt>:
 
 <pre>
 ##
@@ -1536,10 +1536,13 @@
 ## printf("this program was compiled from SVN revision %s\n",SVN_REV);
 ##
 
-SVNDEF = -D'SVN_REV="$(shell svnversion -n .)"'
-CFLAGS = $(SVNDEF) ... continue with your other flags ...
+SVNDEF := -D'SVN_REV="$(shell svnversion -n .)"'
+CFLAGS := $(SVNDEF) ... continue with your other flags ...
 </pre>
 
+(Note that this will not work on non-GNU versions of <tt>make</tt>.
+Don't use it if your build process needs to be portable.)</p>
+
 <p>Or try this recipe:</p>
 
 <pre>

Received on Mon Feb 27 22:52:15 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.