diff options
author | jlam <jlam@pkgsrc.org> | 2006-01-18 00:10:07 +0000 |
---|---|---|
committer | jlam <jlam@pkgsrc.org> | 2006-01-18 00:10:07 +0000 |
commit | 5c5ac03ec12536d13869d4edf8c7c97b2796b9a1 (patch) | |
tree | f4fe93f3ca14bb30bc4e732fd5d5db1b7057e3bf /mk/bsd.utils.mk | |
parent | d188673373daf5e22cfec4bf77f47abac9a3a413 (diff) | |
download | pkgsrc-5c5ac03ec12536d13869d4edf8c7c97b2796b9a1.tar.gz |
Create a standalone awk script, depends-depth-first.awk, that encapsulates
the code that performs the dependency graph traversal (in depth-first
fashion). This script has a hook that allows executing a shell command
line upon visiting a dependency's package directory in either prefix
or postfix order, and may be used to simplify the code in bsd.pkg.mk
that iterates over dependencies.
This awk script requires the target "show-depends-pkgpaths", which is
defined in a new Makefile pkgsrc/mk/bsd.utils.mk. This file should
accumulate "utility" targets that current exist in bsd.pkg.mk, i.e.,
"helper" targets for various actions.
Diffstat (limited to 'mk/bsd.utils.mk')
-rw-r--r-- | mk/bsd.utils.mk | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/mk/bsd.utils.mk b/mk/bsd.utils.mk new file mode 100644 index 00000000000..694ed613f4b --- /dev/null +++ b/mk/bsd.utils.mk @@ -0,0 +1,34 @@ +# $NetBSD: bsd.utils.mk,v 1.1 2006/01/18 00:10:07 jlam Exp $ +# +# This Makefile fragment is included by bsd.pkg.mk and defines utility +# and otherwise miscellaneous variables and targets. +# + +# DEPENDS_TYPE is used by the "show-depends-pkgpaths" target and specifies +# which class of dependencies to output. The special value "all" means +# to output every dependency. +# +DEPENDS_TYPE?= all +.if !empty(DEPENDS_TYPE:Mbuild) || !empty(DEPENDS_TYPE:Mall) +_ALL_DEPENDS_PKGPATHS+= \ + ${BUILD_DEPENDS:C/^[^:]*://:S/^..\/..\///:S/${PKGSRCDIR}\///} +.endif +.if !empty(DEPENDS_TYPE:Minstall) || !empty(DEPENDS_TYPE:Mpackage) || \ + !empty(DEPENDS_TYPE:Mall) +_ALL_DEPENDS_PKGPATHS+= \ + ${DEPENDS:C/^[^:]*://:S/^..\/..\///:S/${PKGSRCDIR}\///} +.endif + +.PHONY: show-depends-pkgpaths +show-depends-pkgpaths: +.for _deppath_ in ${_ALL_DEPENDS_PKGPATHS:O:u} + @${ECHO} ${_deppath_} +.endfor + +# _DEPENDS_DEPTH_FIRST_CMD holds the command (sans arguments) to traverse +# the dependency graph for a package. +# +_DEPENDS_DEPTH_FIRST_CMD= \ + ${SETENV} ECHO=${TOOLS_ECHO:Q} MAKE=${MAKE:Q} \ + PKGSRCDIR=${PKGSRCDIR:Q} TEST=${TOOLS_TEST:Q} \ + ${AWK} -f ${.CURDIR}/../../mk/scripts/depends-depth-first.awk -- |