We changed the depfiles logic to use >> (append) instead of > (truncate)
due to it being slightly faster & nicer to the disk. Do the same with
the dirstamp files as we only need the files to exist -- we don't care
about their content, and we never put anything in them ourselves. If
someone else were to, we clean them up normally with `make clean`.
Simple test case on my Linux 6.1 w/ext4 on SSD:
@: > foo.txt
for (i = 0; i <
1000000; ++i) close(open("foo.txt", O_WRONLY|O_CREAT|O_TRUNC, 0666));
-> 769 msec
@: >>foo.txt
for (i = 0; i <
1000000; ++i) close(open("foo.txt", O_WRONLY|O_CREAT|O_APPEND, 0666));
-> 2 sec
$output_rules .= ("$dirstamp:\n"
. "\t\@\$(MKDIR_P) $directory\n"
- . "\t\@: > $dirstamp\n");
+ . "\t\@: >>$dirstamp\n");
return $dirstamp;
}