help-make
[Top][All Lists]
Advanced

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

Re: implicit rules


From: Noel Yap
Subject: Re: implicit rules
Date: Mon, 26 Apr 2004 15:13:24 -0400
User-agent: Mozilla Thunderbird 0.5 (Windows/20040212)

Paul D. Smith wrote:

%% Noel Yap <address@hidden> writes:

  ny> I see.  You wouldn't happen to have a patch that'll allow make to
  ny> use the implicit rule for the former example, would you?

Don't know which example you're talking about when you refer to "the
former example", but this:

I think I meant "latter" (ie "%.mk: %.m").  How can I get make to use the "%.mk: 
%.m" implicit rule to build aoeu/aoeu.mk?

  >>> %.mk: %.mk
  >>>       cp $(<) $(@)

Just doesn't make sense.  It's like saying:

    foo.o : foo.o

How can a target depend on itself as a prerequisite?  That requirement
cannot be satisfied given our current understanding of the laws of
space/time :).

The reason one might want something like "%.mk: %.mk" (rather than "foo.o: foo.o" which is different) is because of how implicit rule matching treats directories. For example, except for the spurious "Cyclic dependency" errors, in the end, make did exactly what I intended.

IIUC, make can use "%.mk: %.mk" to match "aoeu/aoeu.mk: aoeu.mk".  OTOH, IIUC, make should use 
"%.mk: %.mk" to match "aoeu/aoeu.mk: aoeu.m" so I'm clearly missing something here.

You _COULD_, however, do this:

    aoeu/%.mk : %.mk
            cp $< $@

and then all would be right with the world.  Or at least make would be
happy.

This rule is now not as generic as before; one would have to write a new rule 
depending on where the target will be created.

Noel




reply via email to

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