1

I set my computer's date to 1 year in the future, make a change to main.c, and recompile my project with make.

I set my computer's date back to the real date, however make now thinks that the file was last modified 1 year in the future.

I can no longer make a change to main.c and have make recognize it, unless I set my date to the future.

Is there a way to reset make's dependency dates?

Jimmay
  • 959
  • 3
  • 13
  • 27
  • 3
    Make uses dates of modification of files. You can alter them using your file manager or touch command (touch -t 20141130 your_file) – frp Nov 30 '14 at 20:31
  • Do you want to reset the modification time of `main.c` to now+(one year), or the modification time of `main` to now-(one minute)? – Beta Dec 01 '14 at 16:33

1 Answers1

0

From backup. Other than that, you can date all files to the same timestamp, e.g. the time now.

On a Unix-like system (such as Linux or Cygwin), this command will do that for you (after you have cded to the top of the build tree):

find . -type f | xargs -d '\n' touch

If you want to be 100% all files will have the same timestamp, do

now=`%Y-%m-%d %H:%M:%s`; find . -type f | xargs -d '\n' touch --date="$now"
reinierpost
  • 8,425
  • 1
  • 38
  • 70
  • I'm not sure I explained myself well enough. Because I am saving in the present, I am already changing the file's timestamps to the present. The problem is that `make` then decides that the files I have modified have not been modified because the time has gone backwards. – Jimmay Nov 30 '14 at 21:11
  • Do it after you have gone backwards. – reinierpost Nov 30 '14 at 21:18
  • Your answer just explains how to change the timestamp of a file. I am not interested in this. I want to reset the internal dates that Make uses to determine whether a file has been modified or not. – Jimmay Dec 01 '14 at 16:00
  • 2
    @Jimmay There is no such thing as "the internal dates that Makes uses". The very first comment on your question (by [frp](http://stackoverflow.com/questions/27217637/reset-makes-dependency-dates#comment42915307_27217637)) says as much: "Make uses dates of modification of files". There's nothing more to it. Make uses the last modification time of a prerequisite and the last modification time of a target and compares them. There is no "*internal* date". – Louis Dec 01 '14 at 17:14