help-make
[Top][All Lists]
Advanced

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

RE: unexpected behaviour with match anything rule


From: Warlich, Christof
Subject: RE: unexpected behaviour with match anything rule
Date: Thu, 15 Nov 2012 08:37:19 +0100

> I think this is correct behavior.  Why do you think the rules for the 'all'
> target should not be executed?  The else part states that all targets matching
> % depend on all, so its rules get run first.

I'm just puzzled because of the _different_ behaviour in ifeq- and else clause:
They only differ in that the match anything rule of the ifeq clause has no
dependency, while the match anything rule in the else clause depends on "all".
And due to that difference, only the recipe for the specific rule for target
t1 is executed in the ifeq clause (ok! :-)), while both the recipes for the 
specific
_and_ the match anything rules are executed for the else clause (why? :-().

The following, slightly modified example makes my point even clearer.
Furthermore, it shows that something is going wrong with putting the right
target into $@:

t1: ; @echo 'specific rule for target $@'
ifeq (,$(UNEXPECTED))
   %: ; @echo 'expected match anything rule for target $@'
else
   %: all ; @echo 'unexpected match anything rule target address@hidden - $$@ 
should contain $(MAKECMDGOALS)!'
endif
all: ; @echo 'rule for target $@'

$ make t1
specific rule for target t1

$ make UNEXPECTED=true t1
rule for target all
unexpected match anything rule target Makefile? - $@ should contain t1!
specific rule for target t1




reply via email to

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