Add a ${CP} alias for copying files in the build.

Some users build FreeBSD as non-root in Perforce workspaces.  By default,
Perforce sets files read-only unless they're explicitly being edited.
As a result, the -f argument must be used to cp in order to override the
read-only flag when copying source files to object directories.  Bare use of
'cp' should be avoided in the future.

Update all current users of 'cp' in the src tree.

Reviewed by:	emaste
MFC after:	1 week
Sponsored by:	Spectra Logic
This commit is contained in:
Will Andrews 2015-01-16 21:39:08 +00:00
parent 5962fd53ac
commit 7a37b5fc17
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=277273
18 changed files with 28 additions and 23 deletions

View File

@ -93,7 +93,7 @@ GENHDRS+= iconv.h
SRCS+= iconv_stub.c
iconv.h: ${.CURDIR}/iconv_stub.h
cp -f ${.CURDIR}/iconv_stub.h ${.TARGET}
${CP} ${.CURDIR}/iconv_stub.h ${.TARGET}
.endif
.endif

View File

@ -69,7 +69,7 @@ SENDMAIL_MC!= hostname
SENDMAIL_MC:= ${SENDMAIL_MC}.mc
${SENDMAIL_MC}:
cp -f freebsd.mc ${SENDMAIL_MC}
${CP} freebsd.mc ${SENDMAIL_MC}
.endif
.ifndef SENDMAIL_SUBMIT_MC
@ -77,7 +77,7 @@ SENDMAIL_SUBMIT_MC!= hostname
SENDMAIL_SUBMIT_MC:= ${SENDMAIL_SUBMIT_MC}.submit.mc
${SENDMAIL_SUBMIT_MC}:
cp -f freebsd.submit.mc ${SENDMAIL_SUBMIT_MC}
${CP} freebsd.submit.mc ${SENDMAIL_SUBMIT_MC}
.endif
INSTALL_CF= ${SENDMAIL_MC:R}.cf

View File

@ -43,7 +43,7 @@ MLINKS+=grep.1 zgrep.1 grep.1 zegrep.1 grep.1 zfgrep.1
.endif
gnugrep.1: grep.1
cp ${.ALLSRC} ${.TARGET}
${CP} ${.ALLSRC} ${.TARGET}
check: all
@failed=0; total=0; \

View File

@ -111,10 +111,10 @@ ${GEN_KX509}: kx509.asn1
.SUFFIXES: .h .c .x .hx
.x.c:
cp -f ${.IMPSRC} ${.TARGET}
${CP} ${.IMPSRC} ${.TARGET}
.hx.h:
cp -f ${.IMPSRC} ${.TARGET}
${CP} ${.IMPSRC} ${.TARGET}
.include <bsd.lib.mk>

View File

@ -45,10 +45,10 @@ ${GEN}: spnego.asn1 spnego.opt
.SUFFIXES: .h .c .x .hx
.x.c:
cp ${.IMPSRC} ${.TARGET}
${CP} ${.IMPSRC} ${.TARGET}
.hx.h:
cp ${.IMPSRC} ${.TARGET}
${CP} ${.IMPSRC} ${.TARGET}
.include <bsd.lib.mk>

View File

@ -91,10 +91,10 @@ ${GEN}: hdb.asn1
.SUFFIXES: .h .c .x .hx
.x.c:
cp ${.IMPSRC} ${.TARGET}
${CP} ${.IMPSRC} ${.TARGET}
.hx.h:
cp ${.IMPSRC} ${.TARGET}
${CP} ${.IMPSRC} ${.TARGET}
.include <bsd.lib.mk>

View File

@ -285,10 +285,10 @@ ${GEN_CRMF}: crmf.asn1
.SUFFIXES: .h .c .x .hx
.x.c:
cp ${.IMPSRC} ${.TARGET}
${CP} ${.IMPSRC} ${.TARGET}
.hx.h:
cp ${.IMPSRC} ${.TARGET}
${CP} ${.IMPSRC} ${.TARGET}
.include <bsd.lib.mk>

View File

