help-make
[Top][All Lists]
Advanced

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

Re: var used by implicit rule


From: Paul D. Smith
Subject: Re: var used by implicit rule
Date: Mon, 21 Jun 2004 17:42:00 -0400

%% Ken Smith <address@hidden> writes:

  ks> I have created a small example along these lines that is not
  ks> behaving as I expect.  The following is properly deleting
  ks> document.css but it isn't deleting index.html.  Is there a
  ks> requirement that the intermediate file specified by .INTERMEDIATE:
  ks> must be a wildcard target or dependency in a pattern rule?

No.  Prerequisites to .INTERMEDIATE _MUST_ be plain filenames, not
patterns.

  ks> all: document.html

  ks> .INTERMEDIATE: document.css
  ks> .INTERMEDIATE: index.html
  ks> index.html %.css %.html: %.tex

This rule doesn't do what you think it does.  Pattern rules require all
targets to contain a '%' (pattern specifier).

Basically, this is treating index.html as a separate target that depends
on the literal file name '%.tex'.  Your makefile never tries to build
index.html.  Because make never thinks that this file is built, it never
tries to delete it.


In fact, I think this is a bug in GNU make: you should either get an
error here, or all three targets should be treated as explicit targets.
If you move the index.html file so it's not first in the list, for
example you'll get an error:

    Makefile:5: *** mixed implicit and normal rules.  Stop.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

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