Author: bdrewery
Date: Fri Mar 11 23:45:28 2016
New Revision: 296700
URL: https://svnweb.freebsd.org/changeset/base/296700

Log:
  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

Modified:
  head/etc/Makefile
  head/include/Makefile
  head/share/examples/Makefile
  head/share/mk/local.sys.mk
  head/share/sendmail/Makefile
  head/share/zoneinfo/Makefile
  head/targets/pseudo/bootstrap-tools/Makefile
  head/targets/pseudo/kernel/Makefile
  head/targets/pseudo/stage/Makefile

Modified: head/etc/Makefile
==============================================================================
--- head/etc/Makefile   Fri Mar 11 23:45:23 2016        (r296699)
+++ head/etc/Makefile   Fri Mar 11 23:45:28 2016        (r296700)
@@ -453,12 +453,10 @@ distrib-dirs: ${MTREES:N/*} distrib-clea
        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; \

Modified: head/include/Makefile
==============================================================================
--- head/include/Makefile       Fri Mar 11 23:45:23 2016        (r296699)
+++ head/include/Makefile       Fri Mar 11 23:45:28 2016        (r296700)
@@ -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...

Modified: head/share/examples/Makefile
==============================================================================
--- head/share/examples/Makefile        Fri Mar 11 23:45:23 2016        
(r296699)
+++ head/share/examples/Makefile        Fri Mar 11 23:45:28 2016        
(r296700)
@@ -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"

Modified: head/share/mk/local.sys.mk
==============================================================================
--- head/share/mk/local.sys.mk  Fri Mar 11 23:45:23 2016        (r296699)
+++ head/share/mk/local.sys.mk  Fri Mar 11 23:45:28 2016        (r296700)
@@ -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}

Modified: head/share/sendmail/Makefile
==============================================================================
--- head/share/sendmail/Makefile        Fri Mar 11 23:45:23 2016        
(r296699)
+++ head/share/sendmail/Makefile        Fri Mar 11 23:45:28 2016        
(r296700)
@@ -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>

Modified: head/share/zoneinfo/Makefile
==============================================================================
--- head/share/zoneinfo/Makefile        Fri Mar 11 23:45:23 2016        
(r296699)
+++ head/share/zoneinfo/Makefile        Fri Mar 11 23:45:28 2016        
(r296700)
@@ -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:
 #

Modified: head/targets/pseudo/bootstrap-tools/Makefile
==============================================================================
--- head/targets/pseudo/bootstrap-tools/Makefile        Fri Mar 11 23:45:23 
2016        (r296699)
+++ head/targets/pseudo/bootstrap-tools/Makefile        Fri Mar 11 23:45:28 
2016        (r296700)
@@ -49,22 +49,20 @@ BSARGS+= OBJTOP=${BTOOLSDIR}${SRCTOP} OB
 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.

Modified: head/targets/pseudo/kernel/Makefile
==============================================================================
--- head/targets/pseudo/kernel/Makefile Fri Mar 11 23:45:23 2016        
(r296699)
+++ head/targets/pseudo/kernel/Makefile Fri Mar 11 23:45:28 2016        
(r296700)
@@ -10,11 +10,10 @@ KERN_CONFDIR= ${SRCTOP}/sys/${TARGET}/co
 
 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}

Modified: head/targets/pseudo/stage/Makefile
==============================================================================
--- head/targets/pseudo/stage/Makefile  Fri Mar 11 23:45:23 2016        
(r296699)
+++ head/targets/pseudo/stage/Makefile  Fri Mar 11 23:45:28 2016        
(r296700)
@@ -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>
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to