Skip to content

Commit

Permalink
Add a ${CP} alias for copying files in the build.
Browse files Browse the repository at this point in the history
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


git-svn-id: svn+ssh://svn.freebsd.org/base/head@277273 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
  • Loading branch information
will committed Jan 16, 2015
1 parent 67c32d8 commit 15bc342
Show file tree
Hide file tree
Showing 18 changed files with 28 additions and 23 deletions.
2 changes: 1 addition & 1 deletion bin/csh/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions etc/mail/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ 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
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
Expand Down
2 changes: 1 addition & 1 deletion gnu/usr.bin/grep/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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; \
Expand Down
4 changes: 2 additions & 2 deletions kerberos5/lib/libasn1/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
4 changes: 2 additions & 2 deletions kerberos5/lib/libgssapi_spnego/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
4 changes: 2 additions & 2 deletions kerberos5/lib/libhdb/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
4 changes: 2 additions & 2 deletions kerberos5/lib/libhx509/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
4 changes: 2 additions & 2 deletions lib/libc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion lib/libexpat/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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>
2 changes: 1 addition & 1 deletion lib/libunbound/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion secure/lib/libcrypto/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 5 additions & 0 deletions share/mk/sys.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tools/regression/execve/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion tools/test/dtrace/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion usr.bin/grep/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion usr.bin/lex/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion usr.bin/make/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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>
2 changes: 1 addition & 1 deletion usr.sbin/mtree/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ LIBADD= md
CLEANFILES+= fmtree.8

fmtree.8: mtree.8
cp -f ${.ALLSRC} ${.TARGET}
${CP} ${.ALLSRC} ${.TARGET}

.include <bsd.prog.mk>

0 comments on commit 15bc342

Please sign in to comment.