[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Dilemer using target-specific or pattern-specific variables
From: |
Brian Dessent |
Subject: |
Re: Dilemer using target-specific or pattern-specific variables |
Date: |
Thu, 16 Oct 2008 02:12:51 -0700 |
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