help-make
[Top][All Lists]
Advanced

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

Re: Problem with static pattern rules and full path


From: Dale King
Subject: Re: Problem with static pattern rules and full path
Date: Thu, 29 Sep 2005 22:29:40 -0500
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

Paul D. Smith wrote:

%% address@hidden writes:

 >> >> vpath $(prefix)/%.c ...

 >> >> where the prefix variable restricts the values to match the
 >> >> "current" location, whatever that is.

 dk> That doesn't seem to work either.

 >> It will definitely work, if you can compute the proper value of
 >> prefix.  Which you may not be able to do, depending on your
 >> environment.

 d> # This comes from one directory's included makefile
 d> objdir := /obj1
 d> srcs := a.c
 d> src-dirs := /foo

 d> # This is the generic rules that cannot be directory specific
 d> objs := $(addprefix $(objdir)/,$(notdir $(srcs:.c=.o)))
 d> vpath $(objdir)/%.c $(src-dirs)

Er... of course this won't work.  The .c file isn't in $(objdir), so it
will never match the pattern $(objdir)/%.c.

You have to use the source directories in the pattern for the .c files.


The idea is to use a prefix that is "above" the source directories.  As
I said above, depending on your environment this might be difficult or
even impossible.
Given the constraints I have already given then, it looks like this is impossible. I have no clue what the prefix would be because the files come from a variable set by the owner of a particular directory in the tree and can point anywhere (including outside of the tree).

I'll go back to evaluating replacing make with scons, now.





reply via email to

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