Hi,

thanks, using VPATH works, but it looks like a hack to me,
since I already _know_ the exact paths to the source files.

Also I have many source files so my VPATH list will be quite long.

Can't I construct a series of rules by using $(foreach ...) instead?

Regards
Alex

On Mon, Aug 23, 2004 at 10:48:29AM -0500, Boris Kolpackov wrote:
> [EMAIL PROTECTED] (Alexander Farber) writes:
> 
> > 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