help-make
[Top][All Lists]
Advanced

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

forcing an initial dependency -- a possible solution


From: Robert P. J. Day
Subject: forcing an initial dependency -- a possible solution
Date: Mon, 7 Mar 2005 12:47:30 -0500 (EST)

  i asked about this once upon a time, and i was interested in any
opinion on what i *think* is a solution.  the situation is, i have a
number of pre-defined "ACTIONS" (i choose not to call them "targets"
to make it clear that they correspond to, well, actions), and i have a
number of subdirectories to process recursively with whatever action
is currently in play:

  ACTIONS = clean configure build populate
  SUBDIRS = d1 d2 d3 init d4 d5

  my rules are designed to allow parallel recursive processing (even
though i'm not taking advantage of that yet):

  .PHONY: ${ACTIONS} ${SUBDIRS}
  ${ACTIONS}: ${SUBDIRS}

  ${SUBDIRS}:
        ${MAKE} -C $@ ${MAKECMDGOALS}


and all of the above seems to work nicely -- i can just invoke, say:

  $ make configure

and the configure action is recursively processed as one would expect.

  however, in the list of SUBDIRS, i *need* one of them ("init") to be
processed before all of the others.  that one subdirectory *must* be
done first, after which *all* remaining subdirectories can be done in
parallel.

  what seems to work is:

  ACTIONS = clean configure build populate
  SUBDIRS = d1 d2 d3 init d4 d5

  .PHONY: ${ACTIONS} ${SUBDIRS}
  ${ACTIONS}: ${SUBDIRS}

  RESTOFDIRS := $(filter-out init,${SUBDIRS})
  ${RESTOFDIRS}: init

  ${SUBDIRS}:
        ${MAKE} -C $@ ${MAKECMDGOALS}



does this look reasonable?   i just added the extra dependency that
all *non*-init subdirectories depend on the "init" one, and some quick
tests seem to verify that it does what i want -- "init" is always
processed first.

  are there any subtle gotchas here that will trip me up?  thanks.

rday




reply via email to

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