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. You could disable all the built-in variables by running "make -R" or, if you have a sufficiently modern version of GNU Make, buy adding to MAKEFLAGS in your makefile: MAKEFLAGS += -R This will disable _all_ the built-in variables... I don't know if that's a problem.