I’m using a couple boost libraries and using the rule below to generate automatic dependencies. I think boost headers really slow down the compilation because without the dependency includes in the Makefile, it is abour 10 times faster to compile the project. Is there a way to increase the speed with generated dependencies?
%.o: %.cc
$(CXX) $(CFLAGS) $(INCLUDES) -MD -c $< -o $@
@mv $*.d .deps/
@cp .deps/$*.d .deps/$*.tmp
@sed -e 's;#.*;;' -e 's;^[^:]*: *;;' -e 's; *\\$$;;' \
-e '/^$$/d' -e 's;$$; :;' < .deps/$*.tmp >> .deps/$*.d
@rm .deps/$*.tmp
As you are likely not going to change the boost headers, there is no reason, that you add them as dependencies. By using -MMD to generate the dependency files, system headers should be ignored and thus your dependency files should get smaller, this means make have to scan less of your hard drive to see if files are still up to date etc. Of course you have to include the headers with <> not “”.