I’ve got a Makefile that includes another makefile that sets a lot of defaults. I can’t edit the included makefile and I’d like to change the value of C++FLAGS in my makefile even though it is set in the included makefile. Specifically, I’d like to remove the optimization flag from C++FLAGS whenever debug=1.
I tried the following:
C++FLAGS=$(filter-out -O3,$(C++FLAGS))
Which fails with the following error:
Recursive variable `C++FLAGS' references itself (eventually). Stop.
It seems like doing something like this should be possible, anybody know the secret?
The
:=assignment immediately evaluates the rvalue and this should therefore work.=on the other hand has delayed expansion semantics (i.e. theC++FLAGSwill expand whenever the lvalue gets used, which leads to recursion).