Re: CC ?= gcc
Alejandro Colomar <[email protected]> Tue, 16 Jul 2024 19:43:10 +0200
| Newsgroups | gmane.comp.gnu.make.general |
|---|---|
| Message-ID | <sv2eqvyhyyltro4knlbfmpzyi5hmtyxw3uhtoi4blh53lrzwwb@n42y42ncnoxi> |
Hi Paul, On Tue, Jul 16, 2024 at 12:52:05PM GMT, Paul Smith wrote: > On Tue, 2024-07-16 at 17:53 +0200, Alejandro Colomar wrote: > > And now I say: If CC is not set in the Makefile (I didn't) nor in > > the > > environment (I didn't either), set it to foo. > > > > > > $(info $(CC)) > > > > I expect this should print "foo". > > > > > alx@debian:~/tmp/make$ make > > > cc > > > > But it prints the builtin value "cc". Why? > > A default setting is still a setting: the CC variable is set to a > value. The ?= only sets the variable if it's not already set, at all, > so your assignment has no effect. I used the following: < < < < alx@debian:~/tmp/make$ env | grep CC < < QT_ACCESSIBILITY=1 < < alx@debian:~/tmp/make$ cat GNUmakefile < < GNUMAKEFLAGS += --no-builtin-rules < < GNUMAKEFLAGS += --no-builtin-variables < < I expect the line above to drop any builtin setting of $(CC). > > You could disable all the built-in variables by running "make -R" or, > if you have a sufficiently modern version of GNU Make, How much modern should it be? I'm using 4.4.1; I thought that one already had that fixed. What's the minimum version I should use? I'll also add some warning in the makefile if I detect an old version of make(1): ifneq (4.4.2, $(shell printf "4.4.2\n$(MAKE_VERSION)" | sort -V | head -n1)) $(warning make(1) >= 4.4.2 is necessary. You may find issues with $(MAKE_VERSION).) endif (assuming it was 4.4.2 the one that added support for that.) > buy adding to > MAKEFLAGS in your makefile: > > MAKEFLAGS += -R That's what I tried (via GNUMAKEFLAGS). > > This will disable _all_ the built-in variables... I don't know if > that's a problem. No, that's indeed what I want. Cheers, Alex -- <https://www.alejandro-colomar.es/>
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE6jqH8KTroDDkXfJAnowa+77/2zIFAmaWsSgACgkQnowa+77/ 2zJCQhAAhvvLZZPEauKQNQpn0jqSmR7ZZZd74ZmkftFSK21MF8C3wdZI5U7gH4nl 0g88vN3OL98XlZW2xWaTD7oT6pJ0UJkaxi5URNoO3IOvajX1Zv/Aa6beh4M89BNp 6eHQ3jAlWK/QokXOzdzvduqVMRKwG+EQvgYUMSnBCW3qoUnQkHLSAYMgisUqSQyX qPmnRlWxMrCSGbVcyFan1XRXZ3uDRSGcLUY+s1pSZgMBhN3vHxjgDBA/5C2O/wXj StDkakciXKO6tLApfhvgiHv9CVMygD7LuynGlujMD4Mk11klXOs9PaXGE8rrD5Vu ucFfOONnxw+EFcnc3IfOmXKSlGcpJTIqav2v/b52tsonZ+XgPeFybJsQ4etpetfH 1IqTg/agoDQrPDEmkzQQasnIhGrmX3G5yNyFwz6u3lb7To6V1BR2b3RtQYZEpSXT dyPQLufEmvqS5VQZVu2GbFDvf++KcETKRF6DqPGFik5y+H9IgOXn2K6MeHZl7WrJ VDkfkX8J+I60AvHG1ovvQZz31gNsaYVhPjZNWfAVAbbBM70+kXx+N6lakNWA9oyC LcS9m9Qfish31ZfGOku/DXJCBY7d39ORt/ox6ZqpAdidcfUA5yvOJJ4mrqXkWbxE w9ze33lf0jJuSWqqWtYollfN0WCsH9Dh9pZDwYaP+ga/jXNuCtA= =+yNK -----END PGP SIGNATURE-----