[EMAIL PROTECTED] (Alexander Farber) writes:

> I've constructed a simple test case for my problem

Always a good idea ;-)


> OBJDIR = objdir
> SRCS = a.cpp \
>        src1/b.cpp
> OBJS = $(addprefix $(OBJDIR)/, $(notdir $(SRCS:.cpp=.obj)))
> 
> all: $(OBJS)
> 
> $(OBJDIR)/%.obj: %.cpp
>         @echo g++ -o $@ -c $<
> 
> bolinux72:afarber {556} gmake
> g++ -o objdir/a.obj -c a.cpp
> gmake: *** No rule to make target `objdir/b.obj', needed by `all'.  Stop.

When make tries to build `objdir/b.obj' the pattern rule after substitution
will look like this (% = `b'):


objdir/b.obj: b.cpp
         @echo g++ -o $@ -c $<

Then to test if rule is applicable, make checks if prerequisites (`b.cpp'
in our case) exist or can be made. Obviously there is no `b.cpp' in current
dir (it is in `src1/'). So you need to add `src1' to the list of dirs make
will look for `.cpp' files:

vpath %.cpp $(dir $(SRCS))

-boris



_______________________________________________
Help-make mailing list
[EMAIL PROTECTED]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to