From b7d28aff1009ed31d870976928b60328bf585d07 Mon Sep 17 00:00:00 2001 From: Bryan Drewery Date: Fri, 11 Mar 2016 23:45:28 +0000 Subject: 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 --- share/examples/Makefile | 10 +++------- share/mk/local.sys.mk | 14 +++++++++++--- share/sendmail/Makefile | 10 +++------- share/zoneinfo/Makefile | 10 +++------- 4 files changed, 20 insertions(+), 24 deletions(-) (limited to 'share') 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 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: # -- cgit v1.2.3