Re:Makefiles – Best Practices
by Ace17 on Saturday February 02, 2019 @07:04AM
(#19062565)
Here's all you need to track header file dependencies.
Basically, when compiling a .cpp file to generate a .o file, a corresponding .deps file is also generated.
And at make startup, we include all the .deps files we find in the bin (output) directory, if there's one.
$(BIN)/%.cpp.o: %.cpp
-include $(shell test -d $(BIN) && find $(BIN) -name "*.deps")