help-make
[Top][All Lists]
Advanced

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

target-specific variable bug?


From: Martin d'Anjou
Subject: target-specific variable bug?
Date: Wed, 24 Aug 2005 15:37:12 -0400 (EDT)

Hi,

I have this makefile where the target specific variable TOP_FILE is in 
effect for an unrelated target:

TOP_FILE=file.src
TOP_FILE_TARGET=file.tgt

# Pattern rule target specific variable TOP_FILE
# should influence this rule and its prerequisites only
./compile/% %.tgt: TOP_FILE=other.src
./compile/% %.tgt:
        @echo Pattern rule for most .tgt files

all: $(TOP_FILE_TARGET)

# TOP_FILE variable is influenced by the pattern rule target specific 
# target above, but this rule is not a prerequisite of the pattern rule
$(TOP_FILE_TARGET): $(TOP_FILE)
        @echo Building $(TOP_FILE_TARGET)
        @echo src2tgt $(TOP_FILE) -o $(TOP_FILE_TARGET)
        @exit 1

To run this:

touch file.src
make

You should get:

Building file.tgt
src2tgt other.src -o file.tgt
make: *** [file.tgt] Error 1

The target specific variable $(TOP_FILE) which is supposed to be in effect
for the target %.tgt and its prerequisites is also in effect for the
$(TOP_FILE_TARGET) target. I was expecting the second line to be:

src2tgt file.src -o file.tgt

Is this normal? Is this a bug?

Thanks,
Martin





reply via email to

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