On Mon, 2017-04-17 at 09:43 +0200, zosrothko wrote: > Here a simple makefile that sets the variable CXX if not defined to > $(FOO)g++ > CXX ?=$(FOO)g++ > > test: > @echo $(CXX) > > and the some stories > > fandre@Ubuntu-x64:~/make$ unset CXX > fandre@Ubuntu-x64:~/make$ make > g++ > fandre@Ubuntu-x64:~/make$ make FOO=bar > g++ > fandre@Ubuntu-x64:~/make$ FOO=bar make > g++ > fandre@Ubuntu-x64:~/make$ export FOO=bar;make > g++ > > Why CXX is never set to 'barg++' ?
?= only assigns a value if the variable has no value. However, CXX always has a value, because there's a default value set: $ make -pf/dev/null | grep ^CXX make: *** No targets. Stop. CXX = g++ If you had chosen a different value to set your variable to it may have been more clear; using: CXX ?= $(FOO)bar you would still see output: fandre@Ubuntu-x64:~/make$ make g++ so clearly your assignment is not having any effect at any time. _______________________________________________ Help-make mailing list Help-make@gnu.org https://lists.gnu.org/mailman/listinfo/help-make