I am writing a program to test if the file has been modified recently, and am thinking about how to implement it.
To know if a file has been changed, there has to be a reference to compared. My primitive idea was to check the modified stamp and the accessed stamp of the file, if they were not the same, probabaly the file has been changed. But after some experiments, it was not like what I supposed.
I also thought to keep a copy of the file, so I could compare the time stamps between them, but if the volume of the files were large, that certainly causes some overhead.
As I know, GNU make only compile those source files that have been modified. How does it do to tell if a file's changed or not?