bug-make
[Top][All Lists]
Advanced

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

Problem with parallel build


From: Michael Ringe
Subject: Problem with parallel build
Date: Thu, 21 Oct 2010 14:43:06 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.8) Gecko/20100802 SUSE/3.1.2 Thunderbird/3.1.2

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 ---




Attachment: make_bug.tar
Description: Unix tar archive


reply via email to

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