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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
# $NetBSD: show.mk,v 1.10 2009/07/28 07:01:56 rillig Exp $
#
# This file contains some targets that print information gathered from
# variables. They do not modify any variables.
#
# show-tools:
# Emits a /bin/sh shell script that defines all known tools
# to the values they have in the pkgsrc infrastructure.
#
show-tools: .PHONY
.for t in ${_USE_TOOLS}
. if defined(_TOOLS_VARNAME.${t})
@${ECHO} ${_TOOLS_VARNAME.${t}:Q}=${${_TOOLS_VARNAME.${t}}:Q:Q}
. endif
.endfor
# show-build-defs:
# Prints the variables that can be configured by the pkgsrc user
# in mk.conf, and the effects that those settings have.
#
# Package-settable variables:
#
# BUILD_DEFS
# The list of variables that influence the build. These variables
# are user-settable, and their values will be recorded in the
# binary package.
#
# System-provided variables:
#
# BUILD_DEFS_EFFECTS
# The list of variables whose values have been set depending on
# some of the variables in BUILD_DEFS. These variables are system-
# settable and therefore should not be modified directly by the
# pkgsrc user or a package maintainer.
#
BUILD_DEFS?= # none
BUILD_DEFS_EFFECTS?= # none
.if !empty(PKGSRC_SHOW_BUILD_DEFS:M[yY][eE][sS])
pre-depends-hook: show-build-defs
.endif
show-build-defs: .PHONY
.if !empty(BUILD_DEFS:M*)
@${ECHO} "=========================================================================="
@${ECHO} "The following variables will affect the build process of this package,"
@${ECHO} "${PKGNAME}. Their current value is shown below:"
@${ECHO} ""
. for var in ${BUILD_DEFS:O}
. if !defined(${var})
@${ECHO} " * ${var} (not defined)"
. elif defined(${var}) && empty(${var})
@${ECHO} " * ${var} (defined)"
. else
@${ECHO} " * ${var} = "${${var}:Q}
. endif
. endfor
. if !empty(BUILD_DEFS_EFFECTS:M*)
@${ECHO} ""
@${ECHO} "Based on these variables, the following variables have been set:"
@${ECHO} ""
. endif
. for var in ${BUILD_DEFS_EFFECTS:O}
. if !defined(${var})
@${ECHO} " * ${var} (not defined)"
. elif defined(${var}) && empty(${var})
@${ECHO} " * ${var} (defined, but empty)"
. else
@${ECHO} " * ${var} = "${${var}:Q}
. endif
. endfor
@${ECHO} ""
@${ECHO} "You may want to abort the process now with CTRL-C and change their value"
@${ECHO} "before continuing. Be sure to run \`${MAKE} clean' after"
@${ECHO} "the changes."
@${ECHO} "=========================================================================="
.endif
# show-all:
# Prints a list of (hopefully) all pkgsrc variables that are visible
# to the user or the package developer. It is intended to give
# interested parties a better insight into the inner workings of
# pkgsrc. Each variable name is prefixed with a "category":
#
# * "usr" for user-settable variables,
# * "pkg" for package-settable variables,
# * "sys" for system-defined variables.
#
# CAVEAT: Some few variable values that are shown here may be
# misleading. For example, make(1)'s := operator leaves references
# to undefined variables as-is, so they may be resolved later. So
# if you want to take a snapshot of the exact value of a variable,
# you have to use "snapshot!=printf %s ''${var:q}" instead of
# "snapshot:=${var}".
#
# Keywords: debug show _vargroups
#
# The following types of variables are categorized:
#
# _USER_VARS.*
# Variables that can be set by the user and whose primary file is
# this file.
#
# _PKG_VARS.*
# Variables that can be set by the package and whose primary file
# is this file.
#
# _SYS_VARS.*
# Variables that are defined by this file and that are intended to
# be used by packages.
#
# _DEF_VARS.*
# All variables that are defined by this file, whether internal or
# not, primary or not.
#
# _USE_VARS.*
# All variables that are used by this file, whether internal or
# not, primary or not.
#
_SHOW_ALL_CATEGORIES= _USER_VARS _PKG_VARS _SYS_VARS _USE_VARS _DEF_VARS
_LABEL._USER_VARS= usr
_LABEL._PKG_VARS= pkg
_LABEL._SYS_VARS= sys
_LABEL._USE_VARS= use
_LABEL._DEF_VARS= def
show-all: .PHONY
.for g in ${_VARGROUPS:O:u}
show-all: show-all-${g}
show-all-${g}: .PHONY
@echo "${g}:"
. for c in ${_SHOW_ALL_CATEGORIES}
. for v in ${${c}.${g}}
. if defined(${v})
# Be careful not to evaluate variables too early. Some may use the :sh
# modifier, which can end up taking much time and issuing unexpected
# warnings and error messages.
#
# When finally showing the variables, it is unavoidable that those
# variables requiring ${WRKDIR} to exist will show a warning.
#
@value=${${v}:M*:Q}; \
if [ "$$value" ]; then \
echo " ${_LABEL.${c}} ${v} = $$value"; \
else \
echo " ${_LABEL.${c}} ${v} (defined, but empty)"; \
fi
. else
@echo " ${_LABEL.${c}} ${v} (undefined)"
. endif
. endfor
. endfor
@echo ""
.endfor
|