help-make
[Top][All Lists]
Advanced

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

Odd behavior using multiple rules for the same target


From: simon . de . groot
Subject: Odd behavior using multiple rules for the same target
Date: Wed, 11 Jan 2006 15:02:25 +0100


Hi all,

I have created a makefile that is supposed to choose between two pattern rules, based on the availability of their dependencies:

<begin_code>

all : target0.ts
        @echo Done

target%.ts : file1
        @echo $?

target%.ts : file2
        @echo $?

<end_code>

The upper code works just fine. When I create file1 or file2, the first or the second pattern rule resp. is used. This changes when I define a random target that uses file1 as dependency. For some reason, gmake will always try to apply the first pattern rule and will complain that it cannot create file1, while file2 is there! The following code illustrates this:

<begin_code>

all : target0.ts
        @echo Done

target%.ts : file1
        @echo $?

target%.ts : file2
        @echo $?

dummy : file1
        @echo $@

<end_code>

Result:

make: *** No rule to make target `file1', needed by `target0.ts'.  Stop.

Any ideas why this is, and how to solve this in a somewhat elegant manner?

Cheers,
Simon.
reply via email to

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