help-make
[Top][All Lists]
Advanced

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

Help: recipe to work around stem-splitting behavior in pattern rules.


From: Kaz Kylheku
Subject: Help: recipe to work around stem-splitting behavior in pattern rules.
Date: Thu, 22 Oct 2009 15:29:06 -0700

I have some targets which are relative pathnames with directory components.

I want to generate the prerequisite such that the full path is taken
as a stem, without being split,
and then the prefix added to that, e.g.:

  %.target : $(srcdir)/%.source

I couldn't figure out why this does not work; I did a make -d and saw
some strange
reversals. Then I found in the info manual that when the stem is being
substituted into
the prerequisite pattern, the directory part is split off and put
before the prefix!

What is the point of this feature? If someone wanted the splitting,
could it not have been expressed something like this?

  $(dir %)/prefix-part/$(basename %)/suffix

Nice and self-documenting.

Aha! This workaround works for me, but it's a hack:

 %.target : %.source

Why it works is that I already have this:

  VPATH := $(srcdir)

So, the target is generated without the $(srcdir), and then the VPATH
logic tacks it on later during the prerequisite search.

Any other tricks?




reply via email to

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