Hi Michael

During parallel makes if the time of the object files created and the
time archive command is run is within a second then it will fail to
include these object files. The reason I believe is due to a bug in make
rules wherein the time granularity is 1 second. Try to introduce a sleep
of 1 second before executing the archive command. 

Hope this helps.

With Regards

Vardhan 

-----Original Message-----
From: bug-make-bounces+sundara.vardhan=ge....@gnu.org
[mailto:bug-make-bounces+sundara.vardhan=ge....@gnu.org] On Behalf Of
Michael Ringe
Sent: Thursday, October 21, 2010 8:43 AM
To: Bug-make@gnu.org
Subject: Problem with parallel build

The Makefile shown below sometimes fails to build the main target
(app1).
Can anyone reproduce the error and explain what's wrong or confirm it's
a bug?

All required files are in the attached .tar file. To reproduce the
error, make sure app1.o does not exist, then run "make -j2 app1"
repeatedly.

On my machine (Intel core i5 551, openSuSE 11.3, make 3.81) make fails
after a few retries, because the link command is invoked before app1.o
is compiled.

--Michael


### --- Makefile start ---
AR := ar
CC := gcc

all: app1

# Link apps
app%: app%.o lib.a
        ${CC} ${@:app%=app%.o} lib.a -o $@

# Link lib.a
LIBSRCS := a b
lib.a: ${LIBSRCS:%=%.o}
        ${AR} r $@ ${LIBSRCS:%=%.o}

# Compile
%.o: src/%.c
        $(CC) -c -o $@ $<

# Dependencies
a.o: a.c lib.h
b.o: b.c lib.h
### --- Makefile end ---





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

Reply via email to