I recently found out about g++'s ability to automatically generate makefiles and I'm trying to make advantage of it, however I have a small problem; that is, I have:
# Include dependency files
# Rule for dependency files
%.d: %.cpp %.h
$(CXX) $< $(CXXFLAGS) -MMD -MP -c
# Cleaning rule
The problem is that, as far as I have understood, if "include" can't find a .d file, it looks for a rule to create it, and applies the rule. This could be ok, however if I want to run "clean" I don't want dependency files to be rebuilt (i.e. objects to be compiled) if they don't exist.
Well, yeah, there probably is no need to "make clean" if no .d/.o files exist, however this kind of annoys me anyway.
Is there any way to perform makefile inclusion conditionally on the rule given from the command-line?
Here are the relevant (I think) parts of my Makefile: