help-make
[Top][All Lists]
Advanced

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

Library building 102


From: Brendan Heading
Subject: Library building 102
Date: Fri, 27 May 2005 00:15:37 +0100
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)


OK, I've worked out the basic idea of what I want my makefile to look like. A few further optimizations are in order.

What I'd like to do is put resulting objects in a different directory from where the source file resides, it keeps things nice and tidy. The trouble that I'm having is figuring out how to do this in a nice simple way.

If written statically, the rule to do this might be :

objectdir/foo.o: foo/src/foo.c

or using variables :

$(OBJDIR)/%.o: $(FOO_SRCS)/%.c

but this obviously breaks down as I would need a rule for each source directory I have. Is there a generic way I can do this for all .o and .c files ?

ie something like :

$(OBJDIR)/%.o : %.c

except with something added so that Make knows how to find the *.c file ?

I'm guessing this might be a job for VPATH.

Brendan





reply via email to

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