Most of the mv operations are to move temporary files to their final place.

Some use -f, others don't. This can lead to spurious build failures when
the user performing the build changes. Centralize, and always use -f.
This commit is contained in:
christos 2019-01-21 21:11:54 +00:00
parent ed814a1c48
commit 0a4f449bbb
11 changed files with 42 additions and 41 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: bsd.dep.mk,v 1.83 2016/12/21 03:00:51 christos Exp $
# $NetBSD: bsd.dep.mk,v 1.84 2019/01/21 21:11:54 christos Exp $
##### Basic targets
realdepend: beforedepend .depend afterdepend
@ -64,7 +64,7 @@ _MKDEP_FILEFLAGS=
${CFLAGS:M-std=*} ${CFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \
${CPPFLAGS:N-Wp,-iremap,*} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} \
${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} && \
mv ${.TARGET}.tmp ${.TARGET}
${MV} ${.TARGET}.tmp ${.TARGET}
.m.d:
${_MKTARGET_CREATE}
@ -72,7 +72,7 @@ _MKDEP_FILEFLAGS=
${OBJCFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \
${CPPFLAGS:N-Wp,-iremap,*} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} \
${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} && \
mv ${.TARGET}.tmp ${.TARGET}
${MV} ${.TARGET}.tmp ${.TARGET}
.s.d .S.d:
${_MKTARGET_CREATE}
@ -80,7 +80,7 @@ _MKDEP_FILEFLAGS=
${AFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \
${CPPFLAGS:N-Wp,-iremap,*} ${AFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} \
${__acpp_flags} ${.IMPSRC} && \
mv ${.TARGET}.tmp ${.TARGET}
${MV} ${.TARGET}.tmp ${.TARGET}
.C.d .cc.d .cpp.d .cxx.d:
${_MKTARGET_CREATE}
@ -88,7 +88,7 @@ _MKDEP_FILEFLAGS=
${CXXFLAGS:M-std=*} ${CXXFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \
${CPPFLAGS:N-Wp,-iremap,*} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} \
${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} && \
mv ${.TARGET}.tmp ${.TARGET}
${MV} ${.TARGET}.tmp ${.TARGET}
.endif # defined(SRCS) && !empty(SRCS) # }

View File

@ -1,4 +1,4 @@
# $NetBSD: bsd.hostprog.mk,v 1.80 2018/05/04 14:50:40 christos Exp $
# $NetBSD: bsd.hostprog.mk,v 1.81 2019/01/21 21:11:54 christos Exp $
# @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94
.include <bsd.hostinit.mk>
@ -165,7 +165,7 @@ ${TARGETS}: # ensure existence
echo '#include "nbtool_config.h"' >> ${.TARGET}.1
echo '#endif' >> ${.TARGET}.1
cat ${.TARGET} >> ${.TARGET}.1
mv ${.TARGET}.1 ${.TARGET}
${MV} ${.TARGET}.1 ${.TARGET}
.y.c:
${_MKTARGET_YACC}
${YACC.y} -o ${.TARGET} ${.IMPSRC}
@ -173,4 +173,4 @@ ${TARGETS}: # ensure existence
echo '#include "nbtool_config.h"' >> ${.TARGET}.1
echo '#endif' >> ${.TARGET}.1
cat ${.TARGET} >> ${.TARGET}.1
mv ${.TARGET}.1 ${.TARGET}
${MV} ${.TARGET}.1 ${.TARGET}

View File

@ -1,4 +1,4 @@
# $NetBSD: bsd.info.mk,v 1.41 2015/12/18 18:57:56 christos Exp $
# $NetBSD: bsd.info.mk,v 1.42 2019/01/21 21:11:54 christos Exp $
.include <bsd.init.mk>
@ -48,7 +48,7 @@ __infoinstall: .USE
${TOOL_INSTALL_INFO} -d ${INFODIRFILE} -r ${.TARGET} 2> /dev/null; \
${TOOL_INSTALL_INFO} -d ${INFODIRFILE} ${.TARGET}; \
${TOOL_SORTINFO} < ${INFODIRFILE} > ${INFODIRFILE}.tmp; \
mv -f ${INFODIRFILE}.tmp ${INFODIRFILE}; \
${MV} ${INFODIRFILE}.tmp ${INFODIRFILE}; \
rm -f ${INFODIRFILE}.lock

View File

@ -1,4 +1,4 @@
# $NetBSD: bsd.kmodule.mk,v 1.59 2017/01/11 12:19:43 joerg Exp $
# $NetBSD: bsd.kmodule.mk,v 1.60 2019/01/21 21:11:54 christos Exp $
# We are not building this with PIE
MKPIE=no
@ -169,7 +169,7 @@ ${KMOD}_tramp.S: ${KMOD}_tmp.o ${ARCHDIR}/kmodtramp.awk ${ASM_H}
${OBJDUMP} --syms --reloc ${KMOD}_tmp.o | \
${TOOL_AWK} -f ${ARCHDIR}/kmodtramp.awk \
> tmp.S && \
mv tmp.S ${.TARGET}
${MV} tmp.S ${.TARGET}
${PROG}: ${KMOD}_tmp.o ${KMOD}_tramp.o
${_MKTARGET_LINK}

View File

@ -1,4 +1,4 @@
# $NetBSD: bsd.lib.mk,v 1.378 2019/01/06 17:02:32 christos Exp $
# $NetBSD: bsd.lib.mk,v 1.379 2019/01/21 21:11:54 christos Exp $
# @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94
.include <bsd.init.mk>
@ -663,7 +663,7 @@ ${_LIB.so.full}: ${_LIB.so.link} ${_LIB.so.debug}
( ${OBJCOPY} --strip-debug -p -R .gnu_debuglink \
--add-gnu-debuglink=${_LIB.so.debug} \
${_LIB.so.link} ${_LIB.so.full}.tmp && \
mv -f ${_LIB.so.full}.tmp ${_LIB.so.full} \
${MV} ${_LIB.so.full}.tmp ${_LIB.so.full} \
) || (rm -f ${.TARGET}; false)
${_LIB.so.link}: ${_MAINLIBDEPS}
.else # aka no MKDEBUG
@ -678,7 +678,7 @@ ${_LIB.so.full}: ${_MAINLIBDEPS}
.if ${MKSTRIPIDENT} != "no"
${OBJCOPY} -R .ident ${.TARGET}.tmp
.endif
mv -f ${.TARGET}.tmp ${.TARGET}
${MV} ${.TARGET}.tmp ${.TARGET}
# We don't use INSTALL_SYMLINK here because this is just
# happening inside the build directory/objdir. XXX Why does
# this spend so much effort on libraries that aren't live??? XXX
@ -687,10 +687,10 @@ ${_LIB.so.full}: ${_MAINLIBDEPS}
.if defined(SHLIB_FULLVERSION) && defined(SHLIB_MAJOR) && \
"${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}"
${HOST_LN} -sf ${_LIB.so.full} ${_LIB.so.major}.tmp
mv -f ${_LIB.so.major}.tmp ${_LIB.so.major}
${MV} ${_LIB.so.major}.tmp ${_LIB.so.major}
.endif
${HOST_LN} -sf ${_LIB.so.full} ${_LIB.so}.tmp
mv -f ${_LIB.so}.tmp ${_LIB.so}
${MV} ${_LIB.so}.tmp ${_LIB.so}
.if !empty(LOBJS) # {
LLIBS?= -lc

View File

@ -1,4 +1,4 @@
# $NetBSD: bsd.man.mk,v 1.119 2017/07/14 17:30:31 jmcneill Exp $
# $NetBSD: bsd.man.mk,v 1.120 2019/01/21 21:11:54 christos Exp $
# @(#)bsd.man.mk 8.1 (Berkeley) 6/8/93
.include <bsd.init.mk>
@ -90,7 +90,7 @@ realall: ${MANPAGES}
${_MSECTIONS:@N@.$N.$N${MANSUFFIX}@}: # build rule
${_MKTARGET_FORMAT}
cat ${.IMPSRC} ${MANCOMPRESS} > ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET}
cat ${.IMPSRC} ${MANCOMPRESS} > ${.TARGET}.tmp && ${MV} ${.TARGET}.tmp ${.TARGET}
.endif # !empty(MANSUFFIX)
.for F in ${MANPAGES:S/${MANSUFFIX}$//:O:u}
@ -148,17 +148,17 @@ ${_MSECTIONS:@N@.$N.cat$N${MANSUFFIX}@}: ${CATDEPS} # build rule
.if ${MKMANDOC} == yes && !defined(NOMANDOC)
if test ""${NOMANDOC.${.IMPSRC:T}:tl:Q} != "yes"; then \
${TOOL_MANDOC_ASCII} ${.IMPSRC} ${MANCOMPRESS} \
> ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET}; \
> ${.TARGET}.tmp && ${MV} ${.TARGET}.tmp ${.TARGET}; \
else \
${TOOL_ROFF_ASCII} -mandoc ${.IMPSRC} ${MANCOMPRESS} \
> ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET}; \
> ${.TARGET}.tmp && ${MV} ${.TARGET}.tmp ${.TARGET}; \
fi
.elif defined(USETBL)
${TOOL_TBL} ${.IMPSRC} | ${TOOL_ROFF_ASCII} -mandoc ${MANCOMPRESS} \
> ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET}
> ${.TARGET}.tmp && ${MV} ${.TARGET}.tmp ${.TARGET}
.else
${TOOL_ROFF_ASCII} -mandoc ${.IMPSRC} ${MANCOMPRESS} \
> ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET}
> ${.TARGET}.tmp && ${MV} ${.TARGET}.tmp ${.TARGET}
.endif
.for F in ${CATPAGES:S/${MANSUFFIX}$//:O:u}
@ -219,17 +219,17 @@ ${_MSECTIONS:@N@.$N.html$N@}: # build rule
if test ""${NOMANDOC.${.IMPSRC:T}:tl:Q} != "yes"; then \
${TOOL_MANDOC_HTML} -Oman=${HTMLLINKS},style=${HTMLSTYLE} \
${.IMPSRC} > ${.TARGET}.tmp && \
mv ${.TARGET}.tmp ${.TARGET}; \
${MV} ${.TARGET}.tmp ${.TARGET}; \
else \
${TOOL_ROFF_HTML} ${.IMPSRC} ${MANCOMPRESS} \
> ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET}; \
> ${.TARGET}.tmp && ${MV} ${.TARGET}.tmp ${.TARGET}; \
fi
.elif defined(USETBL)
${TOOL_TBL} ${.IMPSRC} | ${TOOL_ROFF_HTML} ${MANCOMPRESS} \
> ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET}
> ${.TARGET}.tmp && ${MV} ${.TARGET}.tmp ${.TARGET}
.else
${TOOL_ROFF_HTML} ${.IMPSRC} ${MANCOMPRESS} \
> ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET}
> ${.TARGET}.tmp && ${MV} ${.TARGET}.tmp ${.TARGET}
.endif
.for F in ${HTMLPAGES:O:u}

