Subject: Reducing bsd.pkg.mk recursion, draft 1
To: None <tech-pkg@netbsd.org>
From: Todd Vierling <tv@duh.org>
List: tech-pkg
Date: 11/12/2004 13:09:07
The following diff implements removal of one layer of ${MAKE} recursion
(frontend targets to real-* targets).  It is not complete; in particular,
this change reopens PR 24721, which I have to re-fix in a different way.

On my reasonably fast Duron 900, this still produces a measurable decrease
in build time (and anecdotal faster "feel") in the pkgsrc infrastructure
part of a package build.  It also does a few loop abstractions and other
cleanups that, visually (to me), make the changed part of bsd.pkg.mk much
more readable to a human eye.

Please feel free to try out and comment.  More to come....

Index: mk/bsd.pkg.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.mk,v
retrieving revision 1.1535
diff -u -r1.1535 bsd.pkg.mk
--- mk/bsd.pkg.mk	12 Nov 2004 05:20:01 -0000	1.1535
+++ mk/bsd.pkg.mk	12 Nov 2004 18:06:18 -0000
@@ -423,7 +423,6 @@
 TOOLS_COOKIE=		${WRKDIR}/.tools_done
 PACKAGE_COOKIE=		${WRKDIR}/.package_done
 INTERACTIVE_COOKIE=	.interactive_stage
-NULL_COOKIE=		${WRKDIR}/.null

 # New message digest defs
 DIGEST_ALGORITHM?=	SHA1
@@ -1228,8 +1227,6 @@
 BUILD_ENV+=	PATH=${PATH:Q}
 BUILD_ENV+=	_PREPENDED_TO_PATH=${_PREPENDED_TO_PATH:Q}

-.MAIN: all
-
 # Use aliases, so that all versions of English are acceptable
 .if defined(LICENCE) && !defined(LICENSE)
 LICENSE=	${LICENCE}
@@ -1355,9 +1352,9 @@
 .endif # OSVERSION_SPECIFIC

 .PHONY: all
-.if !target(all)
-all: ${_PKGSRC_BUILD_TARGETS}
-.endif
+.MAIN: all
+all:
+	${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} ${_PKGSRC_BUILD_TARGETS}

 .if !defined(DEPENDS_TARGET)
 .  if make(package)
@@ -1398,48 +1395,6 @@
 # override from an individual Makefile.
 ################################################################

-# Disable checksum
-.PHONY: checksum
-.if (defined(NO_CHECKSUM) || exists(${EXTRACT_COOKIE})) && !target(checksum)
-checksum: fetch
-	@${DO_NADA}
-.endif
-
-# Disable tools
-.PHONY: tools
-.if defined(NO_TOOLS) && !target(tools)
-tools: patch
-	${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_FLAGS} ${TOOLS_COOKIE}
-.endif
-
-# Disable wrapper
-.PHONY: wrapper
-.if defined(NO_WRAPPER) && !target(wrapper)
-wrapper: tools
-	${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_FLAGS} ${WRAPPER_COOKIE}
-.endif
-
-# Disable configure
-.PHONY: configure
-.if defined(NO_CONFIGURE) && !target(configure)
-configure: wrapper
-	${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_FLAGS} ${CONFIGURE_COOKIE}
-.endif
-
-# Disable build
-.PHONY: build
-.if defined(NO_BUILD) && !target(build)
-build: configure
-	${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_FLAGS} ${BUILD_COOKIE}
-.endif
-
-# Disable install
-.PHONY: install
-.if defined(NO_INSTALL) && !target(install)
-install: build
-	${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_FLAGS} ${INSTALL_COOKIE}
-.endif
-
 # Disable package
 .PHONY: package
 .if defined(NO_PACKAGE) && !target(package)
@@ -2481,7 +2436,6 @@
 		${MAKE} ${MAKEFLAGS} delete-package;			\
 		exit 1;							\
 	fi
