help-gnu-utils
[Top][All Lists]
Advanced

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

Re: GNUMAKE: rebuild target when any of the dependencies are done


From: John Graham-Cumming
Subject: Re: GNUMAKE: rebuild target when any of the dependencies are done
Date: Tue, 25 Jan 2005 15:16:42 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040208 Thunderbird/0.5 Mnenhy/0.6.0.104

Yuri Shtil wrote:
The idea is to run gmake with -j so that targets ONE and TWO build
concurrently. I want to start the script for all when the FIRST target
finishes, not to wait until both are done.

Hmm. So basically, it's ok for the all target target to run its commands as soon as either One or Two has finished. That implies that One and Two are not really dependencies of all (i.e. things that need to be done before all is done) and hence the all: One Two isn't the right way to express it in GNU Make.

You could just run GNU Make with One and Two as command-line goals:

    make -j2 One Two

Or you could use a :: and some protection that the commands don't get run twice.

    all:: One
        $(ALLCMDS)

    all:: Two
        $(ALLCMDS)

You'd need to make ALLCMDS check that it hasn't already been run.

Or you could push the ALLCMDS further up the tree:

    .PHONY: all allone alltwo
    all: allone alltwo

    allone: One
        $(ALLCMDS)

    alltwo: Two
        $(ALLCMDS)

John.
--
John Graham-Cumming
jgc@jgc.org

Home: http://www.jgc.org/
Work: http://www.electric-cloud.com/
POPFile: http://getpopfile.org/

reply via email to

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