summaryrefslogtreecommitdiff
path: root/mk/help/help.mk
blob: b839293001ed548538da814ee69def1bdcd7e2df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# $NetBSD: help.mk,v 1.17 2019/09/09 09:38:36 maya 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.

_HELP_FILES=		Makefile
_HELP_FILES+=		mk/*.mk mk/*/*.mk mk/*/*/*.mk
_HELP_FILES+=		mk/defaults/mk.conf
_HELP_FILES+=		lang/go/*.mk
_HELP_FILES+=		lang/perl5/*.mk lang/php/*.mk lang/python/*.mk
_HELP_FILES+=		lang/ruby/*.mk
_HELP_FILES+=		print/texlive/*.mk
_HELP_FILES+=		mk/*/*.help
.if exists(${.PARSEDIR}/../../wip/mk)
_HELP_FILES+=		wip/mk/*.mk
.endif

.if defined(VARNAME)
TOPIC?=		${VARNAME}
.endif
.if defined(topic)
TOPIC?=		${topic}
.endif

.if !target(help)
.PHONY: help
help:
.  if !defined(TOPIC)
	@${ECHO} "usage: "${MAKE:Q}" help topic=<topic>"
	@${ECHO} ""
	@${ECHO} "	<topic> may be a variable name or a make target,"
	@${ECHO} "	for example CONFIGURE_DIRS or patch."
	@${ECHO} ""
	@${ECHO} "	For convenience, all-uppercase topics such as variable"
	@${ECHO} "	names may also be given in all-lowercase."
	@${ECHO} ""
	@${ECHO} "	To see all available topics, use:"
	@${ECHO} "	    make help topic=:index"
	@${ECHO} ""
.  else
	${RUN} env TOPIC=${TOPIC:Q} ${AWK} -f ${PKGSRCDIR}/mk/help/help.awk \
		${_HELP_FILES:S|^|${_PKGSRC_TOPDIR}/|:S|^${.CURDIR}|.|:S,^./,,} \
	| $${PAGER:-cat}
.  endif
.endif