-	${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_FLAGS} ${PACKAGE_COOKIE}
 .  if defined(NO_BIN_ON_CDROM)
 	@${ECHO_MSG} "${_PKGSRC_IN}> Warning: ${PKGNAME} may not be put on a CD-ROM:"
 	@${ECHO_MSG} "${_PKGSRC_IN}>         " ${NO_BIN_ON_CDROM:Q}
@@ -2695,7 +2649,6 @@
 .if !defined(NO_PKG_REGISTER)
 	${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} fake-pkg
 .endif # !NO_PKG_REGISTER
-	${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_FLAGS} ${INSTALL_COOKIE}
 .if defined(PKG_DEVELOPER) && (${CHECK_SHLIBS} == "YES")
 	${_PKG_SILENT}${_PKG_DEBUG}${MAKE} ${MAKEFLAGS} check-shlibs
 .endif
@@ -3018,45 +2971,13 @@
 .  endif   # USE_LANGUAGES
 .endif

-.PHONY: acquire-extract-lock acquire-patch-lock acquire-tools-lock
-.PHONY: acquire-wrapper-lock acquire-configure-lock acquire-build-lock
-.PHONY: acquire-install-lock acquire-package-lock
-acquire-extract-lock:
+.for targ in extract patch tools wrapper configure build install package
+.PHONY: acquire-${targ}-lock release-${targ}-lock
+acquire-${targ}-lock:
 	${_ACQUIRE_LOCK}
-acquire-patch-lock:
-	${_ACQUIRE_LOCK}
-acquire-tools-lock:
-	${_ACQUIRE_LOCK}
-acquire-wrapper-lock:
-	${_ACQUIRE_LOCK}
-acquire-configure-lock:
-	${_ACQUIRE_LOCK}
-acquire-build-lock:
-	${_ACQUIRE_LOCK}
-acquire-install-lock:
-	${_ACQUIRE_LOCK}
-acquire-package-lock:
-	${_ACQUIRE_LOCK}
-
-.PHONY: release-extract-lock release-patch-lock release-tools-lock
-.PHONY: release-wrapper-lock release-configure-lock release-build-lock
-.PHONY: release-install-lock release-package-lock
-release-extract-lock:
-	${_RELEASE_LOCK}
-release-patch-lock:
-	${_RELEASE_LOCK}
-release-tools-lock:
-	${_RELEASE_LOCK}
-release-wrapper-lock:
-	${_RELEASE_LOCK}
-release-configure-lock:
-	${_RELEASE_LOCK}
-release-build-lock:
-	${_RELEASE_LOCK}
-release-install-lock:
-	${_RELEASE_LOCK}
-release-package-lock:
+release-${targ}-lock:
 	${_RELEASE_LOCK}
+.endfor

 ################################################################
 # Skeleton targets start here
@@ -3067,121 +2988,118 @@
 # call the necessary targets/scripts.
 ################################################################

-.PHONY: fetch
-.if !target(fetch)
-fetch:
-	@cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-fetch PKG_PHASE=fetch
-.endif
+##### user-visible target layer (to *_COOKIE)

-.PHONY: extract
-.if !target(extract)
-extract: checksum ${WRKDIR} acquire-extract-lock ${EXTRACT_COOKIE} release-extract-lock
-.endif
+.PHONY: fetch extract patch tools wrapper configure build
+.PHONY: test install package replace undo-replace

-.PHONY: patch
-.if !target(patch)
+fetch: real-fetch
+extract: checksum ${WRKDIR} acquire-extract-lock ${EXTRACT_COOKIE} release-extract-lock
 patch: extract acquire-patch-lock ${PATCH_COOKIE} release-patch-lock
-.endif
-
-.PHONY: tools
-.if !target(tools)
 tools: patch acquire-tools-lock ${TOOLS_COOKIE} release-tools-lock
-.endif
-
-.PHONY: wrapper
-.if !target(wrapper)
 wrapper: tools acquire-wrapper-lock ${WRAPPER_COOKIE} release-wrapper-lock
