summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2006-07-05 22:21:02 +0000
committerjlam <jlam@pkgsrc.org>2006-07-05 22:21:02 +0000
commitb8d23232b8a809ac454e7b3cd51ecea739bfea3f (patch)
treea30da33e80fce02ecc002e9c7ee00e2f7d9cda05
parentf1e543002136be39ecf208cb90ccf6c25f65b2b0 (diff)
downloadpkgsrc-b8d23232b8a809ac454e7b3cd51ecea739bfea3f.tar.gz
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".
-rw-r--r--mk/bsd.pkg.barrier.mk59
-rw-r--r--mk/bsd.pkg.mk5
-rw-r--r--mk/build/bsd.build.mk13
-rw-r--r--mk/build/build.mk28
-rw-r--r--mk/buildlink3/bsd.buildlink3.mk27
-rw-r--r--mk/configure/bsd.configure.mk15
-rw-r--r--mk/configure/configure.mk34
-rw-r--r--mk/depends/bsd.depends.mk16
-rw-r--r--mk/depends/depends.mk13
-rw-r--r--mk/extract/extract.mk13
-rw-r--r--mk/install/bsd.install.mk13
-rw-r--r--mk/install/install.mk25
-rw-r--r--mk/install/replace.mk6
-rw-r--r--mk/package/bsd.package.mk13
-rw-r--r--mk/package/package.mk22
-rw-r--r--mk/patch/patch.mk13
-rw-r--r--mk/pkginstall/bsd.pkginstall.mk12
-rw-r--r--mk/tools/bsd.tools.mk13
-rw-r--r--mk/wrapper/bsd.wrapper.mk28
19 files changed, 221 insertions, 147 deletions
diff --git a/mk/bsd.pkg.barrier.mk b/mk/bsd.pkg.barrier.mk
new file mode 100644
index 00000000000..7579b2df56e
--- /dev/null
+++ b/mk/bsd.pkg.barrier.mk
@@ -0,0 +1,59 @@
+# $NetBSD: bsd.pkg.barrier.mk,v 1.1 2006/07/05 22:21:02 jlam Exp $
+
+_BARRIER_COOKIE= ${WRKDIR}/.barrier_cookie
+
+# _BARRIER_POST_TARGETS is a list of the targets that must be built after
+# the "barrier" target invokes a new make.
+#
+_BARRIER_PRE_TARGETS= patch
+_BARRIER_POST_TARGETS= wrapper configure build install package
+
+# These targets have the "main" targets as sources, and so they must also
+# be barrier-aware.
+#
+_BARRIER_POST_TARGETS+= test
+_BARRIER_POST_TARGETS+= reinstall repackage
+_BARRIER_POST_TARGETS+= replace
+
+######################################################################
+### barrier (PRIVATE)
+######################################################################
+### barrier is a helper target that can be used to separate targets
+### that should be built in a new make process from being built in
+### the current one. The targets that must be built after the "barrier"
+### target invokes a new make should be listed in _BARRIER_POST_TARGETS,
+### and should be of the form:
+###
+### .if !exists(${_BARRIER_COOKIE})
+### foo: barrier
+### .else
+### foo: foo's real source dependencies
+### .endif
+###
+### Note that none of foo's real source dependencies should include
+### targets that occur before the barrier.
+###
+.PHONY: barrier
+barrier: ${_BARRIER_PRE_TARGETS} barrier-cookie
+.if !exists(${_BARRIER_COOKIE})
+. for _target_ in ${_BARRIER_POST_TARGETS}
+. if make(${_target_})
+. if defined(PKG_VERBOSE)
+ @${PHASE_MSG} "Invoking \`\`"${_target_:Q}"'' after barrier for ${PKGNAME}"
+. endif
+ ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${SETENV} ${BUILD_ENV} ${MAKE} ${MAKEFLAGS} ALLOW_VULNERABLE_PACKAGES= ${_target_}
+. if defined(PKG_VERBOSE)
+ @${PHASE_MSG} "Leaving \`\`"${_target_:Q}"'' after barrier for ${PKGNAME}"
+. endif
+. endif
+. endfor
+.endif
+
+######################################################################
+### barrier-cookie (PRIVATE)
+######################################################################
+### barrier-cookie creates the "barrier" cookie file.
+###
+barrier-cookie:
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${_BARRIER_COOKIE:H}
+ ${_PKG_SILENT}${_PKG_DEBUG}${ECHO} ${PKGNAME} > ${_BARRIER_COOKIE}
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk
index 279e60a35f0..493297c8635 100644
--- a/mk/bsd.pkg.mk
+++ b/mk/bsd.pkg.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.mk,v 1.1858 2006/07/05 06:09:15 jlam Exp $
+# $NetBSD: bsd.pkg.mk,v 1.1859 2006/07/05 22:21:02 jlam Exp $
#
# This file is in the public domain.
#
@@ -463,6 +463,9 @@ USE_TOOLS+= shlock sleep
# Tools
.include "../../mk/tools/bsd.tools.mk"
+# Barrier
+.include "../../mk/bsd.pkg.barrier.mk"
+
# Unprivileged builds
.include "../../mk/unprivileged.mk"
diff --git a/mk/build/bsd.build.mk b/mk/build/bsd.build.mk
index 7e17ab1d40a..3deceae0dc8 100644
--- a/mk/build/bsd.build.mk
+++ b/mk/build/bsd.build.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.build.mk,v 1.2 2006/07/05 09:08:35 jlam Exp $
+# $NetBSD: bsd.build.mk,v 1.3 2006/07/05 22:21:02 jlam Exp $
#
# This Makefile fragment is included by bsd.pkg.mk and provides all
# variables and targets related to building sources for a package.
@@ -22,12 +22,15 @@ _TEST_COOKIE= ${WRKDIR}/.test_done
### build is a public target to build the sources for the package.
###
.PHONY: build
-.if defined(NO_BUILD)
-. if !target(build)
+.if !defined(NO_BUILD)
+. include "${PKGSRCDIR}/mk/build/build.mk"
+.elif !target(build)
+. if exists(${_BUILD_COOKIE})
+build:
+ @${DO_NADA}
+. else
build: configure build-cookie
. endif
-.else
-. include "${PKGSRCDIR}/mk/build/build.mk"
.endif
.include "${PKGSRCDIR}/mk/build/test.mk"
diff --git a/mk/build/build.mk b/mk/build/build.mk
index aa559124a89..a9747acb12b 100644
--- a/mk/build/build.mk
+++ b/mk/build/build.mk
@@ -1,4 +1,4 @@
-# $NetBSD: build.mk,v 1.2 2006/07/05 09:08:35 jlam Exp $
+# $NetBSD: build.mk,v 1.3 2006/07/05 22:21:02 jlam Exp $
#
# BUILD_MAKE_FLAGS is the list of arguments that is passed to the make
# process.
@@ -23,11 +23,13 @@ _BUILD_TARGETS+= pkginstall
.PHONY: build
.if !target(build)
-. if !exists(${_BUILD_COOKIE})
-build: ${_BUILD_TARGETS}
-. else
+. if exists(${_BUILD_COOKIE})
build:
@${DO_NADA}
+. elif exists(${_BARRIER_COOKIE})
+build: ${_BUILD_TARGETS}
+. else
+build: barrier
. endif
.endif
@@ -35,21 +37,11 @@ build:
acquire-build-lock: acquire-lock
release-build-lock: release-lock
+.if exists(${_BUILD_COOKIE})
${_BUILD_COOKIE}:
- ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${SETENV} ${BUILD_ENV} ${MAKE} ${MAKEFLAGS} real-build PKG_PHASE=build || ${PKG_ERROR_HANDLER.build}
-
-PKG_ERROR_CLASSES+= build
-PKG_ERROR_MSG.build= \
- "" \
- "There was an error during the \`\`build'' phase." \
- "Please investigate the following for more information:" \
- " * log of the build" \
- " * ${WRKLOG}" \
- ""
-.if defined(BROKEN_IN)
-PKG_ERROR_MSG.build+= \
- " * This package is broken in ${BROKEN_IN}." \
- " * It may be removed in the next branch unless fixed."
+ @${DO_NADA}
+.else
+${_BUILD_COOKIE}: real-build
.endif
######################################################################
diff --git a/mk/buildlink3/bsd.buildlink3.mk b/mk/buildlink3/bsd.buildlink3.mk
index fdf2c7e6e4c..ab2549e2a03 100644
--- a/mk/buildlink3/bsd.buildlink3.mk
+++ b/mk/buildlink3/bsd.buildlink3.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.buildlink3.mk,v 1.179 2006/06/09 06:02:33 rillig Exp $
+# $NetBSD: bsd.buildlink3.mk,v 1.180 2006/07/05 22:21:02 jlam Exp $
#
# Copyright (c) 2004 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -163,19 +163,6 @@ _BLNK_DEPENDS+= ${_pkg_}
BUILDLINK_DEPMETHOD.${_pkg_}?= full
.endfor
-# We skip the dependency calculation for some phases since they never
-# use the dependency information.
-#
-_BLNK_PHASES_SKIP_DEPENDS= configure build test
-_BLNK_PHASES_RECURSIVE_DEPENDS= none
-.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_DEPENDS}
-.endif
-
# Add the proper dependency on each package pulled in by buildlink3.mk
# files. BUILDLINK_DEPMETHOD.<pkg> contains a list of either "full" or
# "build", and if any of that list is "full" then we use a full dependency
@@ -185,7 +172,7 @@ _BLNK_ADD_TO.DEPENDS= # empty
_BLNK_ADD_TO.BUILD_DEPENDS= # empty
_BLNK_ADD_TO.ABI_DEPENDS= # empty
_BLNK_ADD_TO.BUILD_ABI_DEPENDS= # empty
-.for _pkg_ in ${_BLNK_DEPENDS_LIST}
+.for _pkg_ in ${_BLNK_DEPENDS}
. if !empty(BUILDLINK_DEPMETHOD.${_pkg_}:Mfull)
_BLNK_DEPMETHOD.${_pkg_}= _BLNK_ADD_TO.DEPENDS
_BLNK_ABIMETHOD.${_pkg_}= _BLNK_ADD_TO.ABI_DEPENDS
@@ -214,12 +201,12 @@ ${_BLNK_ABIMETHOD.${_pkg_}}+= ${_abi_}:${BUILDLINK_PKGSRCDIR.${_pkg_}}
. if !empty(_BLNK_ADD_TO.${_depmethod_})
${_depmethod_}+= ${_BLNK_ADD_TO.${_depmethod_}}
. endif
-.endfor # _BLNK_DEPENDS_LIST
+.endfor # _BLNK_DEPENDS
###
-### BEGIN: after "wrapper" phase
+### BEGIN: after the barrier
###
-.if !empty(PHASES_AFTER_WRAPPER:M${PKG_PHASE})
+.if exists(${_BARRIER_COOKIE})
# Generate default values for:
#
@@ -1081,7 +1068,7 @@ do-buildlink:
@${DO_NADA}
.endif
-.endif # PHASES_AFTER_WRAPPER
+.endif
###
-### END: after "wrapper" phase
+### END: after the barrier
###
diff --git a/mk/configure/bsd.configure.mk b/mk/configure/bsd.configure.mk
index 901954186fe..a29370c8190 100644
--- a/mk/configure/bsd.configure.mk
+++ b/mk/configure/bsd.configure.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.configure.mk,v 1.2 2006/07/05 09:08:35 jlam Exp $
+# $NetBSD: bsd.configure.mk,v 1.3 2006/07/05 22:21:02 jlam Exp $
#
# This Makefile fragment is included by bsd.pkg.mk and provides all
# variables and targets related to configuring packages for building.
@@ -20,12 +20,15 @@ _CONFIGURE_COOKIE= ${WRKDIR}/.configure_done
### configure is a public target to configure the software for building.
###
.PHONY: configure
-.if defined(NO_CONFIGURE)
-. if !target(configure)
-configure: patch configure-cookie
-. endif
-.else
+.if !defined(NO_CONFIGURE)
. include "${PKGSRCDIR}/mk/configure/configure.mk"
+.elif !target(configure)
+. if exists(${_CONFIGURE_COOKIE})
+configure:
+ @${DO_NADA}
+. else
+configure: wrapper configure-cookie
+. endif
.endif
######################################################################
diff --git a/mk/configure/configure.mk b/mk/configure/configure.mk
index fcf990e9e12..c416d02d08e 100644
--- a/mk/configure/configure.mk
+++ b/mk/configure/configure.mk
@@ -1,4 +1,4 @@
-# $NetBSD: configure.mk,v 1.2 2006/07/05 09:08:35 jlam Exp $
+# $NetBSD: configure.mk,v 1.3 2006/07/05 22:21:02 jlam Exp $
#
# CONFIGURE_SCRIPT is the path to the script to run in order to
# configure the software for building. If the path is relative,
@@ -48,11 +48,13 @@ _CONFIGURE_TARGETS+= release-configure-lock
.PHONY: configure
.if !target(configure)
-. if !exists(${_CONFIGURE_COOKIE})
-configure: ${_CONFIGURE_TARGETS}
-. else
+. if exists(${_CONFIGURE_COOKIE})
configure:
@${DO_NADA}
+. elif exists(${_BARRIER_COOKIE})
+configure: ${_CONFIGURE_TARGETS}
+. else
+configure: barrier
. endif
.endif
@@ -60,29 +62,11 @@ configure:
acquire-configure-lock: acquire-lock
release-configure-lock: release-lock
+.if exists(${_CONFIGURE_COOKIE})
${_CONFIGURE_COOKIE}:
- ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${SETENV} ${BUILD_ENV} ${MAKE} ${MAKEFLAGS} real-configure PKG_PHASE=configure || ${PKG_ERROR_HANDLER.configure}
-
-PKG_ERROR_CLASSES+= configure
-PKG_ERROR_MSG.configure= \
- "" \
- "There was an error during the \`\`configure'' phase." \
- "Please investigate the following for more information:"
-.if defined(GNU_CONFIGURE)
-PKG_ERROR_MSG.configure+= \
- " * config.log" \
- " * ${WRKLOG}" \
- ""
+ @${DO_NADA}
.else
-PKG_ERROR_MSG.configure+= \
- " * log of the build" \
- " * ${WRKLOG}" \
- ""
-.endif
-.if defined(BROKEN_IN)
-PKG_ERROR_MSG.configure+= \
- " * This package is broken in ${BROKEN_IN}." \
- " * It may be removed in the next branch unless fixed."
+${_CONFIGURE_COOKIE}: real-configure
.endif
######################################################################
diff --git a/mk/depends/bsd.depends.mk b/mk/depends/bsd.depends.mk
index 1b432a17ae2..8c5bed66c44 100644
--- a/mk/depends/bsd.depends.mk
+++ b/mk/depends/bsd.depends.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.depends.mk,v 1.5 2006/06/12 01:20:37 jlam Exp $
+# $NetBSD: bsd.depends.mk,v 1.6 2006/07/05 22:21:02 jlam Exp $
#
# This Makefile fragment is included by bsd.pkg.mk and provides all
# variables and targets related to dependencies.
@@ -34,12 +34,15 @@ DEPENDS_TARGET= reinstall
### the package.
###
.PHONY: depends
-.if defined(NO_DEPENDS)
-. if !target(depends)
+.if !defined(NO_DEPENDS)
+. include "${PKGSRCDIR}/mk/depends/depends.mk"
+.elif !target(depends)
+. if exists(${_DEPENDS_COOKIE})
+depends:
+ @${DO_NADA}
+. else
depends: depends-cookie
. endif
-.else
-. include "${PKGSRCDIR}/mk/depends/depends.mk"
.endif
######################################################################
@@ -71,9 +74,10 @@ depends-clean:
### depends-cookie creates the depends "cookie" state file. This should
### be overridden per package system flavor.
###
-.if !target(depends-cookie)
.PHONY: depends-cookie
+.if !target(depends-cookie)
depends-cookie:
${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${_DEPENDS_COOKIE:H}
${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_ARGS} ${_DEPENDS_COOKIE}
.endif
+
diff --git a/mk/depends/depends.mk b/mk/depends/depends.mk
index 69c84940264..354b7c49c5c 100644
--- a/mk/depends/depends.mk
+++ b/mk/depends/depends.mk
@@ -1,4 +1,4 @@
-# $NetBSD: depends.mk,v 1.8 2006/07/05 09:08:35 jlam Exp $
+# $NetBSD: depends.mk,v 1.9 2006/07/05 22:21:02 jlam Exp $
######################################################################
### depends (PUBLIC)
@@ -12,11 +12,11 @@ _DEPENDS_TARGETS+= release-depends-lock
.PHONY: depends
.if !target(depends)
-. if !exists(${_DEPENDS_COOKIE})
-depends: ${_DEPENDS_TARGETS}
-. else
+. if exists(${_DEPENDS_COOKIE})
depends:
@${DO_NADA}
+. else
+depends: ${_DEPENDS_TARGETS}
. endif
.endif
@@ -24,7 +24,12 @@ depends:
acquire-depends-lock: acquire-lock
release-depends-lock: release-lock
+.if exists(${_DEPENDS_COOKIE})
+${_DEPENDS_COOKIE}:
+ @${DO_NADA}
+.else
${_DEPENDS_COOKIE}: real-depends
+.endif
######################################################################
### real-depends (PRIVATE)
diff --git a/mk/extract/extract.mk b/mk/extract/extract.mk
index 257d21e2807..8ef2a36cad4 100644
--- a/mk/extract/extract.mk
+++ b/mk/extract/extract.mk
@@ -1,4 +1,4 @@
-# $NetBSD: extract.mk,v 1.8 2006/07/05 09:08:35 jlam Exp $
+# $NetBSD: extract.mk,v 1.9 2006/07/05 22:21:02 jlam Exp $
#
# The following variables may be set by the package Makefile and
# specify how extraction happens:
@@ -53,11 +53,11 @@ _EXTRACT_TARGETS+= release-extract-lock
.PHONY: extract
.if !target(extract)
-. if !exists(${_EXTRACT_COOKIE})
-extract: ${_EXTRACT_TARGETS}
-. else
+. if exists(${_EXTRACT_COOKIE})
extract:
@${DO_NADA}
+. else
+extract: ${_EXTRACT_TARGETS}
. endif
.endif
@@ -65,7 +65,12 @@ extract:
acquire-extract-lock: acquire-lock
release-extract-lock: release-lock
+.if exists(${_EXTRACT_COOKIE})
+${_EXTRACT_COOKIE}:
+ @${DO_NADA}
+.else
${_EXTRACT_COOKIE}: real-extract
+.endif
######################################################################
### real-extract (PRIVATE)
diff --git a/mk/install/bsd.install.mk b/mk/install/bsd.install.mk
index 09a68bedb96..2f8383259d6 100644
--- a/mk/install/bsd.install.mk
+++ b/mk/install/bsd.install.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.install.mk,v 1.4 2006/07/05 09:08:35 jlam Exp $
+# $NetBSD: bsd.install.mk,v 1.5 2006/07/05 22:21:02 jlam Exp $
#
# This Makefile fragment is included by bsd.pkg.mk and provides all
# variables and targets related to installing packages.
@@ -19,13 +19,16 @@ _INSTALL_COOKIE= ${WRKDIR}/.install_done
######################################################################
### install is a public target to install the package.
###
-.if defined(NO_INSTALL)
.PHONY: install
-. if !target(install)
+.if !defined(NO_INSTALL)
+. include "${PKGSRCDIR}/mk/install/install.mk"
+.elif !target(install)
+. if exists(${_INSTALL_COOKIE})
+install:
+ @${DO_NADA}
+. else
install: ${_PKGSRC_BUILD_TARGETS} install-cookie
. endif
-.else
-. include "${PKGSRCDIR}/mk/install/install.mk"
.endif
.include "${PKGSRCDIR}/mk/install/deinstall.mk"
diff --git a/mk/install/install.mk b/mk/install/install.mk
index 43f2350a034..bc952a1d7b2 100644
--- a/mk/install/install.mk
+++ b/mk/install/install.mk
@@ -1,4 +1,4 @@
-# $NetBSD: install.mk,v 1.9 2006/07/05 09:08:35 jlam Exp $
+# $NetBSD: install.mk,v 1.10 2006/07/05 22:21:02 jlam Exp $
######################################################################
### install (PUBLIC)
@@ -14,11 +14,13 @@ _INSTALL_TARGETS+= release-install-lock
.PHONY: install
.if !target(install)
-. if !exists(${_INSTALL_COOKIE})
-install: ${_INSTALL_TARGETS}
-. else
+. if exists(${_INSTALL_COOKIE})
install:
@${DO_NADA}
+. elif exists(${_BARRIER_COOKIE})
+install: ${_INSTALL_TARGETS}
+. else
+install: barrier
. endif
.endif
@@ -26,23 +28,26 @@ install:
acquire-install-lock: acquire-lock
release-install-lock: release-lock
-${_INSTALL_COOKIE}: install-check-interactive
- ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${SETENV} ${BUILD_ENV} ${MAKE} ${MAKEFLAGS} real-install PKG_PHASE=install
+.if exists(${_INSTALL_COOKIE})
+${_INSTALL_COOKIE}:
+ @${DO_NADA}
+.else
+${_INSTALL_COOKIE}: real-install
+.endif
######################################################################
### real-install (PRIVATE)
######################################################################
-### real-install is a helper target to set the PKG_PHASE explicitly to
-### "install" before running the remainder of the install targets.
+### real-install is a helper target onto which one can hook all of the
+### targets that do the actual installing of the built objects.
###
-.if !exists(${_INSTALL_COOKIE})
+_REAL_INSTALL_TARGETS+= install-check-interactive
_REAL_INSTALL_TARGETS+= install-check-version
_REAL_INSTALL_TARGETS+= install-message
_REAL_INSTALL_TARGETS+= install-vars
_REAL_INSTALL_TARGETS+= unprivileged-install-hook
_REAL_INSTALL_TARGETS+= install-all
_REAL_INSTALL_TARGETS+= install-cookie
-.endif
.PHONY: real-install
real-install: ${_REAL_INSTALL_TARGETS}
diff --git a/mk/install/replace.mk b/mk/install/replace.mk
index 7eb41ac3eee..a529bff3456 100644
--- a/mk/install/replace.mk
+++ b/mk/install/replace.mk
@@ -1,4 +1,4 @@
-# $NetBSD: replace.mk,v 1.4 2006/06/05 22:49:44 jlam Exp $
+# $NetBSD: replace.mk,v 1.5 2006/07/05 22:21:02 jlam Exp $
######################################################################
### replace (PUBLIC)
@@ -12,7 +12,11 @@ _REPLACE_TARGETS+= unprivileged-install-hook
.PHONY: replace su-replace
.if !target(replace)
+. if exists(${_BARRIER_COOKIE})
replace: ${_REPLACE_TARGETS} su-target
+. else
+replace: barrier
+. endif
.endif
replace-message:
diff --git a/mk/package/bsd.package.mk b/mk/package/bsd.package.mk
index 53a40221ec0..047a71ead55 100644
--- a/mk/package/bsd.package.mk
+++ b/mk/package/bsd.package.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.package.mk,v 1.3 2006/06/05 22:49:44 jlam Exp $
+# $NetBSD: bsd.package.mk,v 1.4 2006/07/05 22:21:03 jlam Exp $
#
# This Makefile fragment is included by bsd.pkg.mk and provides all
# variables and targets related to binary packages.
@@ -15,9 +15,14 @@ _PACKAGE_COOKIE= ${WRKDIR}/.package_done
######################################################################
### package is a public target to generate a binary package.
###
-.if defined(NO_PACKAGE)
.PHONY: package
-. if !target(package)
+.if !defined(NO_PACKAGE)
+. include "${PKGSRCDIR}/mk/package/package.mk"
+.elif !target(package)
+. if exists(${_PACKAGE_COOKIE})
+package:
+ @${DO_NADA}
+. else
package: install
. if defined(SKIP_SILENT)
@${DO_NADA}
@@ -25,8 +30,6 @@ package: install
@${PHASE_MSG} "${PKGNAME} may not be packaged: "${NO_PACKAGE:Q}"."
. endif
. endif
-.else
-. include "${PKGSRCDIR}/mk/package/package.mk"
.endif
######################################################################
diff --git a/mk/package/package.mk b/mk/package/package.mk
index 9092236e188..204fc7b1599 100644
--- a/mk/package/package.mk
+++ b/mk/package/package.mk
@@ -1,4 +1,4 @@
-# $NetBSD: package.mk,v 1.10 2006/07/05 09:08:35 jlam Exp $
+# $NetBSD: package.mk,v 1.11 2006/07/05 22:21:03 jlam Exp $
######################################################################
### package (PUBLIC)
@@ -14,11 +14,13 @@ _PACKAGE_TARGETS+= release-package-lock
.PHONY: package
.if !target(package)
-. if !exists(${_PACKAGE_COOKIE})
-package: ${_PACKAGE_TARGETS}
-. else
+. if exists(${_PACKAGE_COOKIE})
package:
@${DO_NADA}
+. elif exists(${_BARRIER_COOKIE})
+package: ${_PACKAGE_TARGETS}
+. else
+package: barrier
. endif
.endif
@@ -26,20 +28,22 @@ package:
acquire-package-lock: acquire-lock
release-package-lock: release-lock
+.if exists(${_PACKAGE_COOKIE})
${_PACKAGE_COOKIE}:
- ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${SETENV} ${BUILD_ENV} ${MAKE} ${MAKEFLAGS} real-package PKG_PHASE=package
+ @${DO_NADA}
+.else
+${_PACKAGE_COOKIE}: real-package
+.endif
######################################################################
### real-package (PRIVATE)
######################################################################
-### real-package is a helper target to set the PKG_PHASE explicitly to
-### "package" before running the remainder of the package targets.
+### real-package is a helper target onto which one can hook all of the
+### targets that do the actual packaging of the built objects.
###
-.if !exists(${_PACKAGE_COOKIE})
_REAL_PACKAGE_TARGETS+= package-message
_REAL_PACKAGE_TARGETS+= package-all
_REAL_PACKAGE_TARGETS+= package-cookie
-.endif
.PHONY: real-package
real-package: ${_REAL_PACKAGE_TARGETS}
diff --git a/mk/patch/patch.mk b/mk/patch/patch.mk
index c47dbfc4306..5d88487346a 100644
--- a/mk/patch/patch.mk
+++ b/mk/patch/patch.mk
@@ -1,4 +1,4 @@
-# $NetBSD: patch.mk,v 1.5 2006/07/05 09:08:35 jlam Exp $
+# $NetBSD: patch.mk,v 1.6 2006/07/05 22:21:03 jlam Exp $
#
# The following variables may be set in a package Makefile and control
# how pkgsrc patches are applied.
@@ -60,11 +60,11 @@ _PATCH_TARGETS+= release-patch-lock
.PHONY: patch
.if !target(patch)
-. if !exists(${_PATCH_COOKIE})
-patch: ${_PATCH_TARGETS}
-. else
+. if exists(${_PATCH_COOKIE})
patch:
@${DO_NADA}
+. else
+patch: ${_PATCH_TARGETS}
. endif
.endif
@@ -72,7 +72,12 @@ patch:
acquire-patch-lock: acquire-lock
release-patch-lock: release-lock
+.if exists(${_PATCH_COOKIE})
+${_PATCH_COOKIE}:
+ @${DO_NADA}
+.else
${_PATCH_COOKIE}: real-patch
+.endif
######################################################################
### real-patch (PRIVATE)
diff --git a/mk/pkginstall/bsd.pkginstall.mk b/mk/pkginstall/bsd.pkginstall.mk
index 41aea55a31a..daefaf4f74c 100644
--- a/mk/pkginstall/bsd.pkginstall.mk
+++ b/mk/pkginstall/bsd.pkginstall.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkginstall.mk,v 1.12 2006/07/05 06:09:15 jlam Exp $
+# $NetBSD: bsd.pkginstall.mk,v 1.13 2006/07/05 22:21:03 jlam Exp $
#
# This Makefile fragment is included by bsd.pkg.mk and implements the
# common INSTALL/DEINSTALL scripts framework. To use the pkginstall
@@ -964,14 +964,10 @@ install-rcd-${_script_}: ${RCD_SCRIPT_WRK.${_script_}}
. endif
.endfor
-_PKGINSTALL_COOKIE= ${WRKDIR}/.pkginstall_done
-
_PKGINSTALL_TARGETS+= acquire-pkginstall-lock
-_PKGINSTALL_TARGETS+= ${_PKGINSTALL_COOKIE}
+_PKGINSTALL_TARGETS+= real-pkginstall
_PKGINSTALL_TARGETS+= release-pkginstall-lock
-.ORDER: ${_PKGINSTALL_TARGETS}
-
.PHONY: pkginstall install-script-data
pkginstall: ${_PKGINSTALL_TARGETS}
@@ -981,7 +977,3 @@ release-pkginstall-lock: release-lock
.PHONY: real-pkginstall
real-pkginstall: generate-rcd-scripts generate-install-scripts
- ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_FLAGS} ${_PKGINSTALL_COOKIE}
-
-${_PKGINSTALL_COOKIE}:
- ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-pkginstall PKG_PHASE=build
diff --git a/mk/tools/bsd.tools.mk b/mk/tools/bsd.tools.mk
index 594d4194b9a..e0d72d958fe 100644
--- a/mk/tools/bsd.tools.mk
+++ b/mk/tools/bsd.tools.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.tools.mk,v 1.39 2006/07/05 09:08:35 jlam Exp $
+# $NetBSD: bsd.tools.mk,v 1.40 2006/07/05 22:21:03 jlam Exp $
#
# Copyright (c) 2005, 2006 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -68,11 +68,11 @@ _TOOLS_TARGETS+= release-tools-lock
.PHONY: tools
.if !target(tools)
-. if !exists(${_TOOLS_COOKIE})
-tools: ${_TOOLS_TARGETS}
-. else
+. if exists(${_TOOLS_COOKIE})
tools:
@${DO_NADA}
+. else
+tools: ${_TOOLS_TARGETS}
. endif
.endif
@@ -80,7 +80,12 @@ tools:
acquire-tools-lock: acquire-lock
release-tools-lock: release-lock
+.if exists(${_TOOLS_COOKIE})
+${_TOOLS_COOKIE}:
+ @${DO_NADA}
+.else
${_TOOLS_COOKIE}: real-tools
+.endif
######################################################################
### real-tools (PRIVATE)
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