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
This commit is contained in:
Bryan Drewery 2016-03-11 23:45:28 +00:00
parent bd08afe1c9
commit b7d28aff10
9 changed files with 29 additions and 45 deletions

View File

@ -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; \

View File

@ -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...

View File

@ -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"

View File

@ -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}

View File

@ -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>

View File

@ -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:
#

View File

@ -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.

View File

@ -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}

View File

@ -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>