aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Drewery <bdrewery@FreeBSD.org>2016-03-11 23:45:28 +0000
committerBryan Drewery <bdrewery@FreeBSD.org>2016-03-11 23:45:28 +0000
commitb7d28aff1009ed31d870976928b60328bf585d07 (patch)
tree37e447dacda2e5ea234551343f02afffa679865c
parentbd08afe1c93546441a7b2a7a366579959f098940 (diff)
downloadsrc-b7d28aff1009ed31d870976928b60328bf585d07.tar.gz
src-b7d28aff1009ed31d870976928b60328bf585d07.zip
META_MODE: Simplify the META_COOKIE handling to use .USE/.USEBEFORE.
Extend it to other cases of meta mode cookies so they get the proper rm cookie behavior when a .meta file detects it needs to rebuild and fails. Sponsored by: EMC / Isilon Storage Division
Notes
Notes: svn path=/head/; revision=296700
-rw-r--r--etc/Makefile4
-rw-r--r--include/Makefile14
-rw-r--r--share/examples/Makefile10
-rw-r--r--share/mk/local.sys.mk14
-rw-r--r--share/sendmail/Makefile10
-rw-r--r--share/zoneinfo/Makefile10
-rw-r--r--targets/pseudo/bootstrap-tools/Makefile6
-rw-r--r--targets/pseudo/kernel/Makefile3
-rw-r--r--targets/pseudo/stage/Makefile3
9 files changed, 29 insertions, 45 deletions
diff --git a/etc/Makefile b/etc/Makefile
index 24e0c950fbfd..cb91c23e07a5 100644
--- a/etc/Makefile
+++ b/etc/Makefile
@@ -453,12 +453,10 @@ distrib-dirs: ${MTREES:N/*} distrib-cleanup .PHONY
done
.endif
-etc-examples-install:
- ${META_COOKIE_RM}
+etc-examples-install: ${META_DEPS}
cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
${BIN1} ${BIN2} nsmb.conf opieaccess \
${DESTDIR}${SHAREDIR}/examples/etc
- ${META_COOKIE_TOUCH}
etc-examples: etc-examples-install
${_+_}cd ${.CURDIR}/defaults; \
diff --git a/include/Makefile b/include/Makefile
index dcf0d6d86a66..bb7909884ec9 100644
--- a/include/Makefile
+++ b/include/Makefile
@@ -128,7 +128,7 @@ _MARCHS= ${MACHINE_CPUARCH}
_MARCHS+= x86
.endif
-META_COOKIES+= compat copies symlinks
+META_TARGETS+= compat copies symlinks
stage_includes: ${SHARED}
.include <bsd.prog.mk>
@@ -137,8 +137,7 @@ installincludes: ${SHARED}
${SHARED}: compat
# Take care of stale directory-level symlinks.
-compat:
- ${META_COOKIE_RM}
+compat: ${META_DEPS}
.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} crypto
if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
@@ -147,10 +146,8 @@ compat:
mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
-f ${.CURDIR}/../etc/mtree/BSD.include.dist \
-p ${DESTDIR}${INCLUDEDIR} > /dev/null
- ${META_COOKIE_TOUCH}
-copies:
- ${META_COOKIE_RM}
+copies: ${META_DEPS}
.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} crypto machine machine/pc \
${_MARCHS}
if [ -d ${DESTDIR}${INCLUDEDIR}/$i ]; then \
@@ -235,10 +232,8 @@ copies:
cd ${.CURDIR}/../sys/teken; \
${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 teken.h \
${DESTDIR}${INCLUDEDIR}/teken
- ${META_COOKIE_TOUCH}
-symlinks:
- ${META_COOKIE_RM}
+symlinks: ${META_DEPS}
@${ECHO} "Setting up symlinks to kernel source tree..."
.for i in ${LDIRS}
cd ${.CURDIR}/../sys/$i; \
@@ -351,7 +346,6 @@ symlinks:
${INSTALL_SYMLINK} ../../../sys/rpc/$$h \
${DESTDIR}${INCLUDEDIR}/rpc; \
done
- ${META_COOKIE_TOUCH}
.if ${MACHINE} == "host" && !defined(_SKIP_BUILD)
# we're here because we are building a sysroot...
diff --git a/share/examples/Makefile b/share/examples/Makefile
index 7f243fa35be5..cbc85b067048 100644
--- a/share/examples/Makefile
+++ b/share/examples/Makefile
@@ -219,11 +219,10 @@ XFILES+= bhyve/vmrun.sh
SHARED?= copies
beforeinstall: ${SHARED} etc-examples
-META_COOKIES+= copies symlinks
+META_TARGETS+= copies symlinks
.ORDER: ${SHARED} etc-examples
-copies:
- ${META_COOKIE_RM}
+copies: ${META_DEPS}
.for i in ${LDIRS}
if [ -L ${DESTDIR}${BINDIR}/$i ]; then \
rm -f ${DESTDIR}${BINDIR}/$i; \
@@ -235,15 +234,12 @@ copies:
${INSTALL} -o ${SHAREOWN} -g ${SHAREGRP} -m ${SHAREMODE} \
${.CURDIR}/${file} ${DESTDIR}${BINDIR}/${file}
.endfor
- ${META_COOKIE_TOUCH}
-symlinks:
- ${META_COOKIE_RM}
+symlinks: ${META_DEPS}
.for i in ${LDIRS}
rm -rf ${DESTDIR}${BINDIR}/$i
ln -s ${.CURDIR}/$i ${DESTDIR}${BINDIR}/$i
.endfor
- ${META_COOKIE_TOUCH}
etc-examples:
.if ${SHARED} != "symlinks"
diff --git a/share/mk/local.sys.mk b/share/mk/local.sys.mk
index 269e25380802..2236dfe2f460 100644
--- a/share/mk/local.sys.mk
+++ b/share/mk/local.sys.mk
@@ -33,10 +33,18 @@ META_COOKIE_RM= @rm -f ${META_COOKIE}
META_COOKIE_TOUCH= @touch ${META_COOKIE}
# some targets need to be .PHONY - but not in meta mode
META_NOPHONY=
-CLEANFILES+= ${META_COOKIES}
+CLEANFILES+= ${META_TARGETS}
+_meta_dep_before: .USEBEFORE
+ ${META_COOKIE_RM}
+_meta_dep_after: .USE
+ ${META_COOKIE_TOUCH}
+# Attach this to a target to allow it to benefit from meta mode's
+# not rerunning a command if it doesn't need to be considering its
+# metafile/filemon-tracked dependencies.
+META_DEPS= _meta_dep_before _meta_dep_after .META
.else
META_COOKIE_RM=
META_COOKIE_TOUCH=
-META_NOPHONY= .PHONY
+META_NOPHONY= .PHONY
.endif
-
+META_DEPS+= ${META_NOPHONY}
diff --git a/share/sendmail/Makefile b/share/sendmail/Makefile
index c8dee5a3f56a..9ec23f2030dd 100644
--- a/share/sendmail/Makefile
+++ b/share/sendmail/Makefile
@@ -16,10 +16,9 @@ SHARED?= copies
all clean cleandir depend lint tags:
beforeinstall: ${SHARED}
-META_COOKIES+= copies symlinks
+META_TARGETS+= copies symlinks
-copies:
- ${META_COOKIE_RM}
+copies: ${META_DEPS}
if [ -L ${DDIR}/${CFDIR} ]; then rm -f ${DDIR}/${CFDIR}; fi
.for dir in ${CFDIRS}
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 755 -d ${DDIR}/${dir}
@@ -27,11 +26,8 @@ copies:
.for file in ${CFFILES}
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 ${SENDMAIL_DIR}/${file} ${DDIR}/${file}
.endfor
- ${META_COOKIE_TOUCH}
-symlinks:
- ${META_COOKIE_RM}
+symlinks: ${META_DEPS}
rm -rf ${DDIR}/${CFDIR}; ln -s ${SENDMAIL_DIR}/${CFDIR} ${DDIR}/${CFDIR}
- ${META_COOKIE_TOUCH}
.include <bsd.prog.mk>
diff --git a/share/zoneinfo/Makefile b/share/zoneinfo/Makefile
index 6f40843c1e61..1ca7ea6cd95d 100644
--- a/share/zoneinfo/Makefile
+++ b/share/zoneinfo/Makefile
@@ -70,27 +70,23 @@ TZBUILDSUBDIRS= \
.if !defined(_SKIP_BUILD)
all: zoneinfo
.endif
-META_COOKIES+= zoneinfo install-zoneinfo
+META_TARGETS+= zoneinfo install-zoneinfo
-zoneinfo: yearistype ${TDATA} ${META_NOPHONY}
- ${META_COOKIE_RM}
+zoneinfo: yearistype ${TDATA} ${META_DEPS}
mkdir -p ${TZBUILDDIR}
cd ${TZBUILDDIR}; mkdir -p ${TZBUILDSUBDIRS}
umask 022; cd ${.CURDIR}; \
zic -D -d ${TZBUILDDIR} -p ${POSIXRULES} -m ${NOBINMODE} \
${LEAPFILE} -y ${.OBJDIR}/yearistype ${TZFILES}
- ${META_COOKIE_TOUCH}
beforeinstall: install-zoneinfo
-install-zoneinfo: ${META_NOPHONY}
- ${META_COOKIE_RM}
+install-zoneinfo: ${META_DEPS}
cd ${TZBUILDDIR} && \
find -s * -type f -print -exec ${INSTALL} \
-o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \
\{} ${DESTDIR}/usr/share/zoneinfo/\{} \;
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \
${CONTRIBDIR}/zone.tab ${DESTDIR}/usr/share/zoneinfo/
- ${META_COOKIE_TOUCH}
afterinstall:
#
diff --git a/targets/pseudo/bootstrap-tools/Makefile b/targets/pseudo/bootstrap-tools/Makefile
index 2d38a70155a3..1b9b339e2907 100644
--- a/targets/pseudo/bootstrap-tools/Makefile
+++ b/targets/pseudo/bootstrap-tools/Makefile
@@ -49,22 +49,20 @@ BSARGS+= OBJTOP=${BTOOLSDIR}${SRCTOP} OBJROOT='$${OBJTOP}/'
BSARGS+= MK_CROSS_COMPILER=no MK_CLANG=no MK_GCC=no
DISTRIB_ENV= INSTALL="sh ${SRCTOP}/tools/install.sh" NO_FSCHG=1 MK_TESTS=no
-legacy: .MAKE .META
+legacy: .MAKE ${META_DEPS}
mkdir -p ${LEGACY_TOOLS}
${DISTRIB_ENV} ${MAKE} -C ${SRCTOP}/etc distrib-dirs \
DESTDIR=${BTOOLSDIR} > $@.distrib-dirs_btoolsdir
${DISTRIB_ENV} ${MAKE} -C ${SRCTOP}/etc distrib-dirs \
DESTDIR=${LEGACY_TOOLS} > $@.distrib-dirs_legacy_tools
${BSENV} ${MAKE} -C ${SRCTOP} -f Makefile.inc1 ${BSARGS} $@
- touch $@
bootstrap-tools: legacy
build-tools: bootstrap-tools
cross-tools: build-tools
-cross-tools build-tools bootstrap-tools: .MAKE .META
+cross-tools build-tools bootstrap-tools: .MAKE ${META_DEPS}
${BSENV} ${MAKE} -C ${SRCTOP} -f Makefile.inc1 ${BSARGS} $@
- touch $@
# MAKELEVEL=0 so that dirdeps.mk does its thing
# BSENV:MPATH=* lets us use the bootstrapped stuff in LEGACY_TOOLS above.
diff --git a/targets/pseudo/kernel/Makefile b/targets/pseudo/kernel/Makefile
index 502c830eeabe..8783d358750e 100644
--- a/targets/pseudo/kernel/Makefile
+++ b/targets/pseudo/kernel/Makefile
@@ -10,11 +10,10 @@ KERN_CONFDIR= ${SRCTOP}/sys/${TARGET}/conf
CONFIG= ${STAGE_HOST_OBJTOP}/usr/sbin/config
-${KERNCONF}.config: .MAKE .META
+${KERNCONF}.config: .MAKE ${META_DEPS}
mkdir -p ${KERN_OBJDIR:H}
(cd ${KERN_CONFDIR} && \
${CONFIG} ${CONFIGARGS} -d ${KERN_OBJDIR} ${KERNCONF})
- @touch $@
# we need to pass curdirOk=yes to meta mode, since we want .meta files
# in ${KERN_OBJDIR}
diff --git a/targets/pseudo/stage/Makefile b/targets/pseudo/stage/Makefile
index daa352d9257a..ed3217d9f743 100644
--- a/targets/pseudo/stage/Makefile
+++ b/targets/pseudo/stage/Makefile
@@ -6,11 +6,10 @@ all:
# mtree makes a lot of noise if we are not root,
# we don't need to see it.
-stage-distrib-dirs: .META
+stage-distrib-dirs: .META ${META_DEPS}
mkdir -p ${STAGE_OBJTOP}
INSTALL="sh ${SRCTOP}/tools/install.sh" ${.MAKE} -C ${SRCTOP}/etc \
distrib-dirs -DNO_FSCHG -DWITH_TESTS DESTDIR=${STAGE_OBJTOP}
- touch $@
.include <bsd.prog.mk>