| @@ -1,121 +1,121 @@ | | | @@ -1,121 +1,121 @@ |
1 | # $NetBSD: Makefile.params,v 1.16 2017/01/08 17:39:08 christos Exp $ | | 1 | # $NetBSD: Makefile.params,v 1.17 2017/01/24 17:54:52 christos Exp $ |
2 | # | | 2 | # |
3 | # Makefile fragment for printing build parameters. | | 3 | # Makefile fragment for printing build parameters. |
4 | # | | 4 | # |
5 | # Public variables: | | 5 | # Public variables: |
6 | # RELEASEVARS | | 6 | # RELEASEVARS |
7 | # List of variables whose value should be printed. | | 7 | # List of variables whose value should be printed. |
8 | # | | 8 | # |
9 | # PRINT_PARAMS | | 9 | # PRINT_PARAMS |
10 | # A command to print the desired variables and values | | 10 | # A command to print the desired variables and values |
11 | # to stdout, without any additional debugging information. | | 11 | # to stdout, without any additional debugging information. |
12 | # Values are printed as single-quoted strings, with | | 12 | # Values are printed as single-quoted strings, with |
13 | # embedded quotes and newlines escaped in a way that's | | 13 | # embedded quotes and newlines escaped in a way that's |
14 | # acceptable to sh(1). Undefined values are printed | | 14 | # acceptable to sh(1). Undefined values are printed |
15 | # as "(undefined)" (without quotation marks). | | 15 | # as "(undefined)" (without quotation marks). |
16 | # | | 16 | # |
17 | # Internal targets: | | 17 | # Internal targets: |
18 | # _params: | | 18 | # _params: |
19 | # Prints the names and values of all the variables | | 19 | # Prints the names and values of all the variables |
20 | # listed in ${RELEASEVARS}. The desired results may be | | 20 | # listed in ${RELEASEVARS}. The desired results may be |
21 | # redirected somewhere other than stdout, for example by | | 21 | # redirected somewhere other than stdout, for example by |
22 | # setting _params_redirect='>&3'. stdout and stderr may | | 22 | # setting _params_redirect='>&3'. stdout and stderr may |
23 | # contain unwanted debugging information, from make and | | 23 | # contain unwanted debugging information, from make and |
24 | # the shell. | | 24 | # the shell. |
25 | # | | 25 | # |
26 | # Internal variables: | | 26 | # Internal variables: |
27 | # _params_redirect: | | 27 | # _params_redirect: |
28 | # If set, this should be a shell redirection specification, such | | 28 | # If set, this should be a shell redirection specification, such |
29 | # as '>&3', controlling where the output from "make _params" will | | 29 | # as '>&3', controlling where the output from "make _params" will |
30 | # be sent. | | 30 | # be sent. |
31 | # | | 31 | # |
32 | # Example: | | 32 | # Example: |
33 | # . ${NETBSDSRCDIR}/etc/Makefile.params | | 33 | # . ${NETBSDSRCDIR}/etc/Makefile.params |
34 | # show-params: .MAKE .PHONY # print params to stdout | | 34 | # show-params: .MAKE .PHONY # print params to stdout |
35 | # @${PRINT_PARAMS} | | 35 | # @${PRINT_PARAMS} |
36 | # | | 36 | # |
37 | | | 37 | |
38 | .include <bsd.own.mk> # for some variables | | 38 | .include <bsd.own.mk> # for some variables |
39 | | | 39 | |
40 | RELEASEVARS= DISTRIBVER EXTERNAL_TOOLCHAIN HAVE_GCC HAVE_GDB \ | | 40 | RELEASEVARS= DISTRIBVER EXTERNAL_TOOLCHAIN HAVE_GCC HAVE_GDB \ |
41 | HAVE_LLVM HAVE_PCC INSTALLWORLDDIR \ | | 41 | HAVE_LLVM HAVE_PCC INSTALLWORLDDIR \ |
42 | MACHINE MACHINE_ARCH MAKE MAKECONF \ | | 42 | MACHINE MACHINE_ARCH MAKECONF \ |
43 | MAKEOBJDIR MAKEOBJDIRPREFIX MAKEVERBOSE \ | | 43 | MAKEOBJDIR MAKEOBJDIRPREFIX MAKEVERBOSE \ |
44 | NOCLEANDIR NODISTRIBDIRS NOINCLUDES \ | | 44 | NOCLEANDIR NODISTRIBDIRS NOINCLUDES \ |
45 | TOOLCHAIN_MISSING \ | | 45 | TOOLCHAIN_MISSING \ |
46 | USE_HESIOD USE_INET6 USE_JEMALLOC USE_KERBEROS USE_LDAP \ | | 46 | USE_HESIOD USE_INET6 USE_JEMALLOC USE_KERBEROS USE_LDAP \ |
47 | USE_PAM USE_SKEY USE_YP \ | | 47 | USE_PAM USE_SKEY USE_YP \ |
48 | USETOOLS | | 48 | USETOOLS |
49 | | | 49 | |
50 | .if ${MKREPRO:Uno} != "yes" | | 50 | .if ${MKREPRO:Uno} != "yes" |
51 | RELEASEVARS+= BSDOBJDIR BSDSRCDIR BUILDID BUILDINFO BUILDSEED \ | | 51 | RELEASEVARS+= BSDOBJDIR BSDSRCDIR BUILDID BUILDINFO BUILDSEED \ |
52 | DESTDIR KERNARCHDIR KERNCONFDIR KERNOBJDIR KERNSRCDIR \ | | 52 | DESTDIR KERNARCHDIR KERNCONFDIR KERNOBJDIR KERNSRCDIR MAKE \ |
53 | MAKEFLAGS NBUILDJOBS NETBSDSRCDIR OBJMACHINE OBJMACHINE_ARCH \ | | 53 | MAKEFLAGS NBUILDJOBS NETBSDSRCDIR OBJMACHINE OBJMACHINE_ARCH \ |
54 | RELEASEDIR RELEASEMACHINEDIR TOOLDIR USR_OBJMACHINE X11SRCDIR | | 54 | RELEASEDIR RELEASEMACHINEDIR TOOLDIR USR_OBJMACHINE X11SRCDIR |
55 | .endif | | 55 | .endif |
56 | | | 56 | |
57 | RELEASEVARS+= ${_MKVARS.yes} ${_MKVARS.no} | | 57 | RELEASEVARS+= ${_MKVARS.yes} ${_MKVARS.no} |
58 | | | 58 | |
59 | # | | 59 | # |
60 | # Duplicate the DISTRIBVER setting from src/etc/Makefile. | | 60 | # Duplicate the DISTRIBVER setting from src/etc/Makefile. |
61 | # | | 61 | # |
62 | .ifndef DISTRIBVER | | 62 | .ifndef DISTRIBVER |
63 | DISTRIBVER!= ${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh | | 63 | DISTRIBVER!= ${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh |
64 | .endif | | 64 | .endif |
65 | | | 65 | |
66 | # | | 66 | # |
67 | # _params does the printing. | | 67 | # _params does the printing. |
68 | # | | 68 | # |
69 | _params_redirect?= # empty | | 69 | _params_redirect?= # empty |
70 | | | 70 | |
71 | _params: .PHONY | | 71 | _params: .PHONY |
72 | .for var in ${RELEASEVARS:O} | | 72 | .for var in ${RELEASEVARS:O} |
73 | .if defined(${var}) | | 73 | .if defined(${var}) |
74 | @printf "%20s = '%-s'\n" ${var} ${${var}:C/'/'\\\\''/gW:Q} \ | | 74 | @printf "%20s = '%-s'\n" ${var} ${${var}:C/'/'\\\\''/gW:Q} \ |
75 | ${_params_redirect} | | 75 | ${_params_redirect} |
76 | .else | | 76 | .else |
77 | @printf "%20s = (undefined)\n" ${var} \ | | 77 | @printf "%20s = (undefined)\n" ${var} \ |
78 | ${_params_redirect} | | 78 | ${_params_redirect} |
79 | .endif | | 79 | .endif |
80 | .endfor | | 80 | .endfor |
81 | | | 81 | |
82 | # PRINT_PARAMS: | | 82 | # PRINT_PARAMS: |
83 | # | | 83 | # |
84 | # The output from the "make _params" can include the following types of | | 84 | # The output from the "make _params" can include the following types of |
85 | # unwanted lines: | | 85 | # unwanted lines: |
86 | # | | 86 | # |
87 | # make -j prints "--- _params ---"; | | 87 | # make -j prints "--- _params ---"; |
88 | # | | 88 | # |
89 | # if MAKEVERBOSE is set to 3 or more then make prints each "printf" | | 89 | # if MAKEVERBOSE is set to 3 or more then make prints each "printf" |
90 | # command in addition to executing it; | | 90 | # command in addition to executing it; |
91 | # | | 91 | # |
92 | # if MAKEVERBOSE is set to 4 then the shell prints each command | | 92 | # if MAKEVERBOSE is set to 4 then the shell prints each command |
93 | # (prefixed with "+"). | | 93 | # (prefixed with "+"). |
94 | # | | 94 | # |
95 | # So the resulting output can look like this: | | 95 | # So the resulting output can look like this: |
96 | # | | 96 | # |
97 | # --- _params --- | | 97 | # --- _params --- |
98 | # + echo 'printf "%20s = '\''%-s'\''\n" BSDOBJDIR /usr/obj' | | 98 | # + echo 'printf "%20s = '\''%-s'\''\n" BSDOBJDIR /usr/obj' |
99 | # printf "%20s = '%-s'\n" BSDOBJDIR /usr/obj | | 99 | # printf "%20s = '%-s'\n" BSDOBJDIR /usr/obj |
100 | # + printf '%20s = '\''%-s'\''\n' BSDOBJDIR /usr/obj | | 100 | # + printf '%20s = '\''%-s'\''\n' BSDOBJDIR /usr/obj |
101 | # BSDOBJDIR = '/usr/obj' | | 101 | # BSDOBJDIR = '/usr/obj' |
102 | # + echo 'printf "%20s = '\''%-s'\''\n" BSDSRCDIR /usr/src' | | 102 | # + echo 'printf "%20s = '\''%-s'\''\n" BSDSRCDIR /usr/src' |
103 | # printf "%20s = '%-s'\n" BSDSRCDIR /usr/src | | 103 | # printf "%20s = '%-s'\n" BSDSRCDIR /usr/src |
104 | # + printf '%20s = '\''%-s'\''\n' BSDSRCDIR /usr/src | | 104 | # + printf '%20s = '\''%-s'\''\n' BSDSRCDIR /usr/src |
105 | # BSDSRCDIR = '/usr/src' | | 105 | # BSDSRCDIR = '/usr/src' |
106 | # [...] | | 106 | # [...] |
107 | # | | 107 | # |
108 | # where what we want is just this: | | 108 | # where what we want is just this: |
109 | # | | 109 | # |
110 | # BSDOBJDIR = '/usr/obj' | | 110 | # BSDOBJDIR = '/usr/obj' |
111 | # BSDSRCDIR = '/usr/src' | | 111 | # BSDSRCDIR = '/usr/src' |
112 | # [...] | | 112 | # [...] |
113 | # | | 113 | # |
114 | # The shell redirections in ${PRINT_PARAMS} ensure that the unwanted | | 114 | # The shell redirections in ${PRINT_PARAMS} ensure that the unwanted |
115 | # noise is discarded (via ">/dev/null"), while the desired information | | 115 | # noise is discarded (via ">/dev/null"), while the desired information |
116 | # ends up on the subshell's stdout (via ">&3" and "3>&1"). The value | | 116 | # ends up on the subshell's stdout (via ">&3" and "3>&1"). The value |
117 | # of _params_redirect is passed in the environment instead of on the | | 117 | # of _params_redirect is passed in the environment instead of on the |
118 | # command line, to prevent it from appearing in MAKEFLAGS (which would | | 118 | # command line, to prevent it from appearing in MAKEFLAGS (which would |
119 | # appear in the output). | | 119 | # appear in the output). |
120 | # | | 120 | # |
121 | PRINT_PARAMS:= (_params_redirect='>&3' ${MAKE} -f ${.PARSEDIR:Q}/${.PARSEFILE:Q} _params 3>&1 >/dev/null) | | 121 | PRINT_PARAMS:= (_params_redirect='>&3' ${MAKE} -f ${.PARSEDIR:Q}/${.PARSEFILE:Q} _params 3>&1 >/dev/null) |