help-make
[Top][All Lists]
Advanced

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

Re: problem with pattern rules and VPATH


From: Markus Mauhart
Subject: Re: problem with pattern rules and VPATH
Date: Thu, 24 Apr 2003 21:28:17 +0200

"wim delvaux" <address@hidden> wrote ...
>
> I have a rule like this
>
> a/b/a.o a/b/b.o a/b/c.o : a/b/%.o : %.c
> ...
>
> The purpose of this rule is to output the objects into a different directory
> than the sources (objects in ./a/b and sources in . )
> Now in SOME situations the course COULD be in an VPATH directory (say x/y)
>
> So I set
>
> VPATH=.:x/y
>
> Now I notice that the .c file is STILL searced for in . whereas the object
> file does not exist.
>
> Running make in -d mode shows that indeed the a.c b.c and c.c files are
> searched in . and not in ANY VPATH dir
>
> I have a workaround by defining rewriting as
>
> a/b/a.o a/b/b.o a/b/c.o : a/b/%.o : $(SPECIALLOC)%.c
> ...
>
> where the SPECIALLOC variable is set to x/y in those cases where the rule does
> not work.
>
> How can I get rid of this workaround and make the pattern rule search VPATH in
> the above circumstances.

With make-3.79.1 from and inside cygwin, I cannot reproduce your problem:

Given file ./x/y/a.cpp, directory ./a/b, and file ./wim.mk with content ..
    -------------------
    VPATH = .:x/y

    a/b/a.o a/b/b.o a/b/c.o : a/b/%.o : %.cpp
        @echo Building "$@" from "$^"

    -------------------
... then VPATH works as expected and required:

    $ make -f wim.mk a/b/a.o
    Building a/b/a.o from x/y/a.cpp

So you should send a complete testcase which can be reproduced.


Regards,
Markus.







reply via email to

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