help-make
[Top][All Lists]
Advanced

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

corrupt prerequisites when using pattern rules and parallel make


From: Jonathan Baccash
Subject: corrupt prerequisites when using pattern rules and parallel make
Date: Fri, 28 Oct 2005 09:24:11 -0700

The problem is that make thinks that if one target is not out of date,
then none of the targets will need to be rebuilt by another parallel
make process.  For example, I have the following makefile:
.DELETE_ON_ERROR:

.PHONY: all
all: r.c s.c s.h
        cmp r.c s.c

%.c %.h:
        echo blah >$*.c
        echo blah >$*.h
        sleep 3
        echo blah >>$*.c

r.c: s.c
        sleep 1
        cp $< $@

And I run the following commands:
$ make
$ rm r.c s.h
$ make -j2

The output of the final make command is:
sleep 1
echo blah >s.c
echo blah >s.h
sleep 3
cp s.c r.c
echo blah >>s.c
cmp r.c s.c
cmp: EOF on r.c
make: *** [all] Error 1

In my real-world makefile, this can cause corruption of some of the
prerequisites of a command if I only delete some of the pattern
targets and not all of them.  Is this expected?  Thanks,

Jon.




reply via email to

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