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

Re: [PATCH v2 2/6] Makefile: move "strip" assignment down from flags

From
Ramsay Jones <ramsay@ramsayjones.plus.com>
Date
Feb 22, 2019, 21:58 UTC
Message-ID
<4821a31a-f5ee-39ef-5302-8b71430815fe@ramsayjones.plus.com>
In-Reply-To
<20190222151834.GA21524@sigill.intra.peff.net>
On 22/02/2019 15:18, Jeff King wrote:
Show 18 quoted lines
> On Fri, Feb 22, 2019 at 03:41:23PM +0100, Ævar Arnfjörð Bjarmason wrote:
> 
>> Move the assignment of the "STRIP" variable down to where we're
>> setting variables with the names of other programs.
>>
>> For consistency with those use "=" for the assignment instead of
>> "?=". I can't imagine why this would need to be different than the
>> rest, and 4dc00021f7 ("Makefile: add 'strip' target", 2006-01-12)
>> which added it doesn't provide an explanation.
> 
> This might annoy somebody expecting $STRIP in the environment to have
> precedence. But I agree that consistency is probably our best strategy
> here, and I don't see any reason the same argument would not apply to
> $SPATCH, or $CC for that matter.
> 
> (So I could see an argument for moving them all to "?=", but that can
> create its own confusion as environment variables accidentally start
> taking effect).

$STRIP and $SPATCH will work OK, but you would be disappointed with $CC (or any other variable from make's built-in database). ;-)

Try this:
  $ cat -n Makefile 
       1	
       2	CC ?= gcc
       3	
       4	all:
       5		@echo "CC is $(CC), origin " $(origin CC)
       6	
  $ 
The command-line works OK:
  $ make CC=cmd-line
  CC is cmd-line, origin  command line
  $ 
So does the environment:
  $ CC=env make
  CC is env, origin  environment
  $ 
But that conditional assignment:
  $ make
  CC is cc, origin  default
  $ 
  
... not so much! :-D

ATB, Ramsay Jones

Previous: Jeff KingNext: Jeff King
Message 9 of 20 in “Makefile: remove an out-of-date comment”
  1. Makefile: remove an out-of-date commentÆvar Arnfjörð Bjarmason, Feb 22, 2019
  2. 0/6 Makefile: allow for combining DEVELOPER= and CFLAGS="..."Ævar Arnfjörð Bjarmason, Feb 22, 2019
  3. Jeff KingFeb 22, 2019
  4. Ævar Arnfjörð BjarmasonFeb 22, 2019
  5. Jeff KingFeb 23, 2019
  6. 1/6 Makefile: remove an out-of-date commentÆvar Arnfjörð Bjarmason, Feb 22, 2019
  7. 2/6 Makefile: move "strip" assignment down from flagsÆvar Arnfjörð Bjarmason, Feb 22, 2019
  8. Jeff KingFeb 22, 2019
  9. Ramsay JonesFeb 22, 2019
  10. Jeff KingFeb 23, 2019
  11. 3/6 Makefile: add/remove comments at top and tweak whitespaceÆvar Arnfjörð Bjarmason, Feb 22, 2019
  12. 4/6 Makefile: Move *_LIBS assignment into its own sectionÆvar Arnfjörð Bjarmason, Feb 22, 2019
  13. Jeff KingFeb 22, 2019
  14. Eric SunshineFeb 22, 2019
  15. 5/6 Makefile: move the setting of *FLAGS closer to "include"Ævar Arnfjörð Bjarmason, Feb 22, 2019
  16. Junio C HamanoFeb 22, 2019
  17. 6/6 Makefile: allow for combining DEVELOPER=1 and CFLAGS="..."Ævar Arnfjörð Bjarmason, Feb 22, 2019
  18. Jeff KingFeb 22, 2019
  19. Junio C HamanoFeb 22, 2019
  20. Jeff KingFeb 22, 2019

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.