[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Makefiles



Ok, i finally entered the wonderful world of Makefiles.
I cut my compile times from 2 minutes to an average of 5 secs and that's fine.
But there are thing left obscure to me.

1)
I build dependencies and put them in a directory, DEPS/
How can i tell make to create DEPS/ if it not exists, _BEFORE_ that it starts generating dependencies
(with an obvious chain of errors, since gcc can't create DEPS/[module].d)
The problem seems that Makefile contains

-include $(DEPS)

and so make tries to generate all dependencies before anything else is done.
The only workaround i found is to change the %.d rule to:

DEPS/%.d: %.c
	@mkdir -p DEPS/
	$(CC) -MM -MF $@ -MT $(patsubst %.d, %.o, $@) $<

Which is not very elegant, since the mkdir command is continously issued.

This gives me problems also when i try to define a 'clean:' target, wich cannot work unless all .d
files are propely generated, wich is a nonsense since 'clean:' should delete them all!

Any hint?

Thanx,
Francesco Orsenigo