help-make
[Top][All Lists]
Advanced

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

Re: different source dirs and one build dir


From: Paul Smith
Subject: Re: different source dirs and one build dir
Date: Mon, 11 Jul 2016 14:40:49 -0400

On Mon, 2016-07-11 at 20:25 +0200, zamek42 wrote:
> I have a project which has more different source dirs but I want to
> use only one build directory. VPATH is not usable, because there are
> more files with the same name in different directories.

If you have different source files with the same name in different
source directories but you want to put all the object files into the
same build directory, how can that work?

Anyway, in general you'll have to create one pattern rule per source
directory, like this:

  build/%.o : src1/%.c
          $(COMPILE.c) -o $@ -c $<

  build/%.o : src2/%.c
          $(COMPILE.c) -o $@ -c $<

  build/%.o : src3/%.c
          $(COMPILE.c) -o $@ -c $<

However, this won't solve your "same filename" problem... you'll have to decide 
how you want it to work before you can make it work that way.



reply via email to

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