[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: make dependency question
From: |
Brendan J Simon |
Subject: |
Re: make dependency question |
Date: |
Mon, 17 Jun 2002 09:47:15 +1000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux ppc; en-US; rv:0.9.9) Gecko/20020414 Debian/0.9.9-6 |
Hi Gert-Jan,
Thanks for the reply. I have a feeling this will not work, at least for
my scenario. I have a top level makefile which includes the
sub-makefiles which includes submakefiles ..... (and so on).
Effectively there is only ONE makefile after all the sub-makefiles have
been 'included'. I don't think that a VPATH setting can be used to find
the right sub-makefile.
eg. I need:
build/foo/fred.o : src/foo/fred.c src/foo/module.mk
build/bar/bloggs.o : src/bar/bloggs.c src/bar/module.mk
Using VPATH as you suggest would mean that the one module.mk file would
always be found before the other, therefore most targets would have a
dependency on the wrong module.mk file. Maybe I'm missing something ?
I have found another method to solve the problem but it is not generic
enough. It means editiing each module.mk file and explicitly listing it
as dependency to the object files. I thought I found a more generic
solution using a combination of the foreach() and patsubst() functions,
but unfortunately the foreach() function returns a single string so I
ended up with something like:
build/foo/fred.o : src/foo/fred.c src/foo/module.mk
build/bar/bloggs.o : src/bar/bloggs.c src/bar/module.mk ...
which completely confused make.
Thanks again,
Brendan Simon.
Gert-Jan Paulissen wrote:
Try
build/%.o : src/%.c module.mk
$(CC) -o $@ $(CFLAGS) $<
and set VPATH to the module.mk directories. Have a look at the manual for more
details.