Path: utzoo!utgpu!watmath!uunet!crdgw1!montnaro
From: montnaro@sprite.crd.ge.com (Skip Montanaro)
Newsgroups: gnu.utils.bug
Subject: Re: GNU make bug with -j
Message-ID: 
Date: 11 Aug 89 05:09:10 GMT
References: <8908082032.AA03081@SSD.HARRIS.COM>
Sender: news@crdgw1.crd.ge.com
Reply-To:  (Skip Montanaro)
Distribution: gnu
Organization: GE Corporate Research & Development, Schenectady, NY
Lines: 33
In-reply-to: jimbo@ssd.harris.com's message of 8 Aug 89 20:32:48 GMT

In article <8908082032.AA03081@SSD.HARRIS.COM> jimbo@ssd.harris.com (Jim Winters) writes:

   I tried to use GNU make because I wanted to use the "-j" option, but
   the problem was that it didn't run the jobs concurrently.
   ...
   I don't really think it makes any difference what makefile you use,
   but here's a teeny one that demonstrates the problem:

   a:
	   sleep 5;echo toot
	   sleep 5;echo toot

There is no bug that I know of with the -j flag. Your example Makefile has
only a single target, so there are no multiple targets to possibly build in
parallel. Make can't infer that the two commands necessary to update target
'a' are independent. Try this example instead:

a : a.o b.o c.o
	cc -o a a.o b.o c.o
a.o : a.c
	sleep 5; cc -c a.c
b.o : b.c
	sleep 5; cc -c b.c
c.o : c.c
	sleep 5; cc -c c.c

"gmake -jn" (n >= 3) correctly compiles all three C source files in
parallel. It can tell there are no side effects because of the target/source
dependencies. We've put the -j flag to good use on our Convex and our
Stellar, even though we've only been using GNU make for a short time.

--
Skip Montanaro (montanaro@sprite.crd.ge.com)