diff options
author | jlam <jlam> | 2006-01-18 20:18:04 +0000 |
---|---|---|
committer | jlam <jlam> | 2006-01-18 20:18:04 +0000 |
commit | 8e93c0027a06679de4cbbe94a7b3693e9bdd1177 (patch) | |
tree | 529521541e01c07455092fefcfe895b1ec71d01a /mk/bsd.pkg.mk | |
parent | e0f9486abb05836fef95ba925e75f9b39d50bef9 (diff) | |
download | pkgsrc-8e93c0027a06679de4cbbe94a7b3693e9bdd1177.tar.gz |
Move the following targets from bsd.pkg.mk to bsd.utils.mk:
show-depends-dirs
show-all-depends-dirs
show-all-depends-dirs-excl
While we're here, reimplement them using the new pkg_paths and
depends-depth-first.awk scripts. As a side effect, this speeds up
the execution of these targets by around 5-15% depending on the
complexity of the dependency graph.
NOTE: This *does* change the behavior of these targets slightly because
the output is now newline-separated instead of space-separated,
and the order of the output lines doesn't match the original
targets because the dependency graph is now walked depth-first
instead of breadth first.
Diffstat (limited to 'mk/bsd.pkg.mk')
-rw-r--r-- | mk/bsd.pkg.mk | 84 |
1 files changed, 1 insertions, 83 deletions
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk index a3cbd162fc1..1c75ca8c4ab 100644 --- a/mk/bsd.pkg.mk +++ b/mk/bsd.pkg.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.pkg.mk,v 1.1790 2006/01/18 19:12:54 jlam Exp $ +# $NetBSD: bsd.pkg.mk,v 1.1791 2006/01/18 20:18:04 jlam Exp $ # # This file is in the public domain. # @@ -1395,88 +1395,6 @@ do-fetch: . endif # !empty(_ALLFILES) .endif -# show both build and run depends directories (non-recursively) -.PHONY: show-depends-dirs -.if !target(show-depends-dirs) -_ALL_DEPENDS= ${DEPENDS} ${BUILD_DEPENDS} -show-depends-dirs: - @set -e; \ - dlist=""; \ - depends=${_ALL_DEPENDS:C/^[^:]*://:O:u:Q}; \ - for reldir in $$depends; do \ - case $$reldir in \ - ../../*/*) ;; \ - *) ${ECHO} "[show-depends-dirs] warning: invalid dependency \"$$reldir\". Check DEPENDS and BUILD_DEPENDS." 1>&2; \ - continue;; \ - esac; \ - WD=`cd "$$reldir" && ${PWD_CMD}`; \ - d=`dirname $$WD`; \ - absdir=`basename $$d`/`basename $$WD`; \ - dlist="$$dlist $$absdir"; \ - done; \ - ${ECHO} $$dlist -.endif - -# Show all build and run depends, reverse-breadth first, with options. -.if make(show-all-depends-dirs) || make(show-all-depends-dirs-excl) - -# "awk" macro to recurse over the dependencies efficiently, never running in -# the same same directory twice. You may set the following options via "-v": -# -# NonSelf = 1 to not print own directory; -# RootsOnly = 1 to print only root directories (i.e. directories -# of packages with no dependencies), including possibly -# own directory -# -_RECURSE_DEPENDS_DIRS= \ - function append_dirs(dir) { \ - command = "cd ../../" dir " && ${MAKE} show-depends-dirs"; \ - command | getline tmp_dirs; \ - close(command); \ - if (tmp_dirs ~ /^$$/) \ - root_dirs[p++] = dir; \ - for (i = 1; i <= split(tmp_dirs, tmp_r); i++) \ - if (!(tmp_r[i] in hash_all_dirs)) { \ - all_dirs[n++] = tmp_r[i]; \ - hash_all_dirs[tmp_r[i]] = 1 \ - } \ - } \ - BEGIN { \ - command = "${PWD_CMD}"; \ - command | getline start_dir; \ - close(command); \ - i = split(start_dir, tmp_r, /\//); \ - all_dirs[n++] = tmp_r[i-1] "/" tmp_r[i]; \ - for (; m < n; ) \ - append_dirs(all_dirs[m++]); \ - if (RootsOnly) { \ - printf("%s", root_dirs[--p]); \ - for (; p > 0; ) \ - printf(" %s", root_dirs[--p]) \ - } \ - else { \ - if (m > NonSelf) \ - printf("%s", all_dirs[--m]); \ - for (; m > NonSelf; ) \ - printf(" %s", all_dirs[--m]) \ - } \ - print \ - } - -.PHONY: show-all-depends-dirs -.if make(show-all-depends-dirs) -show-all-depends-dirs: - @${AWK} '${_RECURSE_DEPENDS_DIRS}' -.endif - -.PHONY: show-all-depends-dirs-excl -.if make(show-all-depends-dirs-excl) -show-all-depends-dirs-excl: - @${AWK} -v NonSelf=1 '${_RECURSE_DEPENDS_DIRS}' -.endif - -.endif # make(show-{all-depends-dirs{,-excl}}) - .PHONY: show-distfiles .if !target(show-distfiles) show-distfiles: |