Re: CC ?= gcc

Alejandro Colomar <[email protected]> Tue, 16 Jul 2024 17:53:52 +0200
Newsgroups gmane.comp.gnu.make.general
Message-ID <iw6pvakqqenoxepndi3qhdhegvggxori5ihcafsv6bahgr75j2@lrttc2s6xyb3>
On Tue, Jul 16, 2024 at 05:34:42PM GMT, Alejandro Colomar wrote:
> [I'm not subscribed to the list; please keep me in CC]
> 
> Hi Paul,

Hi Paul,

> Am I doing anything wrong?

Sorry for not saying it explicitly.

> 
> 	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).

(And as can be seen in the env(1) run, I didn't set it in the
environment.)

> 	GNUMAKEFLAGS += --warn-undefined-variables
> 
> 	CC ?= foo

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?

> 	make: *** No targets.  Stop.
> 	alx@debian:~/tmp/make$ make --version
> 	GNU Make 4.4.1
> 	Built for x86_64-pc-linux-gnu
> 	Copyright (C) 1988-2023 Free Software Foundation, Inc.
> 	License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
> 	This is free software: you are free to change and redistribute it.
> 	There is NO WARRANTY, to the extent permitted by law.

Cheers,
Alex

-- 
<https://www.alejandro-colomar.es/>
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEE6jqH8KTroDDkXfJAnowa+77/2zIFAmaWl48ACgkQnowa+77/
2zIFpA/9Hd6h3nW468IufuiibbbSnKlp7dkxAZxK2XD9OWVPRClcLT9UcF24CzNE
EirbQPsVN6GZCneSh/GnSHyofh77Jq+9gEXH3QVAFJSSDgdhKWfyJRYLYRptyekX
ELzNmExczg/1tJGbwWW4RkeyWdDaQl3Okt8Hk0SZZh7GqCNK5u46j2qJ2oF1HeU1
ebUNKTde4bcgG3UNt6WUcK7Hg8/ZBHhOQMKjfIBq9kf2lwhjL5CRzv4YPCliCaH0
scr0UQ86GwssSFd0T66d8wAyJd6dgnKrXR5vjdw1jL28NxLCqqGq7gk8ZEUAjXTr
2BKfLYg+7eCEfSnMuUykjxMvH5CYZaVoWNLGTo0Tt5rU08xpnPei8/SOcXkqoia9
DCKxnm+8bEClSMBM+LALwdO6ZZAywvhC9JyZZGffqkQZE6Wsd7VnFjBB7aboUbgy
OdXdSiPn0dmI/+uxAEtwvqQokpU/uD+LlGJ446pFaFJcOpCkHIitFhisOMeT99VN
vWieZTKlfXGx3l/1M8MFa8Eb1PdW9dTKF5f9IQFqcU2+Dv3CyZkTV7ljkFMlgyZN
bckU4+MTppZ8nchNR9wU07VLCXe7+mjHH0Ki8RtNp5UA47elw2/nGHrBPU0SLmf1
SMTIF61CWBeysW+8Sar9P1kpUJ0sowggIAsls9WmRuHjI4lABsY=
=NDhz
-----END PGP SIGNATURE-----