bug-make
[Top][All Lists]
Advanced

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

Re: problem in using -j with make


From: tom honermann
Subject: Re: problem in using -j with make
Date: Mon, 08 Feb 2010 17:35:33 -0800
User-agent: Thunderbird 2.0.0.23 (Windows/20090812)

I think you are misunderstanding what this syntax means:
a b c d e:
    some_command
This does not indicate that 'some_command' will produce all of these targets.  Rather, it is short hand for this:
a:
    some_command
b:
    some_command
c:
    some_command
d:
    some_command
e:
    some_command
To specify a (static) rule that builds multiple targets, an intermediate timestamp file is needed.  Something like:
all: a b c d e
    touch all

some_command.ts:
    some_command
    touch some_command.ts

a b c d e: some_command.ts
Note that pattern rules do support multiple targets for a single rule.  Depending on your needs, you may be able to use a pattern rule instead of a static rule.

Tom.

On 2/8/2010 2:47 PM, Warren Dodge wrote:
I have a make file that is causing me a problem when I try to use the -j
option to speed things up.

Here is a simplified version of it that shows my problem.

### Makefile ########
all:	a b c d e
	touch all

a b c d e:
	script.5files

#############################################################################

script.5files contains this

 touch a b c d e 

#############################################################################

Basically, I want to build the all target if any one of the 5 files is
missing. The script will always build all five files if it is run. As
seen it appears to do that.

rm ? all
make all
script.5files
touch all

make all
make: `all' is up to date.

rm a
make all
script.5files
touch all

rm b d
make all
script.5files
touch all

#############################################################################

Now if I add a -j to the mix it does something strange

rm ? all
make -j all
script.5files
script.5files
script.5files
script.5files
script.5files
touch all

It senses it can do all in parallel and runs the script 5 times. In this
simple case it doesn't really hurt but in my real script it totally
messes thing up as it is a lengthy process to create the 5 files via a
perl script.


I kind of think what it is doing is expected but I am not totally
sure. What I would wonder is why make did not sense that the
prerequisites for all are totally made by just one execution of the
script and thus -j would only call the script once.


If there is another way to approach this I'd like to know it. This is
driving me nuts.




_______________________________________________
Bug-make mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/bug-make
  

--
Oracle Email Signature Logo
Tom Honermann | Senior Principal Software Engineer | 503.276.2354
Oracle | PeopleTools Development
1211 SW 5th Ave, Suite 9080, Portland, OR 97204

reply via email to

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