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: Robert P. J. Day
Subject: Re: how to enforce ordering on a set of targets?
Date: Wed, 26 Jan 2005 18:16:59 -0500 (EST)

On Wed, 26 Jan 2005, Paul D. Smith wrote:

> %% "Robert P. J. Day" <address@hidden> writes:
>
>   rpjd> what's the proper way to enforce an ordering on a set of targets
>   rpjd> i have in the following context?  to make a long story short
>   rpjd> (but hopefully not so short that i leave out crucial info), i
>   rpjd> have the following in a makefile:
>
>   rpjd>   .PHONY: populate populate_base
>   rpjd>   populate: populate_base ${SUBDIRS}
>
>   rpjd> where, when i call this makefile with the target "populate",
>   rpjd> it's critical that the "populate_base" target there is processed
>   rpjd> first, *after* which all of the subdirectory targets can be done
>   rpjd> in parallel.
>
> If you want populate_base to be run before the subdirs, then they should
> depend on it, like this:
>
>     ${SUBDIRS}: populate_base

ok, here's what i'm doing in a bit more detail.  it's a recursive
make, where i'm using a trick i saw (in the make manual, i think) that
allows me to process subdirectories in parallel.  in slightly
simplified form:

-----

SUBDIRS = d1 d2 d3 d4 d5

.PHONY: ${SUBDIRS} clean configure build

clean configure build: ${SUBDIRS}

d1:
        ${MAKE} ... some d1-specific options ... ${MAKECMDGOALS}
d2:
        ${MAKE} ... some d2-specific options ... ${MAKECMDGOALS}

----- etc etc -----

  so, of course, what this allows me to do is invoke this makefile
with any of the "action" targets such as:

  $ make configure

at which point the "configure" target will allow *all* of the
subdirectories to be made in parallel for just "configure", correct?
(it certainly seems to be working that way.)

  *now*, i want to add another target, "populate", which works almost
the same way but it has to do some preliminary processing in this
makefile before the recursive (potentially parallel) call to the
subdirectories.

  if i call this preliminary processing step, say, "pre-populate", i
can't just do this:

  populate: pre-populate ${SUBDIRS}

as those steps would be allowed to be done in parallel, which is not
good.  and i can't add

  ${SUBDIRS}: pre-populate

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

  sorry if i'm making this more difficult than it has to be.  i'm sure
there's a simple solution to this.

rday





reply via email to

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