How does make keep timestamps for files? I am trying to put in place my git repo. I am adding precompiled binaries for files which are mostly not gonna change. Now, when I checkout repo from git then I dont want to compile these c files. I want to use these prebuilt binaries. So, to set up this scheme, I want to know how makefile tracks timestamps. Can anyone help me?
Thanks
In typical usage make detects that a file input to the build has changed (by observing its timestamp relative to the output) and uses this to decide that a rebuild of this part of the system is needed.
Make works by inspecting information about files, not their contents. Make works out dependencies between targets and their dependencies, and then looks to see whether the files exist. If they do, it asks the operating system for the time and date the file was last modified.
make
looks at the last-modified times. From the GNU make
manual:
The
make
program uses the makefile data base and the last-modification times of the files to decide which of the files need to be updated.
And from IEEE Std 1003.1-2008 make
manual:
The make utility examines time relationships and shall update those derived files (called targets) that have modified times earlier than the modified times of the files (called prerequisites) from which they are derived.
You can use touch
:
touch - change file access and modification times
to adjust the timestamps if necessary.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With