-.endif
-
-.PHONY: configure
-.if !target(configure)
 configure: wrapper acquire-configure-lock ${CONFIGURE_COOKIE} release-configure-lock
-.endif
-
-.PHONY: build
-.if !target(build)
 build: configure acquire-build-lock ${BUILD_COOKIE} release-build-lock
-.endif
-
-.PHONY: test
-.if !target(test)
 test: build ${TEST_COOKIE}
-.endif
-
-.PHONY: install
-.if !target(install)
 install: uptodate-pkgtools ${_PKGSRC_BUILD_TARGETS} acquire-install-lock ${INSTALL_COOKIE} release-install-lock
-.endif
-
-.PHONY: package
-.if !target(package)
 package: uptodate-pkgtools install acquire-package-lock ${PACKAGE_COOKIE} release-package-lock
-.endif
-
-.PHONY: replace
-.if !target(replace)
 replace: uptodate-pkgtools build real-replace
-.endif
-
-.PHONY: undo-replace
-.if !target(undo-replace)
 undo-replace: uptodate-pkgtools real-undo-replace
+
+##### *_COOKIE to real-* layer
+
+# mark a stage as complete if its cookie (and all parent cookies) exist
+.if exists(${EXTRACT_COOKIE})
+${EXTRACT_COOKIE}: .MADE
+.  if exists(${PATCH_COOKIE})
+${PATCH_COOKIE}: .MADE
+.    if exists(${TOOLS_COOKIE})
+${TOOLS_COOKIE}: .MADE
+.      if exists(${WRAPPER_COOKIE})
+${WRAPPER_COOKIE}: .MADE
+.        if exists(${CONFIGURE_COOKIE})
+${CONFIGURE_COOKIE}: .MADE
+.          if exists(${BUILD_COOKIE})
+${BUILD_COOKIE}: .MADE
+.            if exists(${TEST_COOKIE})
+${TEST_COOKIE}: .MADE
+.            endif
+.            if exists(${INSTALL_COOKIE})
+${INSTALL_COOKIE}: .MADE
+.              if exists(${PACKAGE_COOKIE})
+${PACKAGE_COOKIE}: .MADE
+.              endif
+.            endif
+.          endif
+.        endif
+.      endif
+.    endif
+.  endif
 .endif

-${EXTRACT_COOKIE}:
-.if ${INTERACTIVE_STAGE:Mextract} == "extract" && defined(BATCH)
-	@${ECHO} "*** The extract stage of this package requires user interaction"
-	@${ECHO} "*** Please extract manually with \"cd ${PKGDIR} && ${MAKE} extract\""
+# phases that may be considered interactive
+.for targ in extract configure build install
+${targ}-is-interactive:
+.  if !empty(INTERACTIVE_STAGE:M${targ}) && defined(BATCH)
+	@${ECHO} "*** The ${targ} stage of this package requires user interaction"
+	@${ECHO} "*** Please ${targ} manually with \"cd ${PKGDIR} && ${MAKE} extract\""
 	@${TOUCH} ${INTERACTIVE_COOKIE}
 	@${FALSE}
