Compilation of Z.cpp
fails. I modify a private member of class Z
in file Z.h
. I rerun make
. Whereupon Make
compiles all files that depend on Z.h
: A.cpp
, B.cpp
, ..., no human would be so stupid and pedantic, ..., X.cpp
, Y.cpp
, before it finally arrives at Z.cpp
, and fails again because of a trivial typo in my edit of Z.h
...
Is there a way to make Make
adaptive? To let it start compilation with targets that did not compile lately?
[PS] Let me clarify: Of course I am aware that any modification of Z.h
may break any of A.cpp
, ..., Y.cpp
. Of course those sources need to be recompiled too. This question is about a heuristic improvement of the compilation order.
I do not expect Make
to learn anything about C++. It would be fully sufficient for me, and immensely helpful for many, if Make
could be taught to reason as follows: On my last attempt to compile A
, .., Z
, everything passed except Z
. Even if my user worked hard to fix Z
, Z
is still more likely to be broken than any other single source file. Therefore I will now compile the sources in the order Z
, A
, ..., Y
. Thereby, on average, my user will have to wait less for me to terminate with error.