Rebuilding Makefile Targets Only When Dependency Content Changes

Posted on Sun 25 February 2018 in GNU Make • 6 min read


  • GNU Make decides whether to rebuild a ‘target’ file based on the modification times of ‘dependency’ files of the target.

  • In some cases those dependencies’ modification times can change without the contents of the files changing, thus forcing an unnecessary rebuild.

  • If make was to decide whether to rebuild by looking at the hash of the contents of the dependency files instead, it would only rebuild when the contents changed.

  • I wrote a …

Continue reading