Path prefix to src and targets

Erik Rull <[email protected]>
Newsgroups gmane.comp.gnu.make.general
Message-ID <[email protected]>
Hi all,

I would like to realize the following:
How can I "automatically" prefix the current subdirectory in the included
Makefile relative to the "main" Makefile for all targets and source files?

directory tree:

Makefile
subdir_a/
   Makefile
   file.c
subdir_b/
   subdir_c/
     Makefile
     file.c
   Makefile
   otherfile.c

When calling the "main" Makefile, the subdirectory-Makefiles get recursively
include'd into the mail Makefile and thus the targets from each sub-Makefile.
Problem here:
file.c will exist twice (and thus file.o as target) and the target rules might
miss the subdirectory-prefixes, so the build will not work properly.

Thanks.

Best regards,

Erik
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.