Use a temporary file and rename it over the permanent one only if the
command succeeded. That way, we don't leave truncated files around
on failure.
$(COMPILE) -o $@ -c $<
.m4.s:
- $(EXPAND) $< > $@
+ -rm -f $@.tmp
+ $(EXPAND) $< > $@.tmp && mv -f $@.tmp $@
.s.o:
$(ASSEMBLE) -o $@ $<
$(LINK) $(scheme_LDFLAGS) $(scheme_OBJECTS) $(scheme_LIBS)
usrdef.c: $(STD_SOURCES) findprim Makefile
- -rm -f $@
- ./findprim $(STD_SOURCES) > usrdef.c
+ -rm -f $@.tmp
+ ./findprim $(STD_SOURCES) > $@.tmp && mv -f $@.tmp $@
findprim: $(findprim_OBJECTS) $(findprim_DEPENDENCIES)
-rm -f $@