From b8d23232b8a809ac454e7b3cd51ecea739bfea3f Mon Sep 17 00:00:00 2001 From: jlam Date: Wed, 5 Jul 2006 22:21:02 +0000 Subject: Flatten out recursive makes into a single re-invocation of make by introducing the concept of a "barrier". We separate the user-invokable targets into ones that must happen before the barrier, and ones that must happen after the barrier. The ones that happen after the barrier are run in a sub-make process. In this case, the targets that must be run after the barrier are from the "wrapper" step and beyond. We rewrite the various "flow" targets, e.g. wrapper, configure, build, etc., so that they of the right form to use the barrier target. This now completely removes the concept of PKG_PHASE from pkgsrc. It is replaced with the concept of "before" and "after" the barrier, and this state can be checked by testing for the existence of the barrier cookie file. Because we've removed most of the recursive makes, there is now nowhere to hook the PKG_ERROR_HANDLER.* commands, so remove them for now. As part of this commit, put back the logic that conditionalized the sources for the various cookie files. Because the sources are all "phony" targets, they were always run, regardless of whether or not the cookie file already existed. Now, if a cookie file exists, then that entire phase associated with that cookie file is skipped. Lastly, fix a thinko in configure/bsd.configure.mk where setting NO_CONFIGURE in a package Makefile would manage to skip the "wrapper" step altogether. Fix this by correctly noting "wrapper" and not "patch" as the preceding step to "configure". --- mk/wrapper/bsd.wrapper.mk | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'mk/wrapper/bsd.wrapper.mk') diff --git a/mk/wrapper/bsd.wrapper.mk b/mk/wrapper/bsd.wrapper.mk index d8e3f2eb1aa..8c0f0db0e1b 100644 --- a/mk/wrapper/bsd.wrapper.mk +++ b/mk/wrapper/bsd.wrapper.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.wrapper.mk,v 1.44 2006/07/05 09:08:35 jlam Exp $ +# $NetBSD: bsd.wrapper.mk,v 1.45 2006/07/05 22:21:03 jlam Exp $ # # Copyright (c) 2005 The NetBSD Foundation, Inc. # All rights reserved. @@ -55,9 +55,9 @@ ECHO_WRAPPER_MSG?= ${TRUE} PREPEND_PATH+= ${WRAPPER_BINDIR} ### -### BEGIN: after "wrapper" phase +### BEGIN: after the barrier ### -.if !empty(PHASES_AFTER_WRAPPER:M${PKG_PHASE}) +.if exists(${_BARRIER_COOKIE}) WRAPPER_DEBUG?= yes CONFIGURE_ENV+= WRAPPER_DEBUG=${WRAPPER_DEBUG:Q} @@ -764,9 +764,9 @@ SUBST_SED.unwrap= ${_UNWRAP_SED} SUBST_POSTCMD.unwrap= ${DO_NADA} .endif -.endif # PHASES_AFTER_WRAPPER +.endif ### -### END: after "wrapper" phase +### END: after the barrier ### ###################################################################### @@ -777,13 +777,17 @@ _WRAPPER_COOKIE= ${WRKDIR}/.wrapper_done .PHONY: wrapper .if !target(wrapper) -. if defined(NO_BUILD) +. if exists(${_WRAPPER_COOKIE}) +wrapper: + @${DO_NADA} +. elif exists(${_BARRIER_COOKIE}) +. if defined(NO_BUILD) wrapper: patch wrapper-cookie -. elif !exists(${_WRAPPER_COOKIE}) +. else wrapper: check-vulnerable patch acquire-wrapper-lock ${_WRAPPER_COOKIE} release-wrapper-lock +. endif . else -wrapper: - @${DO_NADA} +wrapper: barrier . endif .endif @@ -791,8 +795,12 @@ wrapper: acquire-wrapper-lock: acquire-lock release-wrapper-lock: release-lock +.if exists(${_WRAPPER_COOKIE}) ${_WRAPPER_COOKIE}: - ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${SETENV} ${BUILD_ENV} ${MAKE} ${MAKEFLAGS} real-wrapper PKG_PHASE=wrapper + @${DO_NADA} +.else +${_WRAPPER_COOKIE}: real-wrapper +.endif .PHONY: real-wrapper real-wrapper: wrapper-message wrapper-vars pre-wrapper do-wrapper post-wrapper wrapper-cookie error-check -- cgit v1.2.3