git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 03/13] Makefile: introduce make-var helper function

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Feb 6, 2014, 08:55 UTC
Message-ID
<CAPig+cTPUHJ6wDPWL_v=_7Zq6O=r2g2Hz02TQHZO+0gq60Fbnw@mail.gmail.com>
In-Reply-To
<20140205175002.GC15218@sigill.intra.peff.net>
On Wed, Feb 5, 2014 at 12:50 PM, Jeff King <peff@peff.net> wrote:
Show 7 quoted lines
> 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/
Show 23 quoted lines
> 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 <peff@peff.net>
Previous: Jeff KingNext: Jeff King
Message 5 of 28 in “makefile refactoring”
  1. 0/13 makefile refactoringJeff King, Feb 5, 2014
  2. 01/13 Makefile: drop USE_GETTEXT_SCHEME from GIT-CFLAGSJeff King, Feb 5, 2014
  3. 02/13 Makefile: fix git-instaweb dependency on gitwebJeff King, Feb 5, 2014
  4. 03/13 Makefile: introduce make-var helper functionJeff King, Feb 5, 2014
  5. Eric SunshineFeb 6, 2014
  6. 04/13 Makefile: use tempfile/mv strategy for GIT-*Jeff King, Feb 5, 2014
  7. 05/13 Makefile: prefer printf to echo for GIT-*Jeff King, Feb 5, 2014
  8. 06/13 Makefile: store GIT-* sentinel files in MAKE/Jeff King, Feb 5, 2014
  9. Junio C HamanoFeb 5, 2014
  10. 07/13 Makefile: always create files via make-varJeff King, Feb 5, 2014
  11. 08/13 Makefile: introduce sq function for shell-quotingJeff King, Feb 5, 2014
  12. Junio C HamanoFeb 5, 2014
  13. 09/13 Makefile: add c-quote helper functionJeff King, Feb 5, 2014
  14. Junio C HamanoFeb 5, 2014
  15. Jeff KingFeb 5, 2014
  16. 10/13 Makefile: drop *_SQ variablesJeff King, Feb 5, 2014
  17. Junio C HamanoFeb 5, 2014
  18. 11/13 Makefile: auto-build C strings from make variablesJeff King, Feb 5, 2014
  19. Junio C HamanoFeb 5, 2014
  20. Jeff KingFeb 5, 2014
  21. 12/13 Makefile: teach scripts to include make variablesJeff King, Feb 5, 2014
  22. Junio C HamanoFeb 5, 2014
  23. Jeff KingFeb 5, 2014
  24. Thomas RastFeb 8, 2014
  25. Jeff KingFeb 10, 2014
  26. 13/13 move LESS/LV pager environment to MakefileJeff King, Feb 5, 2014
  27. Jeff KingFeb 5, 2014
  28. Jeff KingFeb 5, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.