help-make
[Top][All Lists]
Advanced

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

Re: all: depend $(SUBDIRS) - does not go into subdirs


From: Paul D. Smith
Subject: Re: all: depend $(SUBDIRS) - does not go into subdirs
Date: Mon, 12 Jul 2004 00:55:58 -0400

%% address@hidden (Alexander Farber) writes:

  af> The Makefile.subdirs generation and depend work fine, but
  af> I never see gmake descending into the $(SUBDIRS) and it reports
  af> "nothing to be done for all" even though I've put the $(SUBDIRS)
  af> under the .PHONY target.

  af> Does anybody see, what am I doing wrong or should I come up
  af> with a simpler test case? Thank you for any hints.

  af> all: depend $(SUBDIRS)

Make reads makefiles linearly, top to bottom.  Variables and functions
are expanded at different times, according to rules you can find in the
GNU make manual, section "How 'make' Reads a Makefile".

In particular, variables and functions that appear in target or
prerequisite lists are expanded immediately as make is read in.

So, since your include (which defines the SUBDIRS variable) doesn't
happen until after you use it here, at the time the above target is
internalized the SUBDIRS variable has an empty value.


You'll have to put the reference to $(SUBDIRS) as a prerequisite _AFTER_
the Makefile.subdirs is included.

-- 
-------------------------------------------------------------------------------
 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]