On Mon, Nov 11, 2002 at 09:28:06AM +0000, Philip Armstrong wrote: > On Mon, Nov 11, 2002 at 06:21:23AM +0100, Robert Schiele wrote: > > On Sun, Nov 10, 2002 at 09:44:35PM +0000, Philip Armstrong wrote: > > > What you need is a set of make rules like the following: > > > > You don't. > > > > > include $(patsubst %.o:%.dep,$(OBJS)) > > > > What do you think the "-include $(wildcard *.d) dummy" is for? > > Implicit rule? Don't think that'll work for us -- we like to have the > dependency files kept separately from the source files so we can use > the same sources to build on about 6 platforms when developing -- all > the generated files are placed in local scratch directories. > > If you can tell me what I have to do to prod make into looking in said > directory as well as in the same place as the source files for things > like dependencies then you'll be telling me something useful! Perhaps > a simple --include argument to make would suffice? (although something > in the makefile itself would be better)
You may want to read the section about VPATH in the make
documentation.
> > > $(BUILD)/%.d : %.c
> > > gcc -MM -MG $< | sed -e "1s@^\([^ ]*\)\.o:@$(BUILD)/\1.d $(BUILD)/\1.o:@"
>> $(BUILD)/$(@F)
> >
> > What do you think the -MD flag to gcc is for?
>
> It doesn't put the dependency file in -- the dependency file itself
> sould depend on the same things that the object file does, otherwise
> the dependency file will always be out of date and potentially wrong
> -- it will reflect the dependencies at the time of the last
> compilation, not the dependencies of the current state of the sources.
>
> The sed command above makes something like
>
> foo.o: foo.c foo.h
>
> look like
>
> foo.d foo.o : foo.c foo.h
>
> So that the dependencies are always current (gnu make always updates
> all makefiles {like the .d files} first before doing anything else).
I explained in one of my former mails in this thread, why this could
not happen with the -MD flag. Because of that the explicit
dependencies for the .d files are not necessary.
You may want to read
http://www.linuxtv.org/mailinglists/linux-dvb/2002/11-2002/msg00168.html
again.
Robert
--
Robert Schiele Tel.: +49-621-181-2517
Dipl.-Wirtsch.informatiker mailto:rschiele@;uni-mannheim.de
msg06983/pgp00000.pgp
Description: PGP signature
