3 ms·
Your make file should be be specifying that the rule depends on both a.h and a.cpp (the same as all makefiles should).
by tempay 4y ago
Your make file should be be specifying that the rule depends on both a.h and a.cpp (the same as all makefiles should).
- maratc 4y agoAm I correct to assume that if I forget that in Makefile, the compilation would still work fine? Also, do I need to include all of <a.h>'s includes, and of these includes' includes?
- tempay 4y agoYes and potentially yes. Normally when manually writing Makefiles people assume the host system doesn't change as it's painful and the only alternative is to sacrifice portability. If you want a more reliable/portable/stable build the only real option is use a build system like meson/cmake/autotools/basel/... to generate the appropriate Makefile for the current machine (and once you start doing that you might as well stop using make and use ninja instead).
- gpderetta 4y agoNormally you ask your compiler to generate the dependency graph on first run, then include it from your Makefile (make already knows to rerun itself when the Makefile deps change).