Hello dear developers of a Make,

Our team faced some race problems while building a project with Make.

Precise analysis shows that the problem was in fact, that Make doesn't care
if we have different aliases for the same target.
For example:
.PHONY: all ../1/../main.o ../2/../main.o

all: ../1/../main.o ../2/../main.o

ccache gcc -o $@ -c ../main.c

ccache gcc -o $@ -c ../main.c

Here, we have 2 targets:

In fact, this is the same target/file (taking into account relative
As a result if Make will create several threads (for each target) main.o
file will be fritten concurrently (race condition).

Make doesn't operate in a wrong way.
Anyway, I think it would be great to have an additional checker in a
Makefile which (at least) will notify the operator about the problem in a

P.S. Makefile project, using which it is possible to reproduce the problem
is attached to this mail.

Attachment: build_race.tar
Description: Binary data

Reply via email to