On Tue, May 3, 2022 at 3:55 PM Nick Bowler <nbow...@draconx.ca> wrote: > > On 2022-05-02, Karl Berry <k...@freefriends.org> wrote: > > - @echo '# dummy' >$@-t && $(am__mv) $@-t $@ > > + @: >>$@ > > > > 1) does it actually speed anything up? > > The answer seems to be a resounding "yes". I tried one of my packages > on an old slow PC, and changing this one line in Makefile.in cuts almost > 5 seconds off of the depfiles generation step in config.status. > > (All .deps directories manually deleted between runs as otherwise the > rule commands will not be executed). > > Before (x5): > % time config.status Makefile depfiles > real 0m15.320s > real 0m15.210s > real 0m15.210s > real 0m15.210s > real 0m15.220s > > After (x5): > % time config.status Makefile depfiles > real 0m10.650s > real 0m10.550s > real 0m10.550s > real 0m10.550s > real 0m10.650s > > That 5 seconds is a relatively small part of total configure runtime but > it is noticeable. > > So if make implementations have no problem including empty files (I tried > a few and all seem OK with it) then it seems like a win. > > > 2) without the mv I fear we are no longer noticing write failure > > I think it's OK. All shells that I know of set a failure status when > redirection fails, at least for simple commands like that.
FYI, in general, the $@-t dance is not really about error detection so much as persistent-error avoidance. For most uses of this idiom, we must be careful that we don't end up with the target ($@) containing the results of an incomplete or corrupted write **AND** an up-to-date timestamp (the "persistent" part), so we update atomically only after successful result creation into $@-t. However, in this case, we don't care about the contents of that file: just the timestamp, so eliminating the intermediate $@-t is a fine move.