View File

@ -1,4 +1,4 @@
# $NetBSD: bsd.prog.mk,v 1.318 2018/08/12 11:50:51 christos Exp $
# $NetBSD: bsd.prog.mk,v 1.319 2019/01/21 21:11:54 christos Exp $
# @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94
.ifndef HOSTPROG
@ -53,7 +53,7 @@ CLEANFILES+=strings
.cc.o .cpp.o .cxx.o .C.o:
${CXX} -E ${CPPFLAGS} ${CXXFLAGS} ${.IMPSRC} | xstr -c -
@mv -f x.c x.cc
@${MV} x.c x.cc
@${CXX} ${CPPFLAGS} ${CXXFLAGS} -c x.cc -o ${.TARGET}
.if defined(CTFCONVERT)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}

View File

@ -1,4 +1,4 @@
# $NetBSD: bsd.sys.mk,v 1.289 2019/01/01 19:06:38 christos Exp $
# $NetBSD: bsd.sys.mk,v 1.290 2019/01/21 21:11:54 christos Exp $
#
# Build definitions used for NetBSD source tree builds.
@ -256,6 +256,7 @@ OBJCOPY?= objcopy
OBJDUMP?= objdump
PAXCTL?= paxctl
STRIP?= strip
MV?= mv -f
.SUFFIXES: .o .ln .lo .c .cc .cpp .cxx .C .m ${YHEADER:D.h}
@ -295,13 +296,13 @@ STRIP?= strip
.c.lo:
${_MKTARGET_COMPILE}
${HOST_COMPILE.c} -o ${.TARGET}.o ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC}
mv ${.TARGET}.o ${.TARGET}
${MV} ${.TARGET}.o ${.TARGET}
# C++
.cc.lo .cpp.lo .cxx.lo .C.lo:
${_MKTARGET_COMPILE}
${HOST_COMPILE.cc} -o ${.TARGET}.o ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC}
mv ${.TARGET}.o ${.TARGET}
${MV} ${.TARGET}.o ${.TARGET}
# Assembly
.s.o:

View File

@ -1,4 +1,4 @@
# $NetBSD: bsd.test.mk,v 1.25 2017/11/23 02:39:28 kre Exp $
# $NetBSD: bsd.test.mk,v 1.26 2019/01/21 21:11:54 christos Exp $
#
.include <bsd.init.mk>
@ -52,7 +52,7 @@ ${_T}: ${TESTS_SH_SRC_${_T}}
echo '#! /usr/bin/atf-sh' >${.TARGET}.tmp
cat ${.ALLSRC} >>${.TARGET}.tmp
chmod +x ${.TARGET}.tmp
mv ${.TARGET}.tmp ${.TARGET}
${MV} ${.TARGET}.tmp ${.TARGET}
. endfor
.endif
@ -91,7 +91,7 @@ Atffile: Makefile
do \
echo "tp: $${tp}"; \
done; } >Atffile.tmp
@mv Atffile.tmp Atffile
@${MV} Atffile.tmp Atffile
. endif
.endif
@ -126,7 +126,7 @@ Kyuafile: Makefile
done; \
fi; \
} >Kyuafile.tmp
@mv Kyuafile.tmp Kyuafile
@${MV} Kyuafile.tmp Kyuafile
. endif
.endif

View File

@ -1,4 +1,4 @@
# $NetBSD: bsd.x11.mk,v 1.127 2019/01/03 23:25:53 mrg Exp $
# $NetBSD: bsd.x11.mk,v 1.128 2019/01/21 21:11:54 christos Exp $
.include <bsd.init.mk>
@ -356,7 +356,7 @@ ${_pkg}.pc: ${PKGDIST.${_pkg}}/configure Makefile
s,@FREETYPE_CFLAGS@,-I${X11ROOTDIR}/include/freetype2 -I${X11ROOTDIR}/include,;" \
-e '/^Libs:/ s%-L\([^ ]*\)%-Wl,-rpath,\1 &%g' \
< ${.IMPSRC} > ${.TARGET}.tmp && \
mv -f ${.TARGET}.tmp ${.TARGET}
${MV} ${.TARGET}.tmp ${.TARGET}
CLEANFILES+= ${_PKGCONFIG_FILES} ${_PKGCONFIG_FILES:C/$/.tmp/}
.endif

View File

@ -1,4 +1,4 @@
# $NetBSD: sys.mk,v 1.137 2018/08/13 13:07:04 christos Exp $
# $NetBSD: sys.mk,v 1.138 2019/01/21 21:11:54 christos Exp $
# @(#)sys.mk 8.2 (Berkeley) 3/21/94
#
# This file contains the basic rules for make(1) and is read first
@ -218,7 +218,7 @@ YACC.y?= ${YACC} ${YFLAGS}
rm -f lex.yy.c
.l.c:
${LEX.l} ${.IMPSRC}
mv lex.yy.c ${.TARGET}
${MV} lex.yy.c ${.TARGET}
.l.o:
${LEX.l} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} lex.yy.c
@ -232,7 +232,7 @@ YACC.y?= ${YACC} ${YFLAGS}
rm -f y.tab.c
.y.c:
${YACC.y} ${.IMPSRC}
mv y.tab.c ${.TARGET}
${MV} y.tab.c ${.TARGET}
.y.o:
${YACC.y} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} y.tab.c