From: Eric Sunshine Date: Thu, 06 Feb 2014 08:55:23 GMT Subject: Re: [PATCH 03/13] Makefile: introduce make-var helper function Message-ID: In-Reply-To: <20140205175002.GC15218@sigill.intra.peff.net> On Wed, Feb 5, 2014 at 12:50 PM, Jeff King wrote: > It's a common pattern in our Makefile to echo some make > variables into a file, but only if they are different from a > previous run. This sentinel file can then be used as a > dependency to trigger rebuilds when the make variable > changes. > > The code to do this is a bit ugly and repetetive; let's s/repetetive/repetitive/ > factor it out into a reusable function. > > Note that this relies on the "call" and "eval" functions of > GNU make. We previously avoided using "call", as explained > in 39c015c (Fixes for ancient versions of GNU make, > 2006-02-18). However, it has been 8 years since then, so > perhaps its use is acceptable now. > > The "call" function dates back to GNU make 3.77.90 > (1997-07-21). The "eval" function dates back to 3.80 > (2002-07-08). > > If it's still a problem to use these functions, we can > do similar meta-programming with something like: > > include magic.mak > magic.mak: > ./generate-magic-rules >$@+ > mv $@+ $@ > > where the rules are generated by a shell (or other) script. > > Signed-off-by: Jeff King