pkgsrc/mk/help/help.mk
rillig 85b81d4996 mk/defaults/mk.conf is an important source for online help. It just
doesn't match the *.mk pattern, and that's why it had been excluded up
to now, accidentally.
2006-11-04 22:04:44 +00:00

38 lines
1.1 KiB
Makefile

# $NetBSD: help.mk,v 1.2 2006/11/04 22:04:44 rillig Exp $
#
# This is the integrated pkgsrc online help system. To query for the
# meaning of a variable, run "make help TOPIC=VARNAME". All variables from
# certain pkgsrc Makefile fragments that have inline comments are eligible
# for querying.
.if !defined(_PKGSRC_HELP_MK)
_PKGSRC_HELP_MK= # defined
_HELP_FILES= mk/*.mk mk/*/*.mk mk/defaults/mk.conf
.if defined(VARNAME)
TOPIC?= ${VARNAME}
.endif
.if defined(topic)
TOPIC?= ${topic}
.endif
.PHONY: help
help:
.if !defined(TOPIC)
@${PRINTF} "usage: %s help topic=<topic>\\n" ${MAKE:Q}
@${PRINTF} "\\n"
@${PRINTF} "\\t<topic> may be a variable name or a make target,\\n"
@${PRINTF} "\\tfor example CONFIGURE_DIRS or patch. For convenience,\\n"
@${PRINTF} "\\tyou don't need to use uppercase letters when typing\\n"
@${PRINTF} "\\tvariable names.\\n"
@${PRINTF} "\\n"
.else
${_PKG_SILENT}${_PKG_DEBUG} set -e; \
cd ${PKGSRCDIR}; \
{ for i in ${_HELP_FILES}; do ${CAT} "$$i"; ${ECHO} ""; done; } \
| env TOPIC=${TOPIC:Q} ${AWK} -f ${PKGSRCDIR}/mk/help/help.awk
.endif
.endif