[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Copied sourcefiles, automatic dependencies
From: |
Paul Smith |
Subject: |
Re: Copied sourcefiles, automatic dependencies |
Date: |
Tue, 31 Jul 2007 22:35:41 -0400 |
On Tue, 2007-07-31 at 19:09 +0200, Torsten Mohr wrote:
> In a large project we have the sources organised in several subdirectories,
> for example:
>
> SRC := some/where/main.c a/directory/gui.c some/where/else/stuff.c
>
> VPATH := some/where a/directoy some/where/else
>
> BASENAMES := $(patsubst %.c,%,$(foreach f,$(notdir $f),$(SRC)))
This is unnecessarily complex; you can just use:
BASENAMES := $(basename $(notdir $(SRC)))
Or, if you really do want to only strip the .c and leave any other
suffixes alone, you can use:
BASENAMES := $(patsubst %.c,%,$(notdir $(SRC)))
> As mentioned in an email before, i thought about creating a deep directory
> structure underneath dep_dir, so the dependency file for some/where/main.c
> would be dep_dir/some/where/main.d or creating other filenames like
> dep_dir/some_where_main.d . But i think that would lead to other problems,
> for example:
>
> %.d : %.c
> @ makedepend ...
>
> I think this could not be written like this any more because the dependency
> files can't be simply found any more.
Using underscores you'll definitely have this problem, because your
target name and prerequisite name don't match each other. However, if
you use a deep directory then it works fine, just write:
dep_dir/%.d : %.d
$(MAKEDEPEND) ...
Make will match the "%" as if they were strings (to make that's all they
are) so they can be deep if you want (as long as they are identical).
--
-------------------------------------------------------------------------------
Paul D. Smith <address@hidden> Find some GNU make tips at:
http://www.gnu.org http://make.paulandlesley.org
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist