I am experiencing a problem with modification times in GNU make 3.81.
My Makefile uses data mounted from a remote server which, for some reason unknown to me, has set the Modification Time of the files set into the far future (into the next century).
The Makefile first creates a symbolic link to the remote file "from the future" in a local directory and then based on this file runs several scripts which all generate some output files.
Now, when I want to rerun "make all" after it was interruped, to get all my output files, it will not restart with the latest output file it had generated (let's say from script number 3), but instead, it regenerates everything from start, since it notices that the first file (the one where I symlinked the file "from the future") is newer.
Is there an option to tell make to take the modification time of the symlink itself, and not the modification time of the symlink's target?
Example
Here is a minimal working example that regenerates the problem:
Set up folder and files:
mkdir symlinkmake
cd symlinkmake
echo $PWD > futurefile.txt
# set file modification time to the future
touch -t 212111111111 futurefile.txt
Content of the Makefile:
all: symlink.txt first_output.txt second_output.txt
symlink.txt:
ln -s futurefile.txt symlink.txt
first_output.txt: symlink.txt
cut -f1 -d"/" symlink.txt > first_output.txt
second_output.txt: first_output.txt
wc first_output.txt > second_output.txt
Now run make all and delete the second output file. Then rerun make. Since the first output file already exists, only the second file needs to be generated. But as futurefile.txt is newer than any other file, the first output file will also be generated:
make all
rm second_output.txt
make all
On my machine the output looks like this:
$ ls
Makefile futurefile.txt symlink.txt
$ make all
make: Warning: File `symlink.txt' has modification time 3.3e+09 s in the future
cut -f1 -d"/" symlink.txt > first_output.txt
wc first_output.txt > second_output.txt
make: warning: Clock skew detected. Your build may be incomplete.
$ rm second_output.txt
$ make all
make: Warning: File `symlink.txt' has modification time 3.3e+09 s in the future
cut -f1 -d"/" symlink.txt > first_output.txt
wc first_output.txt > second_output.txt
make: warning: Clock skew detected. Your build may be incomplete.