Chen Jun ???? wrote:

> So, I think it is reasonble that expansion of any target/pattern
> specific variable assignment should be deferred when the corresponding
> target is being made.

If you want the expansion deferred you can use '='.  So the real problem
isn't that, but rather the recursive nature of trying to assign cflags
based on its existing value.

> Any solutions to this problem? Hoping to hear your response.

Just introduce another variable.

default_cflags = -c -DNDEBUG -O2
cflags = $(default_cflags)

...

my.obj: cflags = $(LateDef) $(filter-out -DNDEBUG,$(default_cflags))

$ make
Compile my.obj: -D LATEDEF1 -D LATEDEF2 -c -O2
Compile his.obj: -c -DNDEBUG -O2
linking my.obj his.obj

Brian


_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to