From 7b3bd1cc0d8978192583558e736cf05dbf072cd8 Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Fri, 3 Jan 2014 23:01:01 +0000 Subject: [PATCH] Rework ordering and definition of targets. Move ordering of targets to the very end of bsd.port.post.mk and make it define dynamically Now all targets should be defined prior to the end of bsd.port.post.mk to allow .ORDER to control the sequence of the targets properly. From now all structural targets should also be defined in one of the _SEQ variable. Extra bonus only the really defined targets are set in the final order sequence meaning that we do not need anymore to create a ${DO_NADA} fallback target anymore, which improves performance and simplify debugging. Exp-run: bdrewery With hat: portmgr --- Mk/bsd.port.mk | 452 ++++++++++++++++++++----------------------------- 1 file changed, 185 insertions(+), 267 deletions(-) diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk index 9188129defee..f4bb8afac6fe 100644 --- a/Mk/bsd.port.mk +++ b/Mk/bsd.port.mk @@ -1560,8 +1560,7 @@ WWWGRP?= www .if !defined(BEFOREPORTMK) && !defined(INOPTIONSMK) .if defined(_POSTMKINCLUDED) -check-makefile:: - @${ECHO_MSG} "${PKGNAME}: Makefile error: you cannot include bsd.port[.post].mk twice" +DEV_ERORR= "${PKGNAME}: Makefile error: you cannot include bsd.port[.post].mk twice" @${FALSE} .endif @@ -2765,11 +2764,6 @@ maintainer: @${ECHO_CMD} "${MAINTAINER}" .endif -.if !target(check-makefile) -check-makefile:: - @${DO_NADA} -.endif - .if !defined(CATEGORIES) check-categories: @${ECHO_MSG} "${PKGNAME}: Makefile error: CATEGORIES is mandatory." @@ -3291,11 +3285,9 @@ describe: pre-everything:: @${DO_NADA} -buildanyway-message: .if defined(TRYBROKEN) && defined(BROKEN) +buildanyway-message: @${ECHO_MSG} "Trying build of ${PKGNAME} even though it is marked BROKEN." -.else - @${DO_NADA} .endif options-message: @@ -3640,16 +3632,6 @@ run-autotools-fixup: .endif .endif -.if !target(configure-autotools) -configure-autotools: - @${DO_NADA} -.endif - -.if !target(run-autotools) -run-autotools: - @${DO_NADA} -.endif - # Configure .if !target(do-configure) @@ -3942,8 +3924,8 @@ install-package: # Utility targets follow .if !target(check-already-installed) -check-already-installed: ${TMPPLIST_SORT} .if !defined(NO_PKG_REGISTER) && !defined(FORCE_PKG_REGISTER) +check-already-installed: ${TMPPLIST_SORT} @${ECHO_MSG} "===> Checking if ${PKGORIGIN} already installed"; \ ${MKDIR} ${PKG_DBDIR}; \ already_installed=`${PKG_INFO} -q -O ${PKGORIGIN}`; \ @@ -3972,8 +3954,6 @@ check-already-installed: ${TMPPLIST_SORT} ${ECHO_MSG} " in your environment or the \"make install\" command line."; \ exit 1; \ fi -.else - @${DO_NADA} .endif .endif @@ -4096,8 +4076,8 @@ PKGPREINSTALL+= ${_UG_OUTPUT} _UG_OUTPUT= /dev/null .endif .endif -create-users-groups: .if defined(GROUPS) || defined(USERS) +create-users-groups: .if defined(GROUPS) .for _file in ${GID_FILES} .if !exists(${_file}) @@ -4219,8 +4199,6 @@ create-users-groups: .endfor .endif .endif -.else - @${DO_NADA} .endif .endif @@ -4288,179 +4266,6 @@ security-check: # call the necessary targets/scripts. ################################################################ -# Please note that the order of the following targets is important, and -# should not be modified. - -.if defined(CHROOTED) -_CHROOT_SEQ= post-chroot -.else -_CHROOT_SEQ= -.endif -_SANITY_SEQ= ${_CHROOT_SEQ} pre-everything check-makefile \ - check-categories check-makevars check-desktop-entries \ - check-depends identify-install-conflicts check-deprecated \ - check-vulnerable check-license check-config buildanyway-message \ - options-message - -_PKG_DEP= check-sanity -_PKG_SEQ= pkg-depends -_FETCH_DEP= pkg -_FETCH_SEQ= fetch-depends pre-fetch pre-fetch-script \ - do-fetch fetch-specials post-fetch post-fetch-script -_EXTRACT_DEP= fetch -_EXTRACT_SEQ= check-build-conflicts extract-message checksum extract-depends \ - pre-extract pre-extract-script do-extract \ - post-extract post-extract-script -_PATCH_DEP= extract -_PATCH_SEQ= ask-license patch-message patch-depends pre-patch \ - pre-patch-script do-patch post-patch post-patch-script -_CONFIGURE_DEP= patch -_CONFIGURE_SEQ= build-depends lib-depends configure-message run-autotools-fixup \ - configure-autotools pre-configure pre-configure-script \ - run-autotools do-configure post-configure post-configure-script -_BUILD_DEP= configure -_BUILD_SEQ= build-message pre-build pre-build-script do-build \ - post-build post-build-script -.if !defined(NO_STAGE) - -_STAGE_DEP= build -_STAGE_SEQ= stage-message stage-dir run-depends lib-depends apply-slist pre-install generate-plist \ - pre-su-install -.if defined(NEED_ROOT) -_STAGE_SUSEQ= create-users-groups do-install post-install post-install-script post-stage compress-man \ - install-rc-script install-ldconfig-file install-license \ - install-desktop-entries add-plist-info add-plist-docs add-plist-examples \ - add-plist-data add-plist-post fix-plist-sequence -.if defined(DEVELOPER) -_STAGE_SUSEQ+= stage-qa -.endif -.else -_STAGE_SEQ+= create-users-groups do-install post-install post-install-script post-stage compress-man \ - install-rc-script install-ldconfig-file install-license \ - install-desktop-entries add-plist-info add-plist-docs add-plist-examples \ - add-plist-data add-plist-post fix-plist-sequence -.if defined(DEVELOPER) -_STAGE_SEQ+= stage-qa -.endif -.endif -.if defined(WITH_PKGNG) -_INSTALL_DEP= stage -_INSTALL_SEQ= install-message run-depends lib-depends check-already-installed -_INSTALL_SUSEQ= fake-pkg security-check - -_PACKAGE_DEP= stage -_PACKAGE_SEQ= package-message pre-package pre-package-script do-package post-package-script - -.else # pkg_install - -_PACKAGE_DEP= stage -_PACKAGE_SEQ= package-message pre-package pre-package-script do-package post-package-script - -_INSTALL_DEP= package -_INSTALL_SEQ= install-message run-depends lib-depends check-already-installed -_INSTALL_SUSEQ= install-package security-check -.endif - -.else # NO_STAGE - -_INSTALL_DEP= build -_INSTALL_SEQ= install-message check-install-conflicts run-depends lib-depends apply-slist pre-install \ - pre-install-script generate-plist check-already-installed -_INSTALL_SUSEQ= check-umask install-mtree pre-su-install \ - pre-su-install-script create-users-groups do-install \ - install-desktop-entries install-license install-rc-script \ - post-install post-install-script add-plist-buildinfo \ - add-plist-info add-plist-docs add-plist-examples \ - add-plist-data add-plist-post fix-plist-sequence \ - compress-man install-ldconfig-file fake-pkg security-check -_PACKAGE_DEP= install -_PACKAGE_SEQ= package-message pre-package pre-package-script \ - do-package post-package-script -.endif - -.if !target(post-chroot) -post-chroot: - @${DO_NADA} -.endif - -.if !target(check-sanity) -check-sanity: ${_SANITY_SEQ} -.endif - -# XXX MCL might need to move in loop below? -.if !target(fetch) -fetch: ${_FETCH_DEP} ${_FETCH_SEQ} -.endif - -.if !target(pkg) -pkg: ${_PKG_DEP} ${_PKG_SEQ} -.endif - -# Main logic. The loop generates 7 main targets and using cookies -# ensures that those already completed are skipped. - -.for target in extract patch configure build stage install package - -.if !target(${target}) && defined(_OPTIONS_OK) -${target}: ${${target:U}_COOKIE} -.elif !target(${target}) -${target}: config-conditional - @cd ${.CURDIR} && ${MAKE} CONFIG_DONE_${UNIQUENAME:U}=1 ${${target:U}_COOKIE} -.elif target(${target}) && defined(IGNORE) -.endif - -.if !exists(${${target:U}_COOKIE}) - -.if ${UID} != 0 && defined(_${target:U}_SUSEQ) && !defined(INSTALL_AS_USER) -.if defined(USE_SUBMAKE) -${${target:U}_COOKIE}: ${_${target:U}_DEP} - @cd ${.CURDIR} && ${MAKE} ${_${target:U}_SEQ} -.else -${${target:U}_COOKIE}: ${_${target:U}_DEP} ${_${target:U}_SEQ} -.endif - @${ECHO_MSG} "===> Switching to root credentials for '${target}' target" - @cd ${.CURDIR} && \ - ${SU_CMD} "${MAKE} ${_${target:U}_SUSEQ}" - @${ECHO_MSG} "===> Returning to user credentials" - @${TOUCH} ${TOUCH_FLAGS} ${.TARGET} -.elif defined(USE_SUBMAKE) -${${target:U}_COOKIE}: ${_${target:U}_DEP} - @cd ${.CURDIR} && \ - ${MAKE} ${_${target:U}_SEQ} ${_${target:U}_SUSEQ} - @${TOUCH} ${TOUCH_FLAGS} ${.TARGET} -.else -${${target:U}_COOKIE}: ${_${target:U}_DEP} ${_${target:U}_SEQ} ${_${target:U}_SUSEQ} - @${TOUCH} ${TOUCH_FLAGS} ${.TARGET} -.endif - -.else -${${target:U}_COOKIE}:: - @if [ -e ${.TARGET} ]; then \ - ${DO_NADA}; \ - else \ - cd ${.CURDIR} && ${MAKE} ${.TARGET}; \ - fi -.endif - -.endfor - -# Enforce order for -jN builds - -.ORDER: ${_SANITY_SEQ} -.ORDER: ${_PKG_DEP} ${_PKG_SEQ} -.ORDER: ${_FETCH_DEP} ${_FETCH_SEQ} -.ORDER: ${_EXTRACT_DEP} ${_EXTRACT_SEQ} -.ORDER: ${_PATCH_DEP} ${_PATCH_SEQ} -.ORDER: ${_CONFIGURE_DEP} ${_CONFIGURE_SEQ} -.ORDER: ${_BUILD_DEP} ${_BUILD_SEQ} -.if !defined(NO_STAGE) -.ORDER: ${_STAGE_DEP} ${_STAGE_SEQ} -.endif -.ORDER: ${_INSTALL_DEP} ${_INSTALL_SEQ} -.ORDER: ${_PACKAGE_DEP} ${_PACKAGE_SEQ} - -extract-message: - @${ECHO_MSG} "===> Extracting for ${PKGNAME}" patch-message: @${ECHO_MSG} "===> Patching for ${PKGNAME}" configure-message: @@ -4479,34 +4284,17 @@ package-message: .for stage in pre post .for name in pkg check-sanity fetch extract patch configure build stage install package -.if !target(${stage}-${name}) -${stage}-${name}: - @${DO_NADA} -.endif - +.if exists(${SCRIPTDIR}/${stage}-${name}) .if !target(${stage}-${name}-script) ${stage}-${name}-script: - @if [ -f ${SCRIPTDIR}/${.TARGET:S/-script$//} ]; then \ - cd ${.CURDIR} && ${SETENV} ${SCRIPTS_ENV} ${SH} \ - ${SCRIPTDIR}/${.TARGET:S/-script$//}; \ - fi + @ cd ${.CURDIR} && ${SETENV} ${SCRIPTS_ENV} ${SH} \ + ${SCRIPTDIR}/${.TARGET:S/-script$//} +.endif .endif .endfor .endfor -# Special cases for su -.if !target(pre-su-install) -pre-su-install: - @${DO_NADA} -.endif - -.if !target(pre-su-install-script) -pre-su-install-script: - @${DO_NADA} -.endif - - .if !target(pretty-print-www-site) pretty-print-www-site: @www_site=$$(cd ${.CURDIR} && ${MAKE} www-site); \ @@ -5848,8 +5636,8 @@ ${TMPPLIST_SORT}: ${TMPPLIST} @${SORT} -u ${TMPPLIST} >${TMPPLIST_SORT} .if !target(add-plist-docs) -add-plist-docs: .if defined(PORTDOCS) && !defined(NOPORTDOCS) +add-plist-docs: @if ${EGREP} -qe '^@cw?d' ${TMPPLIST} && \ [ "`${SED} -En -e '/^@cw?d[ ]*/s,,,p' ${TMPPLIST} | ${TAIL} -n 1`" != "${PREFIX}" ]; then \ ${ECHO_CMD} "@cwd ${PREFIX}" >> ${TMPPLIST}; \ @@ -5865,14 +5653,12 @@ add-plist-docs: @${FIND} -P -d ${PORTDOCS:S/^/${STAGEDIR}${DOCSDIR}\//} -type d 2>/dev/null | \ ${SED} -ne 's,^${STAGEDIR}${PREFIX}/,@dirrm ,p' >> ${TMPPLIST} @${ECHO_CMD} "@dirrm ${DOCSDIR_REL}" >> ${TMPPLIST} -.else - @${DO_NADA} .endif .endif .if !target(add-plist-examples) -add-plist-examples: .if defined(PORTEXAMPLES) && !defined(NOPORTEXAMPLES) +add-plist-examples: @if ${EGREP} -qe '^@cw?d' ${TMPPLIST} && \ [ "`${SED} -En -e '/^@cw?d[ ]*/s,,,p' ${TMPPLIST} | ${TAIL} -n 1`" != "${PREFIX}" ]; then \ ${ECHO_CMD} "@cwd ${PREFIX}" >> ${TMPPLIST}; \ @@ -5889,14 +5675,12 @@ add-plist-examples: @${FIND} -P -d ${PORTEXAMPLES:S/^/${STAGEDIR}${EXAMPLESDIR}\//} -type d 2>/dev/null | \ ${SED} -ne 's,^${STAGEDIR}${PREFIX}/,@dirrm ,p' >> ${TMPPLIST} @${ECHO_CMD} "@dirrm ${EXAMPLESDIR_REL}" >> ${TMPPLIST} -.else - @${DO_NADA} .endif .endif .if !target(add-plist-data) -add-plist-data: .if defined(PORTDATA) && !defined(NOPORTDATA) +add-plist-data: @if ${EGREP} -qe '^@cw?d' ${TMPPLIST} && \ [ "`${SED} -En -e '/^@cw?d[ ]*/s,,,p' ${TMPPLIST} | ${TAIL} -n 1`" != "${PREFIX}" ]; then \ ${ECHO_CMD} "@cwd ${PREFIX}" >> ${TMPPLIST}; \ @@ -5913,8 +5697,6 @@ add-plist-data: @${FIND} -P -d ${PORTDATA:S/^/${STAGEDIR}${DATADIR}\//} -type d 2>/dev/null | \ ${SED} -ne 's,^${STAGEDIR}${PREFIX}/,@dirrm ,p' >> ${TMPPLIST} @${ECHO_CMD} "@dirrm ${DATADIR_REL}" >> ${TMPPLIST} -.else - @${DO_NADA} .endif .endif @@ -5926,9 +5708,9 @@ add-plist-buildinfo: .endif .if !target(add-plist-info) +.if defined(INFO) add-plist-info: # Process GNU INFO files at package install/deinstall time -.if defined(INFO) .for i in ${INFO} .if defined(NO_STAGE) install-info --quiet ${PREFIX}/${INFO_PATH}/$i.info ${PREFIX}/${INFO_PATH}/dir @@ -5964,17 +5746,15 @@ add-plist-info: # If we're installing into a non-standard PREFIX, we need to remove that directory at # deinstall-time .if !target(add-plist-post) -add-plist-post: .if (${PREFIX} != ${LOCALBASE} && ${PREFIX} != ${LINUXBASE} && ${PREFIX} != "/usr") +add-plist-post: @${ECHO_CMD} "@unexec rmdir %D 2> /dev/null || true" >> ${TMPPLIST} -.else - @${DO_NADA} .endif .endif .if !target(install-rc-script) -install-rc-script: .if defined(USE_RCORDER) || defined(USE_RC_SUBR) && ${USE_RC_SUBR:U} != "YES" +install-rc-script: .if defined(USE_RCORDER) @${ECHO_MSG} "===> Staging early rc.d startup script(s)" @${ECHO_CMD} "@cwd /" >> ${TMPPLIST} @@ -5992,15 +5772,13 @@ install-rc-script: ${ECHO_CMD} "etc/rc.d/$${i%.sh}" >> ${TMPPLIST}; \ done .endif -.else - @${DO_NADA} .endif .endif # Compress (or uncompress) and symlink manpages. .if !target(compress-man) -compress-man: .if defined(_MANPAGES) || defined(_MLINKS) +compress-man: .if ${MANCOMPRESSED} == yes && defined(NO_MANCOMPRESS) @${ECHO_MSG} "===> Uncompressing manual pages for ${PKGNAME}" @_manpages='${_MANPAGES:S/'/'\''/g}' && [ "$${_manpages}" != "" ] && ( eval ${GUNZIP_CMD} $${_manpages} ) || ${TRUE} @@ -6021,8 +5799,6 @@ compress-man: shift; shift; \ done .endif -.else - @${DO_NADA} .endif .endif @@ -6031,8 +5807,8 @@ compress-man: # accordance to the @pkgdep directive in the packing lists .if !target(fake-pkg) -fake-pkg: .if !defined(NO_PKG_REGISTER) +fake-pkg: @if [ ! -d ${PKG_DBDIR} ]; then ${RM} -f ${PKG_DBDIR}; ${MKDIR} ${PKG_DBDIR}; fi @${RM} -f /tmp/${PKGNAME}-required-by .if defined(FORCE_PKG_REGISTER) @@ -6078,8 +5854,6 @@ fake-pkg: ${CAT} /tmp/${PKGNAME}-required-by >> ${PKG_DBDIR}/${PKGNAME}/+REQUIRED_BY; \ ${RM} -f /tmp/${PKGNAME}-required-by; \ fi -.else - @${DO_NADA} .endif .endif @@ -6549,8 +6323,8 @@ VALID_DESKTOP_CATEGORIES+= ${DESKTOP_CATEGORIES_MAIN} \ ${DESKTOP_CATEGORIES_ADDITIONAL} \ ${DESKTOP_CATEGORIES_RESERVED} -check-desktop-entries: .if defined(DESKTOP_ENTRIES) +check-desktop-entries: @set -- ${DESKTOP_ENTRIES} XXX; \ if [ `${EXPR} \( $$# - 1 \) % 6` -ne 0 ]; then \ ${ECHO_MSG} "${PKGNAME}: Makefile error: the DESKTOP_ENTRIES list must contain one or more groups of 6 elements"; \ @@ -6603,13 +6377,11 @@ check-desktop-entries: shift 6; \ num=`${EXPR} $$num + 1`; \ done -.else - @${DO_NADA} .endif .if !target(install-desktop-entries) -install-desktop-entries: .if defined(DESKTOP_ENTRIES) +install-desktop-entries: @set -- ${DESKTOP_ENTRIES} XXX; \ if [ -z "${_DESKTOPDIR_REL}" ]; then \ ${ECHO_CMD} "@cwd ${DESKTOPDIR}" >> ${TMPPLIST}; \ @@ -6645,26 +6417,9 @@ install-desktop-entries: if [ -z "${_DESKTOPDIR_REL}" ]; then \ ${ECHO_CMD} "@cwd ${PREFIX}" >> ${TMPPLIST}; \ fi -.else - @${DO_NADA} .endif .endif -.if !target(check-license) -check-license: - @${DO_NADA} -.endif - -.if !target(ask-license) -ask-license: - @${DO_NADA} -.endif - -.if !target(install-license) -install-license: - @${DO_NADA} -.endif - .if defined(WARNING) WARNING_WAIT?= 10 show-warnings: @@ -6674,8 +6429,6 @@ show-warnings: .endfor @${ECHO_MSG} @sleep ${WARNING_WAIT} - -check-makefile:: show-warnings .endif .if defined(DEVELOPER) @@ -6689,7 +6442,6 @@ show-dev-warnings: .endfor @${ECHO_MSG} @sleep ${DEV_WARNING_WAIT} -check-makefile:: show-dev-warnings .endif .if defined(DEV_ERROR) @@ -6701,9 +6453,175 @@ show-dev-errors: .endfor @${ECHO_MSG} @${FALSE} -check-makefile:: show-dev-errors .endif .endif #DEVELOPER + +# Please note that the order of the following targets is important, and +# should not be modified. + +_TARGETS_STAGES= SANITY PKG FETCH EXTRACT PATCH CONFIGURE BUILD INSTALL PACKAGE +.if !defined(NO_STAGE) +_TARGETS_STAGES+= STAGE +.endif + +_SANITY_SEQ= post-chroot pre-everything check-makefile \ + show-warnings show-dev-warnings show-dev-errors \ + check-categories check-makevars check-desktop-entries \ + check-depends identify-install-conflicts check-deprecated \ + check-vulnerable check-license check-config buildanyway-message \ + options-message + +_PKG_DEP= check-sanity +_PKG_SEQ= pkg-depends +_FETCH_DEP= pkg +_FETCH_SEQ= fetch-depends pre-fetch pre-fetch-script \ + do-fetch fetch-specials post-fetch post-fetch-script +_EXTRACT_DEP= fetch +_EXTRACT_SEQ= check-build-conflicts extract-message checksum extract-depends \ + pre-extract pre-extract-script do-extract \ + post-extract post-extract-script +_PATCH_DEP= extract +_PATCH_SEQ= ask-license patch-message patch-depends pre-patch \ + pre-patch-script do-patch post-patch post-patch-script +_CONFIGURE_DEP= patch +_CONFIGURE_SEQ= build-depends lib-depends configure-message run-autotools-fixup \ + configure-autotools pre-configure pre-configure-script \ + run-autotools do-configure post-configure post-configure-script +_BUILD_DEP= configure +_BUILD_SEQ= build-message pre-build pre-build-script do-build \ + post-build post-build-script +.if !defined(NO_STAGE) + +_STAGE_DEP= build +_STAGE_SEQ= stage-message stage-dir run-depends lib-depends apply-slist pre-install generate-plist \ + pre-su-install +.if defined(NEED_ROOT) +_STAGE_SUSEQ= create-users-groups do-install post-install post-install-script post-stage compress-man \ + install-rc-script install-ldconfig-file install-license \ + install-desktop-entries add-plist-info add-plist-docs add-plist-examples \ + add-plist-data add-plist-post fix-plist-sequence +.if defined(DEVELOPER) +_STAGE_SUSEQ+= stage-qa +.endif +.else +_STAGE_SEQ+= create-users-groups do-install post-install post-install-script post-stage compress-man \ + install-rc-script install-ldconfig-file install-license \ + install-desktop-entries add-plist-info add-plist-docs add-plist-examples \ + add-plist-data add-plist-post fix-plist-sequence +.if defined(DEVELOPER) +_STAGE_SEQ+= stage-qa +.endif +.endif +.if defined(WITH_PKGNG) +_INSTALL_DEP= stage +_INSTALL_SEQ= install-message run-depends lib-depends check-already-installed +_INSTALL_SUSEQ= fake-pkg security-check + +_PACKAGE_DEP= stage +_PACKAGE_SEQ= package-message pre-package pre-package-script do-package post-package-script + +.else # pkg_install + +_PACKAGE_DEP= stage +_PACKAGE_SEQ= package-message pre-package pre-package-script do-package post-package-script + +_INSTALL_DEP= package +_INSTALL_SEQ= install-message run-depends lib-depends check-already-installed +_INSTALL_SUSEQ= install-package security-check +.endif + +.else # NO_STAGE + +_INSTALL_DEP= build +_INSTALL_SEQ= install-message check-install-conflicts run-depends lib-depends apply-slist pre-install \ + pre-install-script generate-plist check-already-installed +_INSTALL_SUSEQ= check-umask install-mtree pre-su-install \ + pre-su-install-script create-users-groups do-install \ + install-desktop-entries install-license install-rc-script \ + post-install post-install-script add-plist-buildinfo \ + add-plist-info add-plist-docs add-plist-examples \ + add-plist-data add-plist-post fix-plist-sequence \ + compress-man install-ldconfig-file fake-pkg security-check +_PACKAGE_DEP= install +_PACKAGE_SEQ= package-message pre-package pre-package-script \ + do-package post-package-script +.endif + +# Enforce order for -jN builds + +.for _t in ${_TARGETS_STAGES} +. for s in ${_${_t}_SEQ} +. if target(${s}) +_${_t}_REAL_SEQ+= ${s} +. endif +. endfor +. for s in ${_${_t}_SUSEQ} +. if target(${s}) +_${_t}_REAL_SUSEQ+= ${s} +. endif +. endfor +.ORDER: ${_${_t}_DEP} ${_${_t}_REAL_SEQ} +.endfor + +.for target in extract patch configure build stage install package + +.if !target(${target}) && defined(_OPTIONS_OK) +${target}: ${${target:U}_COOKIE} +.elif !target(${target}) +${target}: config-conditional + @cd ${.CURDIR} && ${MAKE} CONFIG_DONE_${UNIQUENAME:U}=1 ${${target:U}_COOKIE} +.elif target(${target}) && defined(IGNORE) +.endif + +.if !exists(${${target:U}_COOKIE}) + +.if ${UID} != 0 && defined(_${target:U}_REAL_SUSEQ) && !defined(INSTALL_AS_USER) +.if defined(USE_SUBMAKE) +${${target:U}_COOKIE}: ${_${target:U}_DEP} + @cd ${.CURDIR} && ${MAKE} ${_${target:U}_REAL_SEQ} +.else +${${target:U}_COOKIE}: ${_${target:U}_DEP} ${_${target:U}_REAL_SEQ} +.endif + @${ECHO_MSG} "===> Switching to root credentials for '${target}' target" + @cd ${.CURDIR} && \ + ${SU_CMD} "${MAKE} ${_${target:U}_REAL_SUSEQ}" + @${ECHO_MSG} "===> Returning to user credentials" + @${TOUCH} ${TOUCH_FLAGS} ${.TARGET} +.elif defined(USE_SUBMAKE) +${${target:U}_COOKIE}: ${_${target:U}_DEP} + @cd ${.CURDIR} && \ + ${MAKE} ${_${target:U}_REAL_SEQ} ${_${target:U}_REAL_SUSEQ} + @${TOUCH} ${TOUCH_FLAGS} ${.TARGET} +.else +${${target:U}_COOKIE}: ${_${target:U}_DEP} ${_${target:U}_REAL_SEQ} ${_${target:U}_REAL_SUSEQ} + @${TOUCH} ${TOUCH_FLAGS} ${.TARGET} +.endif + +.else +${${target:U}_COOKIE}:: + @if [ -e ${.TARGET} ]; then \ + ${DO_NADA}; \ + else \ + cd ${.CURDIR} && ${MAKE} ${.TARGET}; \ + fi +.endif + +.endfor + +extract-message: + @${ECHO_MSG} "===> Extracting for ${PKGNAME}" +.if !target(check-sanity) +check-sanity: ${_SANITY_REAL_SEQ} +.endif + +.if !target(fetch) +fetch: ${_FETCH_DEP} ${_FETCH_REAL_SEQ} +.endif + +.if !target(pkg) +pkg: ${_PKG_DEP} ${_PKG_REAL_SEQ} +.endif + .endif # End of post-makefile section.