help-make
[Top][All Lists]
Advanced

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

per-target vpath alternatives


From: Bryan Ischo
Subject: per-target vpath alternatives
Date: Sun, 9 Sep 2007 21:29:29 -0400 (EDT)
User-agent: SquirrelMail/1.4.8-4.fc5

Hi all.  I've read some archived messages from this list which answered a
question I was about to pose about per-target vpaths in gnu make.  As
those discussions already concluded, you cannot have a per-target VPATH
variable that can be used to locate prerequisites of the target, because
per-target variables only have effect in the command block of the rule.

What I'm wondering is, what techniques are typically used instead?  If I
have separate sub-directories in which source and header files are
located, and I want targets built from sources in one directory to have
dependencies on header files from that subdirectory, and targets built
from sources in another directory to have dependencies on header files
from *that* directory, then without separate vpaths, I have to ensure that
the header file names are unique between the two directories.  I would
prefer to allow header files from otherwise separate directories to have
the same filenames if necessary, and use a target-specific vpath (or some
other alternative make construct) to allow make to use the right one for
the right target.

I am using gcc's -M option to generate makefile dependency rules for
making my source code files dependent on the header files they include,
and the rules it generates are just file names and thus must rely on vpath
to locate them.  And if I could set the vpath uniquely for each target,
then this would work just fine.  But I can't.  So maybe there is an
alternate way that this thing is normally done that gets around this
issue?  Or perhaps people just accept that header files in different
directories must always have unique names?

Thank you!
Bryan

------------------------------------------------------------------------
Bryan Ischo                address@hidden            2001 Mazda 626 GLX
Hamilton, New Zealand      http://www.ischo.com     RedHat Fedora Core 5
------------------------------------------------------------------------






reply via email to

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