diff options
-rw-r--r-- | mk/bsd.pkg.help.mk | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/mk/bsd.pkg.help.mk b/mk/bsd.pkg.help.mk index bd186bf8d94..aff52f3045f 100644 --- a/mk/bsd.pkg.help.mk +++ b/mk/bsd.pkg.help.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.pkg.help.mk,v 1.1 2006/08/02 09:46:22 rillig Exp $ +# $NetBSD: bsd.pkg.help.mk,v 1.2 2006/08/02 10:29:47 rillig Exp $ # # This is the integrated pkgsrc online help system. To query for the @@ -13,30 +13,37 @@ _HELP_FILES= # empty _HELP_FILES+= mk/defaults/mk.conf _HELP_FILES+= mk/bsd.prefs.mk _HELP_FILES+= mk/bsd.pkg.mk -_HELP_FILES+= mk/*/*-vars.mk +_HELP_FILES+= mk/*/*.mk _HELP_AWK= \ BEGIN { \ + no = 0; yes = 1; \ hline = "==============="; \ hline = hline hline hline hline hline; \ - found = 0; \ - var = 0; comment = 0; n = 0; lines[n++] = hline; \ + found = no; var = no; comment = no; n = 0; \ + rcsid = ""; \ } \ /./ { \ lines[n++] = $$0; \ } \ - ($$1 == VARNAME"?=") || ($$1 == "\#"VARNAME"=") { \ + /^\\#.*\$$.*\$$$$/ { \ + rcsid = $$0; \ + } \ + ($$1 == VARNAME"?=") || ($$1 == "\#"VARNAME"=") \ + || ($$1 == "\#" && $$2 == VARNAME) { \ var = 1; \ } \ /^\#/ { \ comment = 1; \ } \ /^$$/ { \ - if (var == 1 && comment == 1) { \ - found = 1; \ + if (var && comment) { \ + found = yes; \ + print hline; \ + if (rcsid != "") { print rcsid; print "\#"; } \ for (i = 0; i < n; i++) { print lines[i]; } \ } \ - var = 0; comment = 0; n = 0; lines[n++] = hline; \ + var = no; comment = no; n = 0; \ } \ END { \ if (found) { \ @@ -50,13 +57,15 @@ _HELP_AWK= \ TOPIC= ${VARNAME} .endif +.PHONY: help help: .if !defined(TOPIC) @${ECHO} "usage: "${MAKE:Q}" help TOPIC=<VARNAME>" 1>&2 .else - @set -e; cd ${PKGSRCDIR}; \ + ${_PKG_SILENT}${_PKG_DEBUG} set -e; \ + cd ${PKGSRCDIR}; \ { for i in ${_HELP_FILES}; do ${CAT} "$$i"; ${ECHO} ""; done; } \ - | ${AWK} -v VARNAME=${TOPIC} '${_HELP_AWK:M*}' + | ${AWK} -v VARNAME=${TOPIC} '${_HELP_AWK}' .endif .endif |