summaryrefslogtreecommitdiff
path: root/mk/bsd.pkg.mk
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2006-01-18 20:18:04 +0000
committerjlam <jlam@pkgsrc.org>2006-01-18 20:18:04 +0000
commit19a4f23ea130a386a5886cf148440e216be8da91 (patch)
tree529521541e01c07455092fefcfe895b1ec71d01a /mk/bsd.pkg.mk
parentc7da3f771802854394869e45d668cd9ae4ae884c (diff)
downloadpkgsrc-19a4f23ea130a386a5886cf148440e216be8da91.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.mk84
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: