Bruno Haible [2024-07-26 16:27 +0200] wrote: > Basil L. Contovounesios wrote: > >> $(top_srcdir)/.version: >> echo '$(VERSION)' > $@-t >> mv $@-t $@ >> ... >> I'm curious why one recipe writes a temporary file first
> The real reason is that if the disk is full, the rule would leave an > empty file on the disk and fail, and even after the user makes room > on the disk and runs "make" a second time, the empty file would persist > and cause trouble. > >> dist-hook: >> echo '$(VERSION)' > $(distdir)/.tarball-version >> >> whereas the other writes the target directly. > > Here it does so because the file is inside a temporary directory. If > the "make dist" rule fails, the user has to remove the temporary directory > entirely anyway, and that will also take care of the empty file. Ah, makes sense. Thank you very much for the explanation! -- Basil