%% [EMAIL PROTECTED] (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 <[EMAIL PROTECTED]>          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


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

Reply via email to