1 # $NetBSD: Makefile.params,v 1.7 2013/11/01 11:09:05 apb Exp $
3 # Makefile fragment for printing build parameters.
7 # List of variables whose value should be printed.
10 # A command to print the desired variables and values
11 # to stdout, without any additional debugging information.
12 # Values are printed as single-quoted strings, with
13 # embedded quotes and newlines escaped in a way that's
14 # acceptable to sh(1). Undefined values are printed
15 # as "(undefined)" (without quotation marks).
19 # Prints the names and values of all the variables
20 # listed in ${RELEASEVARS}. The desired results may be
21 # redirected somewhere other than stdout, for example by
22 # setting _params_redirect='>&3'. stdout and stderr may
23 # contain unwanted debugging information, from make and
28 # If set, this should be a shell redirection specification, such
29 # as '>&3', controlling where the output from "make _params" will
33 # . ${NETBSDSRCDIR}/etc/Makefile.params
34 # show-params: .MAKE .PHONY # print params to stdout
38 .include <bsd.own.mk> # for some variables
39 .include <bsd.sys.mk> # for more variables
41 RELEASEVARS= BSDOBJDIR BSDSRCDIR BUILDID \
42 DESTDIR DISTRIBVER EXTERNAL_TOOLCHAIN HAVE_GCC HAVE_GDB \
43 HAVE_LLVM HAVE_PCC INSTALLWORLDDIR \
44 KERNARCHDIR KERNCONFDIR KERNOBJDIR KERNSRCDIR \
45 MACHINE MACHINE_ARCH MAKE MAKECONF MAKEFLAGS \
46 MAKEOBJDIR MAKEOBJDIRPREFIX MAKEVERBOSE \
47 MKATF MKBFD MKBINUTILS MKCATPAGES \
48 MKCRYPTO MKCRYPTO_RC5 MKCVS \
49 MKDEBUG MKDEBUGLIB MKDOC MKDTRACE MKDYNAMICROOT \
50 MKGCC MKGCCCMDS MKGDB \
51 MKHESIOD MKHTML MKIEEEFP MKINET6 MKINFO MKIPFILTER \
52 MKKERBEROS MKKYUA MKLDAP MKLINKLIB MKLINT MKLLVM \
53 MKMAN MKMANZ MKMDNS MKNLS MKNPF MKOBJ MKOBJDIRS \
54 MKPAM MKPCC MKPF MKPIC MKPICINSTALL MKPICLIB MKPOSTFIX \
56 MKSHARE MKSKEY MKSOFTFLOAT MKSTATICLIB \
57 MKUNPRIVED MKUPDATE MKX11 MKYP \
58 NBUILDJOBS NETBSDSRCDIR \
59 NOCLEANDIR NODISTRIBDIRS NOINCLUDES \
61 RELEASEDIR RELEASEMACHINEDIR TOOLCHAIN_MISSING TOOLDIR \
62 USE_HESIOD USE_INET6 USE_JEMALLOC USE_KERBEROS USE_LDAP \
63 USE_PAM USE_SKEY USE_YP \
64 USETOOLS USR_OBJMACHINE \
69 # Duplicate the DISTRIBVER setting from src/etc/Makefile.
72 DISTRIBVER!= ${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh
76 # _params does the printing.
78 _params_redirect?= # empty
81 .for var in ${RELEASEVARS}
83 @printf "%20s = '%-s'\n" ${var} ${${var}:C/'/'\\\\''/gW:Q} \
86 @printf "%20s = (undefined)\n" ${var} \
93 # The output from the "make _params" can include the following types of
96 # make -j prints "--- _params ---";
98 # if MAKEVERBOSE is set to 3 or more then make prints each "printf"
99 # command in addition to executing it;
101 # if MAKEVERBOSE is set to 4 then the shell prints each command
102 # (prefixed with "+").
104 # So the resulting output can look like this:
107 # + echo 'printf "%20s = '\''%-s'\''\n" BSDOBJDIR /usr/obj'
108 # printf "%20s = '%-s'\n" BSDOBJDIR /usr/obj
109 # + printf '%20s = '\''%-s'\''\n' BSDOBJDIR /usr/obj
110 # BSDOBJDIR = '/usr/obj'
111 # + echo 'printf "%20s = '\''%-s'\''\n" BSDSRCDIR /usr/src'
112 # printf "%20s = '%-s'\n" BSDSRCDIR /usr/src
113 # + printf '%20s = '\''%-s'\''\n' BSDSRCDIR /usr/src
114 # BSDSRCDIR = '/usr/src'
117 # where what we want is just this:
119 # BSDOBJDIR = '/usr/obj'
120 # BSDSRCDIR = '/usr/src'
123 # The shell redirections in ${PRINT_PARAMS} ensure that the unwanted
124 # noise is discarded (via ">/dev/null"), while the desired information
125 # ends up on the subshell's stdout (via ">&3" and "3>&1"). The value
126 # of _params_redirect is passed in the environment instead of on the
127 # command line, to prevent it from appearing in MAKEFLAGS (which would
128 # appear in the output).
130 PRINT_PARAMS:= (_params_redirect='>&3' ${MAKE} -f ${.PARSEDIR:Q}/${.PARSEFILE:Q} _params 3>&1 >/dev/null)