From the manual:
> Ordinarily, a file cannot be intermediate if it is mentioned in the
makefile as a target or prerequisite. However, you can explicitly mark
a file as intermediate by listing it as a prerequisite of the special
target `.INTERMEDIATE'. This takes effect even if the file is mentioned
explicitly in some other way.

I found a solution in using:
.INTERMEDIATE: foo.a

But this is confusing since 'foo.a' is not mentioned in my makefile as a target or prerequisite.

Here's the modified makefile that works. Is this the recommended solution?

#makefile
%: %.a
touch $@

%.a: %.b
touch $@

foo.b:
touch $@

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

.INTERMEDIATE: foo.a
#eof

[greg@p3 src]$ make foo
touch foo.b
touch foo.a
touch foo
rm foo.a

At 04:15 PM 2/8/2003 -0800, gk wrote:
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

[greg@p3 src]$ make foo
Makefile:12: *** No rule for target: foo. Stop.
- Greg Keraunen
http://www.xmake.org
http://www.xmlmake.com



_______________________________________________
Help-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/help-make

Reply via email to