Re: On overriding make variables from the environment...
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Oct 16, 2018, 21:54 UTC
- Message-ID
- <20181016215456.GB96853@aiede.svl.corp.google.com>
- In-Reply-To
- <20181016184537.GN19800@szeder.dev>
Hi,
SZEDER Gábor wrote:
Show 8 quoted lines
> Our Makefile has lines like these: > > CFLAGS = -g -O2 -Wall > CC = cc > AR = ar > SPATCH = spatch > > Note the use of '=', not '?='.
[...]
> I'm not sure what to do. I'm fine with updating our 'ci/' scripts to > explicitly respect CC in the environment (either by running 'make > CC=$CC' or by writing $CC into 'config.mak'). Or I could update our > Makefile to use '?=' for specific variables, but:
That's a good question. I don't have a strong opinion myself, so I tend to trust larger projects like Linux to have thought this through more, and they use 'CC = cc' as well. So I'd lean toward the updating 'ci/' scripts approach, to do something like
make ${CC:+"CC=$CC"} ...(or the equivalent multi-line construction).
That also has the bonus of being explicit.
Just my two cents, Jonathan