-.else
-	${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-extract DEPENDS_TARGET=${DEPENDS_TARGET:Q} PKG_PHASE=extract
-.endif
+.  endif
+.ORDER: ${targ}-is-interactive real-${targ}
+${${targ:tu}_COOKIE}: ${targ}-is-interactive real-${targ}
+	${_PKG_SILENT}${_PKG_DEBUG}${ECHO} ${PKGNAME} >${${targ:tu}_COOKIE}
+.endfor

-${PATCH_COOKIE}:
-	${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-patch PKG_PHASE=patch
+# all other cookie-based phases
+.for targ in patch tools wrapper test package
+${${targ:tu}_COOKIE}: real-${targ}
+	${_PKG_SILENT}${_PKG_DEBUG}${ECHO} ${PKGNAME} >${${targ:tu}_COOKIE}
+.endfor

-${TOOLS_COOKIE}:
-	${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-tools PKG_PHASE=tools
+##### real-* to actual component target layer

-${WRAPPER_COOKIE}:
-	${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${SETENV} ${BUILD_ENV} ${MAKE} ${MAKEFLAGS} real-wrapper PKG_PHASE=wrapper
+# Please note that the order of the following targets is important, and
+# should not be modified (.ORDER is not recognised by make(1) in a serial
+# make i.e. without -j n)

-${CONFIGURE_COOKIE}:
-.if ${INTERACTIVE_STAGE:Mconfigure} == "configure" && defined(BATCH)
-	@${ECHO} "*** The configuration stage of this package requires user interaction"
-	@${ECHO} "*** Please configure manually with \"cd ${PKGDIR} && ${MAKE} configure\""
-	@${TOUCH} ${INTERACTIVE_COOKIE}
-	@${FALSE}
-.else
-	${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${SETENV} ${BUILD_ENV} ${MAKE} ${MAKEFLAGS} real-configure PKG_PHASE=configure
-.endif
+_REAL_TARGETS.fetch=	pre-fetch do-fetch post-fetch
+_REAL_TARGETS.extract=	extract-message install-depends pre-extract do-extract post-extract
+_REAL_TARGETS.patch=	patch-message pre-patch do-patch post-patch
+_REAL_TARGETS.tools=	tools-message pre-tools do-tools post-tools
+_REAL_TARGETS.wrapper=	wrapper-message pre-wrapper do-wrapper post-wrapper
+_REAL_TARGETS.configure=configure-message pre-configure pre-configure-override do-configure post-configure
+_REAL_TARGETS.build=	build-message pre-build do-build post-build
+_REAL_TARGETS.test=	test-message pre-test do-test post-test
+_REAL_TARGETS.install=	do-su-install
+_REAL_TARGETS.package=	do-su-package
+_REAL_TARGETS.replace=	do-su-replace
+_REAL_TARGETS.undo-replace=do-su-undo-replace
+
+.for targ in fetch extract patch tools wrapper configure build test install package replace undo-replace
+.PHONY: real-${targ}
+.ORDER: ${_REAL_TARGETS.${targ}}
+real-${targ}: ${_REAL_TARGETS.${targ}}
+.endfor

-${BUILD_COOKIE}:
-.if ${INTERACTIVE_STAGE:Mbuild} == "build" && defined(BATCH)
-	@${ECHO} "*** The build stage of this package requires user interaction"
-	@${ECHO} "*** Please build manually with \"cd ${PKGDIR} && ${MAKE} build\""
-	@${TOUCH} ${INTERACTIVE_COOKIE}
-	@${FALSE}
-.else
-	${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${SETENV} ${BUILD_ENV} ${MAKE} ${MAKEFLAGS} real-build PKG_PHASE=build
+# mark all the real targets as up to date if a phase is to be skipped
+.if defined(NO_TOOLS)
+real-tools: .MADE
 .endif
-
-${TEST_COOKIE}:
-	${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${SETENV} ${BUILD_ENV} ${MAKE} ${MAKEFLAGS} real-test PKG_PHASE=test
-
-${INSTALL_COOKIE}:
-.if ${INTERACTIVE_STAGE:Minstall} == "install" && defined(BATCH)
-	@${ECHO} "*** The installation stage of this package requires user interaction"
-	@${ECHO} "*** Please install manually with \"cd ${PKGDIR} && ${MAKE} install\""
-	@${TOUCH} ${INTERACTIVE_COOKIE}
-	@${FALSE}
-.else
-	${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${SETENV} ${BUILD_ENV} ${MAKE} ${MAKEFLAGS} real-install PKG_PHASE=install
+.if defined(NO_WRAPPER)
+real-wrapper: .MADE
+.endif
+.if defined(NO_CONFIGURE)
+real-configure: .MADE
+.endif
+.if defined(NO_BUILD)
+real-build: .MADE
+.endif
+.if defined(NO_INSTALL)
+real-install: .MADE
 .endif

-${PACKAGE_COOKIE}:
-	${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${SETENV} ${BUILD_ENV} ${MAKE} ${MAKEFLAGS} real-package PKG_PHASE=package
+##### target internals

 .PHONY: extract-message patch-message tools-message wrapper-message
 .PHONY: configure-message build-message test-message
@@ -3200,54 +3118,8 @@
 test-message:
 	@${ECHO_MSG} "${_PKGSRC_IN}> Testing for ${PKGNAME}"

-.PHONY: extract-cookie patch-cookie tools-cookie wrapper-cookie
-.PHONY: configure-cookie build-cookie test-cookie
-extract-cookie:
-	${_PKG_SILENT}${_PKG_DEBUG}${ECHO} ${PKGNAME} >> ${EXTRACT_COOKIE}
-patch-cookie:
-	${_PKG_SILENT}${_PKG_DEBUG} ${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE}
-tools-cookie:
-	${_PKG_SILENT}${_PKG_DEBUG} ${TOUCH} ${TOUCH_FLAGS} ${TOOLS_COOKIE}
-wrapper-cookie:
-	${_PKG_SILENT}${_PKG_DEBUG} ${TOUCH} ${TOUCH_FLAGS} ${WRAPPER_COOKIE}
-configure-cookie:
-	${_PKG_SILENT}${_PKG_DEBUG} ${TOUCH} ${TOUCH_FLAGS} ${CONFIGURE_COOKIE}
-build-cookie:
-	${_PKG_SILENT}${_PKG_DEBUG} ${TOUCH} ${TOUCH_FLAGS} ${BUILD_COOKIE}
-test-cookie:
-	${_PKG_SILENT}${_PKG_DEBUG} ${TOUCH} ${TOUCH_FLAGS} ${TEST_COOKIE}
-
-.ORDER: pre-fetch do-fetch post-fetch
-.ORDER: extract-message install-depends pre-extract do-extract post-extract extract-cookie
-.ORDER: patch-message pre-patch do-patch post-patch patch-cookie
-.ORDER: tools-message pre-tools do-tools post-tools tools-cookie
-.ORDER: wrapper-message pre-wrapper do-wrapper post-wrapper wrapper-cookie
-.ORDER: configure-message pre-configure pre-configure-override do-configure post-configure configure-cookie
-.ORDER: build-message pre-build do-build post-build build-cookie
-.ORDER: test-message pre-test do-test post-test test-cookie
-
-# Please note that the order of the following targets is important, and
-# should not be modified (.ORDER is not recognised by make(1) in a serial
-# make i.e. without -j n)
-.PHONY: real-fetch real-extract real-patch
-.PHONY: real-tools real-wrapper
-.PHONY: real-configure real-build real-test real-install real-package
-.PHONY: real-replace real-undo-replace
-real-fetch: pre-fetch do-fetch post-fetch
-real-extract: extract-message install-depends pre-extract do-extract post-extract extract-cookie
-real-patch: patch-message pre-patch do-patch post-patch patch-cookie
-real-tools: tools-message pre-tools do-tools post-tools tools-cookie
-real-wrapper: wrapper-message pre-wrapper do-wrapper post-wrapper wrapper-cookie
-real-configure: configure-message pre-configure pre-configure-override do-configure post-configure configure-cookie
-real-build: build-message pre-build do-build post-build build-cookie
-real-test: test-message pre-test do-test post-test test-cookie
-real-install: do-su-install
-real-package: do-su-package
-real-replace: do-su-replace
-real-undo-replace: do-su-undo-replace
-
 _SU_TARGET=								\
-	if [ `${ID} -u` = `${ID} -u ${ROOT_USER}` ]; then					\
+	if [ `${ID} -u` = `${ID} -u ${ROOT_USER}` ]; then		\
 		${MAKE} ${MAKEFLAGS} $$realtarget;			\
 	elif [ "X${BATCH}" != X"" ]; then				\
 		${ECHO_MSG} "Warning: Batch mode, not superuser, can't run $$action for ${PKGNAME}."; \
@@ -3875,7 +3747,11 @@
 .endif

 .PHONY: checksum
-.if !target(checksum)
+.if exists(${EXTRACT_COOKIE})
+checksum:
+.elif defined(NO_CHECKSUM)
+checksum: fetch
+.else
 checksum: fetch uptodate-digest
 	${_PKG_SILENT}${_PKG_DEBUG}					\
 	if [ ! -f ${DISTINFO_FILE} ]; then				\
Index: mk/bsd.prefs.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.prefs.mk,v
retrieving revision 1.176
diff -u -r1.176 bsd.prefs.mk
--- mk/bsd.prefs.mk	31 Oct 2004 22:05:02 -0000	1.176
+++ mk/bsd.prefs.mk	12 Nov 2004 18:06:18 -0000
@@ -277,20 +277,28 @@
 .endif

 PKGDIRMODE?=		755
-PKG_PHASE?=		none
-#
-# The PHASES_AFTER_<phase> variables list every phase "greater than or
-# equal to" <phase>.
-#
-PHASES_AFTER_FETCH=	fetch ${PHASES_AFTER_EXTRACT}
-PHASES_AFTER_EXTRACT=	extract ${PHASES_AFTER_PATCH}
-PHASES_AFTER_PATCH=	patch ${PHASES_AFTER_TOOLS}
-PHASES_AFTER_TOOLS=	tools ${PHASES_AFTER_WRAPPER}
-PHASES_AFTER_WRAPPER=	wrapper ${PHASES_AFTER_CONFIGURE}
-PHASES_AFTER_CONFIGURE=	configure ${PHASES_AFTER_BUILD}
-PHASES_AFTER_BUILD=	build ${PHASES_AFTER_INSTALL}
-PHASES_AFTER_INSTALL=	install ${PHASES_AFTER_PACKAGE}
-PHASES_AFTER_PACKAGE=	package
+
+.if make(package) # || make(show-var)
+PKG_PHASES=	fetch extract patch tools wrapper configure build install package
+.elif make(install) || make(replace)
+PKG_PHASES=	fetch extract patch tools wrapper configure build install
+.elif make(build)
+PKG_PHASES=	fetch extract patch tools wrapper configure build
+.elif make(configure)
+PKG_PHASES=	fetch extract patch tools wrapper configure
+.elif make(wrapper)
+PKG_PHASES=	fetch extract patch tools wrapper
+.elif make(tools)
+PKG_PHASES=	fetch extract patch tools
+.elif make(patch)
+PKG_PHASES=	fetch extract patch
+.elif make(extract)
+PKG_PHASES=	fetch extract
+.elif make(fetch)
+PKG_PHASES=	fetch
+.else
+PKG_PHASES=	# empty
+.endif

 # Set the style of installation to be performed for the package.  The
 # funky make variable modifiers just select the first word of the value
Index: mk/reduce-depends.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/reduce-depends.mk,v
retrieving revision 1.2
diff -u -r1.2 reduce-depends.mk
--- mk/reduce-depends.mk	6 Oct 2004 21:51:41 -0000	1.2
+++ mk/reduce-depends.mk	12 Nov 2004 18:06:19 -0000
@@ -43,11 +43,10 @@
 # use the dependency information.  In these cases, ${REDUCED_DEPENDS}
 # is simply empty.
 #
-_PHASES_SKIP_DEPENDS=	fetch patch tools wrapper configure build test
-.if !empty(_PHASES_SKIP_DEPENDS:M${PKG_PHASE})
-_DEPENDS=	# empty
-.else
+.if !empty(PKG_PHASES:Mextract)
 _DEPENDS=	${DEPENDS}
+.else
+_DEPENDS=	# empty
 .endif

 # _DEPENDS_PKGPATHS contains the full physical paths to the pkgsrc
Index: mk/buildlink3/BUILDLINK3_DG
===================================================================
RCS file: /cvsroot/pkgsrc/mk/buildlink3/BUILDLINK3_DG,v
retrieving revision 1.6
diff -u -r1.6 BUILDLINK3_DG
--- mk/buildlink3/BUILDLINK3_DG	21 Sep 2004 15:01:40 -0000	1.6
+++ mk/buildlink3/BUILDLINK3_DG	12 Nov 2004 18:06:19 -0000
@@ -82,12 +82,3 @@
     The lines preceded with [*] are the commands that are intercepted
     by the wrapper scripts, and the lines preceded with <.> are the
     commands that are executed by the wrapper scripts.
-
-
-Q4: Why can't I check the values of variables set by the buildlink3
-    framework using 'make show-var VARNAME=...'?
-
-A4: Some variables are only defined for a subset of the package build
-    phases.  Try instead:
-
-	make show-var PKG_PHASE=wrapper VARNAME=...
Index: mk/buildlink3/bsd.buildlink3.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/buildlink3/bsd.buildlink3.mk,v
retrieving revision 1.160
diff -u -r1.160 bsd.buildlink3.mk
--- mk/buildlink3/bsd.buildlink3.mk	12 Nov 2004 04:57:31 -0000	1.160
+++ mk/buildlink3/bsd.buildlink3.mk	12 Nov 2004 18:06:19 -0000
@@ -183,15 +183,11 @@
 # We skip the dependency calculation for some phases since they never
 # use the dependency information.
 #
-_BLNK_PHASES_SKIP_DEPENDS=	fetch patch tools buildlink configure	\
-				build test
-_BLNK_PHASES_RECURSIVE_DEPENDS=	extract
-.if !empty(_BLNK_PHASES_SKIP_DEPENDS:M${PKG_PHASE})
-_BLNK_DEPENDS_LIST=	# empty
-.elif !empty(_BLNK_PHASES_RECURSIVE_DEPENDS:M${PKG_PHASE})
-_BLNK_DEPENDS_LIST=	${_BLNK_RECURSIVE_DEPENDS}
-.else
+#_BLNK_DEPENDS_LIST=	${_BLNK_RECURSIVE_DEPENDS} # XXXTV PR 24721
+.if !empty(PKG_PHASES:Mextract)
 _BLNK_DEPENDS_LIST=	${_BLNK_DEPENDS}
+.else
+_BLNK_DEPENDS_LIST=	# empty
 .endif

 # Add the proper dependency on each package pulled in by buildlink3.mk
@@ -236,7 +232,7 @@
 ###
 ### BEGIN: after "wrapper" phase
 ###
-.if !empty(PHASES_AFTER_WRAPPER:M${PKG_PHASE})
+.if !empty(PKG_PHASES:Mwrapper)

 # Generate default values for:
 #
Index: mk/wrapper/bsd.wrapper.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/wrapper/bsd.wrapper.mk,v
retrieving revision 1.11
diff -u -r1.11 bsd.wrapper.mk
--- mk/wrapper/bsd.wrapper.mk	12 Nov 2004 16:27:57 -0000	1.11
+++ mk/wrapper/bsd.wrapper.mk	12 Nov 2004 18:06:19 -0000
@@ -70,7 +70,7 @@
 ###
 ### BEGIN: after "wrapper" phase
 ###
-.if !empty(PHASES_AFTER_WRAPPER:M${PKG_PHASE})
+.if !empty(PKG_PHASES:Mwrapper)

 WRAPPER_DEBUG?=		yes
 CONFIGURE_ENV+=		WRAPPER_DEBUG="${WRAPPER_DEBUG}"
@@ -610,7 +610,7 @@
 SUBST_POSTCMD.unwrap=	${DO_NADA}
 .endif

-.endif	# PHASES_AFTER_WRAPPER
+.endif	# !empty(PKG_PHASES:Mwrapper)
 ###
 ### END: after "wrapper" phase
 ###

-- 
-- Todd Vierling <tv@duh.org> <tv@pobox.com>