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



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

Reply via email to