@ -149,11 +149,11 @@ KSRCS= bcmp.c ffs.c ffsl.c fls.c flsl.c mcount.c strcat.c strchr.c \
libkern: libkern.gen libkern.${LIBC_ARCH}
libkern.gen: ${KQSRCS} ${KSRCS}
cp -fp ${LIBC_SRCTOP}/quad/quad.h ${.ALLSRC} ${DESTDIR}/sys/libkern
${CP} ${LIBC_SRCTOP}/quad/quad.h ${.ALLSRC} ${DESTDIR}/sys/libkern
libkern.${LIBC_ARCH}:: ${KMSRCS}
.if defined(KMSRCS) && !empty(KMSRCS)
cp -fp ${.ALLSRC} ${DESTDIR}/sys/libkern/${LIBC_ARCH}
${CP} ${.ALLSRC} ${DESTDIR}/sys/libkern/${LIBC_ARCH}
.endif
.if ${MK_SYSCALL_COMPAT} != "no"

View File

@ -28,6 +28,6 @@ bsdxml.h: expat.h
> ${.TARGET}
bsdxml_external.h: expat_external.h
cp -f ${.ALLSRC} ${.TARGET}
${CP} ${.ALLSRC} ${.TARGET}
.include <bsd.lib.mk>

View File

@ -32,7 +32,7 @@ LIBADD= ssl crypto pthread
# Misnamed file in upstream source
configlexer.l: configlexer.lex
cp -fp ${.ALLSRC} ${.TARGET}
${CP} ${.ALLSRC} ${.TARGET}
CLEANFILES+= configlexer.l
# Symbol prefix for lex and yacc

View File

@ -400,7 +400,7 @@ opensslconf.h: opensslconf-x86.h
.else
opensslconf.h: opensslconf-${MACHINE_CPUARCH}.h
.endif
cp -f ${.ALLSRC} ${.TARGET}
${CP} ${.ALLSRC} ${.TARGET}
OLDSYMLINKS+= libdes.a libdes.so libdes.so.3 libdes_p.a
afterinstall:

View File

@ -67,6 +67,11 @@ CTFFLAGS ?= -L VERSION
CTFCONVERT ?= ctfconvert
CTFMERGE ?= ctfmerge
# cp(1) is used to copy source files to ${.OBJDIR}, make sure it can handle
# read-only files as non-root by passing -f.
CP ?= cp -f
DTRACE ?= dtrace
.if defined(CFLAGS) && (${CFLAGS:M-g} != "")
CTFFLAGS += -g

View File

@ -14,7 +14,7 @@ all: ${PROG} goodaout ${TESTSCRIPTS}
.for x in ${TESTSCRIPTS}
${x}: ${TD}/${x}
cp ${TD}/${x} .
${CP} ${TD}/${x} .
chmod +x ${x}
.endfor

View File

@ -343,7 +343,7 @@ ${_f:T:S/c$/exe/} : ${_f}
.for _f in ${ALL_TESTEXEFILES}
${_f:T} : ${_f}
cp -f ${_f} ${.TARGET}
${CP} ${_f} ${.TARGET}
chmod a+x ${.TARGET}
.endfor

View File

@ -11,7 +11,7 @@ PROG= bsdgrep
CLEANFILES+= bsdgrep.1
bsdgrep.1: grep.1
cp -f ${.ALLSRC} ${.TARGET}
${CP} ${.ALLSRC} ${.TARGET}
.endif
SRCS= file.c grep.c queue.c util.c

View File

@ -51,7 +51,7 @@ bootstrap: ${GENFILES:S/^/init/g}
@diff -I '^#line ' -I '\$$FreeBS[D]: .*\$$' -q \
${.CURDIR}/init${_f} ${_f} 2> /dev/null || { \
echo "Bootstrapping ${_f}" ; \
cp -f ${.CURDIR}/init${_f} ${_f} ; \
${CP} ${.CURDIR}/init${_f} ${_f} ; \
}
.endfor

View File

@ -115,6 +115,6 @@ CFLAGS+= -DDEFSHELLNAME=\"${MAKE_SHELL}\"
PROG= fmake
CLEANFILES+= fmake.1
fmake.1: make.1
cp ${.ALLSRC} ${.TARGET}
${CP} ${.ALLSRC} ${.TARGET}
.include <bsd.prog.mk>

View File

@ -16,6 +16,6 @@ LIBADD= md
CLEANFILES+= fmtree.8
fmtree.8: mtree.8
cp -f ${.ALLSRC} ${.TARGET}
${CP} ${.ALLSRC} ${.TARGET}
.include <bsd.prog.mk>