pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk/tools Allow packages to set a post-tools target aga...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/2159f952d537
branches:  trunk
changeset: 514703:2159f952d537
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Fri Jun 16 19:15:19 2006 +0000

description:
Allow packages to set a post-tools target again (which fixes recent
lossage when building security/openpam).  Utilize a tools cookie file
to ensure that the post-tools target is only ever run once to avoid
tricky coding requirements for the post-tools target.  Also document
some more of the targets.

diffstat:

 mk/tools/bsd.tools.mk |  49 ++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 46 insertions(+), 3 deletions(-)

diffs (92 lines):

diff -r 0863de06cf93 -r 2159f952d537 mk/tools/bsd.tools.mk
--- a/mk/tools/bsd.tools.mk     Fri Jun 16 18:43:18 2006 +0000
+++ b/mk/tools/bsd.tools.mk     Fri Jun 16 19:15:19 2006 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.tools.mk,v 1.36 2006/06/09 13:59:08 jlam Exp $
+# $NetBSD: bsd.tools.mk,v 1.37 2006/06/16 19:15:19 jlam Exp $
 #
 # Copyright (c) 2005, 2006 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -54,6 +54,8 @@
 
 USE_TOOLS?=            # empty
 
+_TOOLS_COOKIE= ${WRKDIR}/.tools_done
+
 ######################################################################
 ### tools (PUBLIC)
 ######################################################################
@@ -61,7 +63,7 @@
 ### specified by USE_TOOLS.
 ###
 _TOOLS_TARGETS+=       acquire-tools-lock
-_TOOLS_TARGETS+=       real-tools
+_TOOLS_TARGETS+=       ${_TOOLS_COOKIE}
 _TOOLS_TARGETS+=       release-tools-lock
 
 .PHONY: tools
@@ -73,6 +75,13 @@
 acquire-tools-lock: acquire-lock
 release-tools-lock: release-lock
 
+.if !exists(${_TOOLS_COOKIE})
+${_TOOLS_COOKIE}: real-tools
+.else
+${_TOOLS_COOKIE}:
+       @${DO_NADA}
+.endif
+
 ######################################################################
 ### real-tools (PRIVATE)
 ######################################################################
@@ -82,6 +91,8 @@
 _REAL_TOOLS_TARGETS+=  tools-message
 _REAL_TOOLS_TARGETS+=  tools-vars
 _REAL_TOOLS_TARGETS+=  override-tools
+_REAL_TOOLS_TARGETS+=  post-tools
+_REAL_TOOLS_TARGETS+=  tools-cookie
 _REAL_TOOLS_TARGETS+=  error-check
 
 .PHONY: real-tools
@@ -91,8 +102,40 @@
 tools-message:
        @${PHASE_MSG} "Overriding tools for ${PKGNAME}"
 
+######################################################################
+### tools-cookie (PRIVATE)
+######################################################################
+### tools-cookie creates the "tools" cookie file.  The contents
+### are the names of the tools in USE_TOOLS.
+###
+.PHONY: tools-cookie
+tools-cookie:
+       ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${_TOOLS_COOKIE:H}
+       ${_PKG_SILENT}${_PKG_DEBUG}${ECHO} ${USE_TOOLS:Q} >> ${_TOOLS_COOKIE}
+
+######################################################################
+### override-tools (PRIVATE)
+######################################################################
+### override-tools is a helper target onto which one can hook all of
+### the targets that create tools so they are generated at the proper
+### time.
+###
 .PHONY: override-tools
-override-tools: .OPTIONAL
+override-tools:
+       @${DO_NADA}
+
+######################################################################
+### post-tools (PUBLIC, override)
+######################################################################
+### post-tools may be overridden within a package Makefile and can be
+### used to directly modify the contents of the tools directory after
+### the tools are generated.
+###
+.PHONY: post-tools
+.if !target(post-tools)
+post-tools:
+       @${DO_NADA}
+.endif
 
 .include "${PKGSRCDIR}/mk/tools/automake.mk"
 .include "${PKGSRCDIR}/mk/tools/autoconf.mk"



Home | Main Index | Thread Index | Old Index