help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: a small problem...


From: Paul D. Smith
Subject: Re: a small problem...
Date: Wed, 20 Nov 2002 23:44:37 -0500

%% Regarding a small problem...;
%% "Tehn Yit Chin" <address@hidden> writes:

  tyc> .PHONY:  debug all

  tyc> OBJECTS     := fred.txt
  tyc> CDE         := debug.txt

  tyc> debug : OBJECTS = $(OBJECTS) $(CDE)
  tyc> debug : all

  tyc> all : $(OBJECTS)
  tyc>      @echo $(OBJECTS) "executing target=all"

  tyc> fred.txt :
  tyc>      @echo $(OBJECTS) "executing target=fred.txt"

  tyc> debug.txt :
  tyc>      @echo $(OBJECTS) "executing target=debug.txt"

  tyc> fred.txt debug.txt executing target=fred.txt
  tyc> fred.txt debug.txt executing target=all

  tyc> My question is shouldn't the "debug" target cause it to include
  tyc> debug.txt as a dependency as well as fred.txt? The above small
  tyc> test does not seem to back this up.

See the GNU make manual: target-specific variables are only valid within
command scripts, and within the context of other target-specific
variables.  So, the value of $(OBJECT) when it's expanded in the
prerequisites list is not in those categories and so doesn't take into
account target-specific variable values.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

[Prev in Thread] Current Thread [Next in Thread]