I have a problem understanding the difference it makes using serial and
parallel execution. Given the following makefile and some files call a, b,
c, x, y, z and foo:
all: x y z
@echo done.
@touch foo
x: a
@echo "x: a"
@touch x
y: b
@echo "y: b"
@touch y
z: c
@echo "z: c"
@touch z
a b c: foo
@echo "a b c: foo"
@touch a b c
When I now call 'make' I get the following output:
a b c: foo
x: a
y: b
z: c
done.
This is just the way I expected it to work. If I do 'make -j' I get:
a b c: foo
a b c: foo
a b c: foo
x: a
z: c
y: b
done.
Make executes "a b c: foo" three times. Why? If this is not a bug, then
why doesn't "a b c: foo" get executed three times in a serial make run?
--
Sven C. Dack / GMD Darmstadt, Germany / da...@gmd.de
--
"There's only one kind of woman ..."
"Or man, for that matter. You either believe in yourself or you don't."
-- Kirk and Harry Mudd, "Mudd's Women", stardate 1330.1
PS: it may be that this message allready went into gnu.utils.bugs but we
have some minor problems with our newsserver. Anyway, a response by
mail is prefered :-)
Sven C. Dack
you are not very cooperative. your rule
a b c: foo
@echo "a b c: foo"
@touch a b c
when called from make wants $@ to be updated. instead of
doing this you make all three possible targets. so if you do
it in parallel, instead of making $@ == a, $@ == b and $@ == c,
you make a b c thrice.
i changed your makefile to read
all: x y z
@echo done.
@$(RM) a b c x y z
x: a
@echo "$@: $^"
@touch $@
y: b
@echo "$@: $^"
@touch $@
z: c
@echo "$@: $^"
@touch $@
a b c: foo
@echo "$@: $^"
@touch $@
the results:
% gmake
a: foo
x: a
b: foo
y: b
c: foo
z: c
done.
% gmake -j
a: foo
c: foo
x: a
z: c
b: foo
y: b
done.
% !!
gmake -j
a: foo
b: foo
c: foo
y: b
x: a
z: c
done.
% !!
gmake -j
a: foo
b: foo
c: foo
x: a
z: c
y: b
done.
best,
rj
--
__________________________________________________
Robert Joop
rj@{rainbow.in-berlin,fokus.gmd,cs.tu-berlin}.de
s=joop;ou=fokus;ou=berlin;p=gmd;a=d400;c=de