How does Makefile know that a file changed and then recompile it? February 20, 2023 by Tarik It looks at the file time-stamp – simple as that. If a dependency is newer that the target, the target is rebuilt.