On Thu, Oct 7, 2010 at 11:29 AM, Erik Rull <[email protected]> wrote:
> I'm planning to restructure my projects source tree.
> Is it possible to write a rule that does the following:
>
> src/*.c compiles all files to build/*.o
> AND is capable to find out that one of the *.c ind the src/ has been
> modified.
Sure:
build/%.o: src/%.c
$(COMPILE.c) $(OUTPUT_OPTION) $<
> My plan is to run the makefile in the parent directory of both src and build.
>
> I'm asking that before starting restructuring because I've heard that make
> seems to have some difficulties crossing directories.
The design of the VPATH feature (which predates GNU make, btw) makes
it basically useless for such setups where you're generating files
into a directory other than the current directory. c.f.
http://make.paulandlesley.org/vpath.html for details.
Similarly, the default rules are all about generating files in the
current directory, so if you don't put the files there, you'll
basically have to write all the rules you need yourself. That's not
necessarily a bad thing, as you don't really need all those rules, but
it's something to take into account.
Otherwise, I would call "difficulties crossing directories" FUD.
Philip Guenther
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make