summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2006-08-02 10:29:47 +0000
committerrillig <rillig@pkgsrc.org>2006-08-02 10:29:47 +0000
commitb0c3ffe91ba62c6a40287e00f8b6d42d4cc6799b (patch)
treef7166d5d336445dc5417708566ab0ae36e809b7e /mk
parent47bffed693916a67c9c0b2b6efdf6306b3cfd696 (diff)
downloadpkgsrc-b0c3ffe91ba62c6a40287e00f8b6d42d4cc6799b.tar.gz
A common documentation format is to have the variable name as the first
word after the leading "#" for the comment. This format is also recognized. The RCS Id of the current file is printed together with the help text, so that the user can see which file defines the variable. Removed the :M* operator for _HELP_AWK, since bmake has a bug when "" is passed to the :M* operator. I've sent a bug report for this.
Diffstat (limited to 'mk')
-rw-r--r--mk/bsd.pkg.help.mk29
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