aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2026-08-13 12:28:09 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2026-08-13 12:31:54 +0000
commit336b6d11922ac3d080de50f789d40ff95b540cdf (patch)
treeb0bfda251f5b61ac3fbf249e1b7093bad6770a79
parentb54dcb897a5fa66ff1013d0ea403ed8894e34b8a (diff)
build: Use -f when copying sources
If one of the source files we copy is non-writeable, cp will create a non-writeable copy. If the original is later modified, cp will fail to overwrite the copy since it is not writeable. Using cp -f ensures the copy always succeeds, as long as the object directory is writeable. MFC after: 1 week Sponsored by: Klara, Inc. Sponsored by: NetApp, Inc.
-rw-r--r--tools/build/Makefile4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/build/Makefile b/tools/build/Makefile
index d71cc710be87..e7af3129730b 100644
--- a/tools/build/Makefile
+++ b/tools/build/Makefile
@@ -110,7 +110,7 @@ _WITH_EXPLICIT_BZERO!= cat ${HOST_INCLUDE_ROOT}/strings.h ${HOST_INCLUDE_ROOT}/s
# cause it to pick the file from libkern instead (which won't compile).
# Avoid modifying .PATH by creating a copy in the build directory instead.
explicit_bzero.c: ${SRCTOP}/sys/libkern/explicit_bzero.c
- cp ${.ALLSRC} ${.TARGET}
+ cp -f ${.ALLSRC} ${.TARGET}
CLEANFILES+= explicit_bzero.c
INCS+= strings.h
SRCS+= explicit_bzero.c
@@ -277,7 +277,7 @@ SRCS+= capsicum_stubs.c
# XXX: we can't add ${SRCTOP}/sys/kern to .PATH since that will causes
# conflicts with other files. Instead copy subr_capability to the build dir.
subr_capability.c: ${SRCTOP}/sys/kern/subr_capability.c
- cp ${.ALLSRC} ${.TARGET}
+ cp -f ${.ALLSRC} ${.TARGET}
SRCS+= subr_capability.c
CLEANFILES+= subr_capability.c