help-make
[Top][All Lists]
Advanced

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

Re: how to enforce ordering on a set of targets?


From: Paul D. Smith
Subject: Re: how to enforce ordering on a set of targets?
Date: Wed, 26 Jan 2005 18:27:00 -0500

%% "Robert P. J. Day" <address@hidden> writes:

  rpjd> and i can't add

  rpjd>   ${SUBDIRS}: pre-populate

  rpjd> since that dependency should *only* take effect when i'm
  rpjd> invoking the makefile with the "populate" target, and no others.

Hm.  Well, an answer to what your asking for would be:

    POPULATE_PREREQ :=
    ifneq ($(filter populate,$(MAKECMDGOALS)),)
      POPULATE_PREREQ := pre-populate
    endif

    ${SUBDIRS}: ${POPULATE_PREREQ}

Or, of course, you could add an extra level of recursion, like this:

    populate: pre-populate
            $(MAKE) ${SUBDIRS}

or something.


If you always want the populate/pre-populate step to be run once at the
beginning, then probably the right answer is to just arrange to have it
run EVERY time, but include enough smarts (in terms of prerequisites,
fake targets, etc.) in the makefile so that the second and subsequent
runs don't actually invoke those commands.

Then you can go back to the simple solution.

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