I am a beginner with make and I'm wondering about when to use make clean.One colleague told me that incremental builds with make are based on the files timestamps. So, if you checkout an old version of a file in your VCS, it'll have an old timestamp and it'll be marked as no need to recompile this file. Then, that file wouldn't be included in the next build.According to that same colleague, it would be a reason to use make clean.Anyway, I roughly got the answer to the question when to use make clean from other StackExchange questions but my other question then is:Why do incremental builds using make rely on files timestamps and not on SHA-1 for example? Git, for instance, shows that we can successfully determine if a file was modified using the SHA-1.  Is it for speed issues?
Why incremental builds in make don't use hashing algorithms?
builds;make
An obvious (and arguably superficial) problem would be that the build system would have to keep record of the hashes of the files that were used for the last build. While this problem could certainly be solved, it would require side storage when the time-stamp information is already present in the file-system.More seriously, though, the hash would not convey the same semantics. If you know that file T was built from dependency D with hash H1 and then find out that D now hashes to H2, should you re-build T? Probably yes, but it could also be that H2 actually refers to an older version of the file. Time-stamps define an ordering while hashes are only comparable for equality.A feature that time-stamps support is that you can simply update the time-stamp (for example, using the POSIX command-line utility touch) in order to trick make into thinking that a dependency has changed or  more interestingly  a target is more recent than it actually is. While playing with this is a great opportunity to shoot yourself into the foot, it is useful from time to time. In a hash-based system, you would need support from the build-system itself to update its internal database of hashes used for the last build without actually building anything.While an argument could certainly be made for using hashes over time-stamps, my point is that they are not a better solution to achieve the same goal but a different solution to achieve a different goal. Which of these goals is more desirable might be open to debate.