help-make
[Top][All Lists]
Advanced

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

Re: flat OBJDIR


From: Boris Kolpackov
Subject: Re: flat OBJDIR
Date: Mon, 23 Aug 2004 15:38:14 +0000 (UTC)
User-agent: nn/6.6.5+RFC1522

address@hidden (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





reply via email to

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