help-make
[Top][All Lists]
Advanced

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

problem with rule chaining


From: gk
Subject: problem with rule chaining
Date: Sat, 08 Feb 2003 16:15:19 -0800

It appears that rule chaining only works one level deep.
Can anyone explain what I'm doing wrong here?

I was under the impression that the way make works in deciding if a pattern rule applies is:
* if all prerequisites exist or can be made, then the rule applies
* if several rules 'can' apply, the one used is the first appearing in the makefile order

If the above is a correct understanding, then I expect make to use my explicit rule for 'foo.b' instead of the match-anything rule which comes later.

I am unable to build target 'foo' in the makefile below.

#makefile
%: %.a
        touch $@

%.a: %.b
        touch $@

foo.b:
        touch $@

%:
        $(error No rule for target: $@))
#eof

address@hidden src]$ make foo
Makefile:12: *** No rule for target: foo.  Stop.

If I eliminate the middle pattern rule, it works fine.

#makefile
%: %.a
        touch $@

foo.a:
        touch $@

%:
        $(error No rule for target: $@))
#eof

address@hidden src]$ make foo
touch foo.a
touch foo



- Greg Keraunen
http://www.xmake.org
http://www.xmlmake.com





reply via email to

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