[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Dependency - but not really
From: |
Paul D. Smith |
Subject: |
Re: Dependency - but not really |
Date: |
Thu, 8 Mar 2001 10:42:57 -0500 |
%% "Oelke, Dan" <address@hidden> writes:
od> .PHONY: $(SUBSYSTEM)_
od> $(SUBSYSTEM)_:
Ouch.
od> $($(SUBSYSTEM)_C_Objs): obj/%.o: %.c $(SUBSYSTEM)_
od> $(CC_T) $(T_CFLAGS) $($(filter-out %.c,$+)CFLAGS) -c $< -o $@
od> The CC_T line needs to access the SUBSYSTEM variable, but since
od> SUBSYSTEM gets redefined repeatedly, it isn't there when it comes
od> time to evaluate that line. We need the SUBSYSTEM variable to get
od> at the $(SUBSYSTEM_CFLAGS) value. So, the quick solution we came
od> up with was to add SUBSYSTEM as a dependency and then filter it
od> out. But declaring it as a .PHONY isn't perfect, as now we need
od> to create a file of the name $(SUBSYSTEM)_ for every possible
od> SUBSYSTEM value, or the target is always out of date.
Why don't you punt all this and use target-specific variables?
$($(SUBSYSTEM)_C_Objs): LOCAL_SUBSYSTEM := $(SUBSYSTEM)
$($(SUBSYSTEM)_C_Objs): obj/%.o : %.c
$(CC_T) $(T_CFLAGS) $($(LOCAL_SUBSYSTEM)_CFLAGS) -o $@ -c $<
Note I didn't try this, but I _think_ it will work.
--
-------------------------------------------------------------------------------
Paul D. Smith <address@hidden> Find some GNU make tips at:
http://www.gnu.org http://www.paulandlesley.org/gmake/
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Dependency - but not really,
Paul D. Smith <=