Hi.

This problem is found with GNU Make 3.81, on Ubuntu GNU/Linux 8.10
x86.

4.11 Multiple Rules for One Target
One file can be the target of several rules. All the prerequisites
mentioned in all the rules are merged into one list of prerequisites
for the target. If the target is older than any prerequisite from any
rule, the commands are executed.

This does not seem to work properly (atleast when wildcards are
involved).


The makefile below describes the problem:

---------------------------------------------
# Prerequisites: Create a couple of in-files
# using touch before running this makefile.
#
# The prerequisite executable is not built
# before the %.out rule is executed.

all: $(patsubst %.in,%.out,$(wildcard *.in))

%.out: executable
%.out: %.in
       @echo prerequisite: $^
       test -f executable || exit 1

executable:
        sleep 20
        touch $@
---------------------------------------------

The output from this makefile will be:

prerequisite: 01.in
test -f executable || exit 1
make: *** [01.out] Error 1


However, if I change the lines:
%.out: executable
%.out: %.in

to:
%.out: %.in executable

The output will look like this:
sleep 20
touch executable
prerequisite: 01.in executable
test -f executable || exit 1
prerequisite: 02.in executable
test -f executable || exit 1
prerequisite: 03.in executable
test -f executable || exit 1
prerequisite: 04.in executable
test -f executable || exit 1
prerequisite: 05.in executable
test -f executable || exit 1
prerequisite: 06.in executable
test -f executable || exit 1
prerequisite: 07.in executable



br
Håkan



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

Reply via email to