Hello,
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:
Code:
# Include dependency files
-include $(DEP_TARGETS)
# Rule for dependency files
%.d: %.cpp %.h
$(CXX) $< $(CXXFLAGS) -MMD -MP -c
# Cleaning rule
clean:
...
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?
Thanks! :-)
Here are the relevant (I think) parts of my Makefile: