summaryrefslogtreecommitdiff
path: root/mk/package
diff options
context:
space:
mode:
authorjlam <jlam>2006-07-05 22:21:02 +0000
committerjlam <jlam>2006-07-05 22:21:02 +0000
commit967acf13fd8a4f1317da73c4c459576fdeb5ac16 (patch)
treea30da33e80fce02ecc002e9c7ee00e2f7d9cda05 /mk/package
parent682d4fd414c3d48aa9ce0bf1ac70de0995f0f593 (diff)
downloadpkgsrc-967acf13fd8a4f1317da73c4c459576fdeb5ac16.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".
Diffstat (limited to 'mk/package')
-rw-r--r--mk/package/bsd.package.mk13
-rw-r--r--mk/package/package.mk22
2 files changed, 21 insertions, 14 deletions
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}