[BACK]Return to Makefile.params CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / etc

Annotation of src/etc/Makefile.params, Revision 1.6

1.6     ! martin      1: #      $NetBSD: Makefile.params,v 1.5 2013/11/01 06:22:24 apb Exp $
1.1       apb         2: #
                      3: # Makefile fragment for printing build parameters.
                      4: #
                      5: # Public variables:
                      6: #      RELEASEVARS
                      7: #              List of variables whose value should be printed.
                      8: #
                      9: #      PRINT_PARAMS
1.4       apb        10: #              A command to print the desired variables and values
                     11: #              to stdout, without any additional debugging information.
1.1       apb        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).
                     16: #
                     17: # Internal targets:
                     18: #      _params:
1.4       apb        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
                     24: #              the shell.
1.1       apb        25: #
                     26: # Internal variables:
1.4       apb        27: #      _params_redirect:
                     28: #              If set, this should be a shell redirection specification, such
                     29: #              as '>&3', controlling where the output from "make _params" will
                     30: #              be sent.
1.1       apb        31: #
                     32: # Example:
                     33: #      . ${NETBSDSRCDIR}/etc/Makefile.params
                     34: #      show-params: .MAKE .PHONY # print params to stdout
                     35: #              @${PRINT_PARAMS}
                     36: #
                     37:
1.5       apb        38: .include <bsd.own.mk>
                     39:
1.1       apb        40: RELEASEVARS=   BSDOBJDIR BSDSRCDIR BUILDID \
                     41:                DESTDIR DISTRIBVER EXTERNAL_TOOLCHAIN HAVE_GCC HAVE_GDB \
1.3       njoly      42:                HAVE_LLVM HAVE_PCC INSTALLWORLDDIR \
1.1       apb        43:                KERNARCHDIR KERNCONFDIR KERNOBJDIR KERNSRCDIR \
                     44:                MACHINE MACHINE_ARCH MAKE MAKECONF MAKEFLAGS \
                     45:                MAKEOBJDIR MAKEOBJDIRPREFIX MAKEVERBOSE \
1.2       jmmv       46:                MKATF MKBFD MKBINUTILS MKCATPAGES \
1.1       apb        47:                MKCRYPTO MKCRYPTO_RC5 MKCVS \
                     48:                MKDEBUG MKDEBUGLIB MKDOC MKDTRACE MKDYNAMICROOT \
                     49:                MKGCC MKGCCCMDS MKGDB \
                     50:                MKHESIOD MKHTML MKIEEEFP MKINET6 MKINFO MKIPFILTER \
1.3       njoly      51:                MKKERBEROS MKKYUA MKLDAP MKLINKLIB MKLINT MKLLVM \
1.1       apb        52:                MKMAN MKMANZ MKMDNS MKNLS MKNPF MKOBJ MKOBJDIRS \
1.3       njoly      53:                MKPAM MKPCC MKPF MKPIC MKPICINSTALL MKPICLIB MKPOSTFIX \
                     54:                MKPROFILE \
1.1       apb        55:                MKSHARE MKSKEY MKSOFTFLOAT MKSTATICLIB \
                     56:                MKUNPRIVED MKUPDATE MKX11 MKYP \
                     57:                NBUILDJOBS NETBSDSRCDIR \
                     58:                NOCLEANDIR NODISTRIBDIRS NOINCLUDES \
                     59:                OBJMACHINE \
                     60:                RELEASEDIR RELEASEMACHINEDIR TOOLCHAIN_MISSING TOOLDIR \
                     61:                USE_HESIOD USE_INET6 USE_JEMALLOC USE_KERBEROS USE_LDAP \
                     62:                USE_PAM USE_SKEY USE_YP \
                     63:                USETOOLS USR_OBJMACHINE \
                     64:                X11SRCDIR X11FLAVOUR
                     65:
1.5       apb        66:
                     67: #
                     68: # Duplicate the DISTRIBVER setting from src/etc/Makefile.
                     69: #
                     70: .ifndef DISTRIBVER
1.6     ! martin     71: DISTRIBVER!=   ${HOST_SH:Ush} ${NETBSDSRCDIR}/sys/conf/osrelease.sh
1.5       apb        72: .endif
                     73:
                     74: #
                     75: # _params does the printing.
                     76: #
1.4       apb        77: _params_redirect?= # empty
1.1       apb        78:
                     79: _params: .PHONY
                     80: .for var in ${RELEASEVARS}
                     81: .if defined(${var})
1.4       apb        82:        @printf "%20s = '%-s'\n" ${var} ${${var}:C/'/'\\\\''/gW:Q} \
                     83:            ${_params_redirect}
1.1       apb        84: .else
1.5       apb        85:        @printf "%20s = (undefined)\n" ${var} \
1.4       apb        86:            ${_params_redirect}
1.1       apb        87: .endif
                     88: .endfor
                     89:
1.4       apb        90: # PRINT_PARAMS:
1.1       apb        91: #
                     92: # The output from the "make _params" can include the following types of
                     93: # unwanted lines:
                     94: #
1.4       apb        95: #     make -j prints "--- _params ---";
1.1       apb        96: #
                     97: #     if MAKEVERBOSE is set to 3 or more then make prints each "printf"
                     98: #     command in addition to executing it;
                     99: #
                    100: #     if MAKEVERBOSE is set to 4 then the shell prints each command
                    101: #     (prefixed with "+").
                    102: #
                    103: # So the resulting output can look like this:
                    104: #
1.4       apb       105: #      --- _params ---
1.1       apb       106: #      + echo 'printf "%20s = '\''%-s'\''\n" BSDOBJDIR /usr/obj'
                    107: #      printf "%20s = '%-s'\n" BSDOBJDIR /usr/obj
                    108: #      + printf '%20s = '\''%-s'\''\n' BSDOBJDIR /usr/obj
                    109: #                 BSDOBJDIR = '/usr/obj'
                    110: #      + echo 'printf "%20s = '\''%-s'\''\n" BSDSRCDIR /usr/src'
                    111: #      printf "%20s = '%-s'\n" BSDSRCDIR /usr/src
                    112: #      + printf '%20s = '\''%-s'\''\n' BSDSRCDIR /usr/src
                    113: #                 BSDSRCDIR = '/usr/src'
                    114: #      [...]
                    115: #
                    116: # where what we want is just this:
                    117: #
                    118: #                 BSDOBJDIR = '/usr/obj'
                    119: #                 BSDSRCDIR = '/usr/src'
                    120: #                 [...]
                    121: #
1.4       apb       122: # The shell redirections in ${PRINT_PARAMS} ensure that the unwanted
                    123: # noise is discarded (via ">/dev/null"), while the desired information
                    124: # ends up on the subshell's stdout (via ">&3" and "3>&1").  The value
                    125: # of _params_redirect is passed in the environment instead of on the
                    126: # command line, to prevent it from appearing in MAKEFLAGS (which would
                    127: # appear in the output).
                    128: #
                    129: PRINT_PARAMS:= (_params_redirect='>&3' ${MAKE} -f ${.PARSEDIR:Q}/${.PARSEFILE:Q} _params 3>&1 >/dev/null)

CVSweb <webmaster@jp.NetBSD.org>