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 ---
make_bug.tar
Description: Unix tar archive
_______________________________________________ Bug-make mailing list Bug-make@gnu.org http://lists.gnu.org/mailman/listinfo/bug-make