I currently have this in my makefile:
ifneq ($(MAKECMDGOALS),clean)
-include $(DEPS_debug)
-include $(DEPS_unittest)
-include $(DEPS_release)
endif
The DEPS_ collections are all quite large since they are generated by gcc, so I’d like to only include those dependencies when absolutely necessary.
As it is now, any time I use this makefile to do anything other than cleanup, it incurs a two-second wait due to the loading of all the dependency files. Yes, it is probably unnecessarily checking a myriad of library headers for changes but I’ll be damned if it doesn’t work so well already that I don’t want to screw with it.
I’d like to -include only $(DEPS_debug) when my make target is debug, etc.
Is there a better variable than MAKECMDGOALS I can make use of? An issue I forsee is that if I use MAKECMDGOALS to predicate the inclusion of my dependencies, if I later add an entry to the makefile foo: debug release and run make foo it won’t load any of them!
How do you generate your dependencies?
vs
The former lists the headers from
/usr/include; the latter doesn’t.