[Top][All Lists]

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

[bug #19108] Pattern rules with multiple target patterns do not honor th

From: anonymous
Subject: [bug #19108] Pattern rules with multiple target patterns do not honor the dependencies of all targets correctly
Date: Thu, 24 May 2007 10:09:40 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20070309 Firefox/

Follow-up Comment #1, bug #19108 (project make):

Hello Christoph,

I believe that the problem lies in your Makefile rule:

%.tgt1 %.tgt2: %.src
cp $< $(patsubst %.src,%.tgt1,$<)
cp $< $(patsubst %.src,%.tgt2,$<) 

This rule states that %.tgt1 depends on %.src and %.tgt2 depends on %.src.
However this single rule should NOT generate both files at once. I believe
that if you rewrite your rule as follows:

%.tgt1 %.tgt2: %.src
cp $< $@

then it would work as desired.

The issue is that if multiple targets pattern rule is defined, make runs
commands for one fitting target at the time. Now, when you build "final",
make sees that it depends on "x". "x" depends on x.tgt1, which can be built
due to no further dependencies, so it calls your rules to build x.tgt1 ONLY.
But your rule builds also x.tgt2, so when make comes back to check other
dependencies of x, x.tgt2 is already up-to-date and does not need to be

My belief is that no rule should make more targets then make wants. Every
rule should only generate address@hidden Otherwise one is asking for trouble.

Best regards,
Krzysztof Malinowski


Reply to this item at:


  Message sent via/by Savannah

reply via email to

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