[BACK]Return to BUILDING.mdoc CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / doc

Annotation of src/doc/BUILDING.mdoc, Revision 1.46.2.1

1.46.2.1! bouyer      1: .\"    $NetBSD$
1.1       lukem       2: .\"
1.34      lukem       3: .\" Copyright (c) 2001-2004 The NetBSD Foundation, Inc.
1.1       lukem       4: .\" All rights reserved.
                      5: .\"
                      6: .\" This code is derived from software contributed to The NetBSD Foundation
1.9       lukem       7: .\" by Todd Vierling and Luke Mewburn.
1.1       lukem       8: .\"
                      9: .\" Redistribution and use in source and binary forms, with or without
                     10: .\" modification, are permitted provided that the following conditions
                     11: .\" are met:
                     12: .\" 1. Redistributions of source code must retain the above copyright
                     13: .\"    notice, this list of conditions and the following disclaimer.
                     14: .\" 2. Redistributions in binary form must reproduce the above copyright
                     15: .\"    notice, this list of conditions and the following disclaimer in the
                     16: .\"    documentation and/or other materials provided with the distribution.
                     17: .\" 3. All advertising materials mentioning features or use of this software
                     18: .\"    must display the following acknowledgement:
                     19: .\"        This product includes software developed by the NetBSD
                     20: .\"        Foundation, Inc. and its contributors.
                     21: .\" 4. Neither the name of The NetBSD Foundation nor the names of its
                     22: .\"    contributors may be used to endorse or promote products derived
                     23: .\"    from this software without specific prior written permission.
                     24: .\"
                     25: .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
                     26: .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
                     27: .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
                     28: .\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
                     29: .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
                     30: .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
                     31: .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
                     32: .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
                     33: .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
                     34: .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
                     35: .\" POSSIBILITY OF SUCH DAMAGE.
                     36: .\"
                     37: .\" NOTE: After changing this file, run "make build-docs" to generate the
                     38: .\" proper plaintext versions, and check in all BUILDING.* files!
                     39: .\"
1.13      lukem      40: .\" Toolchain prefix for commands
                     41: .ds toolprefix nb
                     42: .
1.46.2.1! bouyer     43: .Dd March 27, 2007
1.1       lukem      44: .Dt BUILDING 8
                     45: .Os NetBSD
                     46: .
                     47: .Sh NAME
                     48: .
                     49: .Nm BUILDING
                     50: .Nd Procedure for building
                     51: .Nx
                     52: from source code.
                     53: .
                     54: .Sh STATUS
                     55: .
1.6       wiz        56: This document is a work-in-progress.
                     57: As such, the information described
1.1       lukem      58: here may not match the reality of the build system as of this writing.
                     59: Once this document is completely in sync with reality, this paragraph
                     60: will be removed.
                     61: .Pp
                     62: Discrepancies between this documentation and the current reality of
                     63: implementation are noted specially, as with the note below:
                     64: .Pp
                     65: .Em Note :
                     66: This document applies only to platforms which use the new toolchain as
                     67: indicated by the default setting of
                     68: .Sy TOOLCHAIN_MISSING
                     69: in
                     70: .Aq bsd.own.mk .
                     71: Platforms which have not yet been switched to the new toolchain should
                     72: continue building traditionally, using the notes specified in the file
                     73: .Sy UPDATING .
                     74: .
                     75: .Sh REQUIREMENTS
                     76: .
                     77: .Nx
                     78: is designed to be buildable on most POSIX-compliant host systems.
                     79: The basic build procedure is the same whether compiling
                     80: .Em natively
                     81: (on the same
                     82: .Nx
                     83: architecture) or
                     84: .Em cross compiling
                     85: (on another architecture or OS).
                     86: .Pp
                     87: This source tree contains a special subtree,
                     88: .Dq tools ,
                     89: which uses the host system to create a build toolchain for the target
1.6       wiz        90: architecture.
                     91: The host system must have at least C and C++
1.1       lukem      92: compilers in order to create the toolchain
                     93: .Nm ( make
                     94: is not required); all other tools are created as part of the
                     95: .Nx
                     96: build process.
1.38      reed       97: (See the environment variables section below if you need
                     98: to override or manually select your compilers.)
1.1       lukem      99: .
                    100: .Sh FILES
                    101: .
                    102: .Ss Source tree layout
                    103: .
                    104: .Bl -tag -width "BUILDING.mdoc"
1.3       wiz       105: .It Sy doc/BUILDING.mdoc
1.1       lukem     106: This document (in -mdoc troff format; the original copy).
                    107: .It Sy BUILDING
                    108: This document (in plaintext).
1.33      jmc       109: .It Sy tools/compat/README
                    110: Special notes for cross-hosting a NetBSD build on non-NetBSD platforms.
1.1       lukem     111: .It Sy Makefile
                    112: The main Makefile for
                    113: .Nx ;
                    114: should only be run for native builds with an appropriately up-to-date
                    115: version of
                    116: .Nx
                    117: .Xr make 1 .
                    118: (For building from out-of-date systems or on a non-native host, see the
                    119: .Nm build.sh
                    120: shell script.)
                    121: .It Sy UPDATING
                    122: Special notes for updating from an earlier revision of
                    123: .Nx .
                    124: It is important to read this file before every build of an updated
                    125: source tree.
                    126: .It Sy build.sh
                    127: Bourne-compatible shell script used for building the host build tools
                    128: and the
                    129: .Nx
1.6       wiz       130: system from scratch.
                    131: Can be used for both native and cross builds, and should be used instead of
1.1       lukem     132: .Xr make 1
                    133: for any source tree that is updated and recompiled regularly.
                    134: .It Sy crypto/dist/ , dist/ , gnu/dist/
                    135: Sources imported verbatim from third parties, without mangling the
1.6       wiz       136: existing build structure.
                    137: Other source trees in
1.1       lukem     138: .Sy bin
                    139: through
                    140: .Sy usr.sbin
                    141: use the
                    142: .Nx
                    143: .Xr make 1
                    144: .Dq reachover
                    145: Makefile semantics when building these programs for a native host.
                    146: .It Sy distrib/ , etc/
                    147: Sources for items used when making a full release snapshot, such as
                    148: files installed in
1.14      lukem     149: .Sy DESTDIR Ns Pa /etc
1.1       lukem     150: on the destination system, boot media, and release notes.
                    151: .It Sy regress/
1.6       wiz       152: Regression test harness.
                    153: Can be cross-compiled, but only run natively.
1.1       lukem     154: .It Sy sys/
                    155: .Nx
                    156: kernel sources.
                    157: .It Sy tools/
                    158: .Dq Reachover
1.6       wiz       159: build structure for the host build tools.
                    160: This has a special method of determining out-of-date status.
1.1       lukem     161: .It Sy bin/ ... usr.sbin/
                    162: Sources to the
                    163: .Nx
1.6       wiz       164: userland (non-kernel) programs.
                    165: If any of these directories are missing, they will be skipped during the build.
1.34      lukem     166: .It Sy x11/
                    167: .Dq Reachover
                    168: build structure for X11R6; the source is in
                    169: .Sy X11SRCDIR .
1.1       lukem     170: .El
                    171: .
                    172: .Ss Build tree layout
                    173: .
                    174: The
                    175: .Nx
                    176: build tree is described in
                    177: .Xr hier 7 ,
                    178: and the release layout is described in
                    179: .Xr release 7 .
                    180: .Pp
                    181: .
                    182: .Sh CONFIGURATION
                    183: .
                    184: .Ss Environment variables
                    185: ..
                    186: Several environment variables control the behaviour of
                    187: .Nx
                    188: builds.
                    189: .
                    190: .Bl -tag -width "MAKEOBJDIRPREFIX"
                    191: .
1.38      reed      192: .
1.44      apb       193: .It Sy HOST_SH
                    194: Path name to a POSIX-compliant shell.
                    195: If this is not set explicitly, then the default is set
                    196: using heuristics dependent on the host platform,
                    197: or from the shell under which
                    198: .Nm build.sh
                    199: is executed (if that can be determined),
                    200: or using the first copy of
                    201: .Pa sh
                    202: found in
                    203: .Sy PATH .
                    204: If the host system's
                    205: .Pa /bin/sh
                    206: is not POSIX-compliant, we suggest that you build using
                    207: commands like
1.45      apb       208: .Bd -unfilled -offset indent
                    209: .Li HOST_SH= Ns Va /path/to/working/shell
                    210: .Li export HOST_SH
                    211: .Li ${HOST_SH} build.sh Op Ar options
1.44      apb       212: .Ed
                    213: .
1.38      reed      214: .It Sy HOST_CC
                    215: Path name to C compiler used to create the toolchain.
                    216: .
                    217: .It Sy HOST_CXX
                    218: Path name to C++ compiler used to create the toolchain.
                    219: .
1.1       lukem     220: .It Sy MACHINE
                    221: Machine type.
                    222: .
                    223: .It Sy MACHINE_ARCH
                    224: Machine architecture.
                    225: .
                    226: .It Sy MAKE
                    227: Path name to invoke
                    228: .Xr make 1
                    229: as.
                    230: .
                    231: .It Sy MAKEFLAGS
                    232: Flags to invoke
                    233: .Xr make 1
                    234: with.
                    235: .
                    236: .It Sy MAKEOBJDIR
                    237: Directory to use as the
                    238: .Sy .OBJDIR
                    239: for the current directory.
1.46      apb       240: The value is subjected to variable expansion by
                    241: .Xr make 1 .
1.1       lukem     242: Used only if
                    243: .Sy MAKEOBJDIRPREFIX
                    244: is not defined.
                    245: .Sy MAKEOBJDIR
1.23      lukem     246: can only be provided in the environment or via the
1.28      lukem     247: .Fl O
1.23      lukem     248: flag of
                    249: .Nm build.sh .
1.1       lukem     250: .
                    251: .It Sy MAKEOBJDIRPREFIX
                    252: Top level directory of the object directory tree.
1.46      apb       253: If specified, must be an absolute path.
1.1       lukem     254: If this is defined,
                    255: ${MAKEOBJDIRPREFIX}/${.CURDIR}
                    256: is used as the
                    257: .Sy .OBJDIR
                    258: for the current directory.
                    259: The current directory may be read only.
                    260: .Sy MAKEOBJDIRPREFIX
1.23      lukem     261: can only be provided in the environment or via the
                    262: .Fl M
                    263: flag of
                    264: .Nm build.sh .
1.1       lukem     265: .
                    266: .El
                    267: .
                    268: .Ss \*qmake\*q variables
                    269: .
                    270: .de YorN
                    271: Can be set to
                    272: .Dq yes
                    273: or
                    274: .Dq no .
                    275: ..
                    276: .de DFLT
                    277: .Pp
                    278: .Em Default :
                    279: ..
                    280: .de DFLTu
                    281: .DFLT
                    282: Unset.
                    283: ..
                    284: .de DFLTy
                    285: .DFLT
                    286: .Dq yes
                    287: ..
                    288: .de DFLTn
                    289: .DFLT
                    290: .Dq no
                    291: ..
                    292: Several variables control the behavior of
                    293: .Nx
1.6       wiz       294: builds.
                    295: Unless otherwise specified, these variables may be set in
1.1       lukem     296: either the process environment or the
                    297: .Xr make 1
                    298: configuration file specified by
                    299: .Sy MAKECONF .
                    300: .
                    301: .Bl -tag -width "MKCATPAGES"
                    302: .
                    303: .It Sy BUILDID
1.6       wiz       304: Identifier for the build.
                    305: The identifier will be appended to
1.1       lukem     306: object directory names, and can be consulted in the
                    307: .Xr make 1
                    308: configuration file in order to set additional build parameters,
                    309: such as compiler flags.
                    310: .
                    311: .It Sy DESTDIR
                    312: Directory to contain the built
                    313: .Nx
1.6       wiz       314: system.
                    315: If set, special options are passed to the compilation tools to
1.1       lukem     316: prevent their default use of the host system's
                    317: .Sy /usr/include , /usr/lib ,
1.6       wiz       318: and so forth.
1.46      apb       319: This pathname must be an absolute path, and should
1.1       lukem     320: .Em not
                    321: end with a slash
                    322: .Pq /
1.46      apb       323: character.
                    324: (For installation into the system's root directory, set
1.1       lukem     325: .Sy DESTDIR
1.46      apb       326: to an empty string, not to
                    327: .Dq / ) .
1.1       lukem     328: The directory must reside on a file system which supports long file
                    329: names and hard links.
                    330: .DFLT
                    331: Empty string if
                    332: .Sy USETOOLS
                    333: is
                    334: .Dq yes ;
                    335: unset otherwise.
1.17      lukem     336: .Pp
                    337: .Em Note :
                    338: .Sy build.sh
                    339: will provide a default of
                    340: .Pa destdir. Ns Sy MACHINE
                    341: (in the top-level
                    342: .Sy .OBJDIR )
                    343: unless run in
                    344: .Sq expert
                    345: mode
1.1       lukem     346: .
                    347: .It Sy MAKECONF
                    348: The name of the
                    349: .Xr make 1
                    350: configuration file.
                    351: .Em Only settable in the process environment.
                    352: .DFLT
                    353: .Dq /etc/mk.conf
                    354: .
1.30      lukem     355: .It Sy MAKEVERBOSE
                    356: Level of verbosity of status messages.
                    357: Supported values:
                    358: .Bl -tag -width xxx
                    359: .It 0
                    360: No descriptive messages are shown.
                    361: .It 1
                    362: Descriptive messages are shown.
                    363: .It 2
                    364: Descriptive messages (prefixed with a
                    365: .Sq # )
                    366: and command output is not suppressed.
                    367: .El
                    368: .DFLT
                    369: 2
                    370: .
1.1       lukem     371: .It Sy MKCATPAGES
                    372: .YorN
                    373: Indicates whether preformatted plaintext manual pages will be created
                    374: during a build.
                    375: .DFLTy
                    376: .
                    377: .It Sy MKCRYPTO
                    378: .YorN
                    379: Indicates whether cryptographic code will be included in a build;
                    380: provided for the benefit of countries that do not allow strong
1.6       wiz       381: cryptography.
                    382: Will not affect use of the standard low-security password encryption system,
1.1       lukem     383: .Xr crypt 3 .
                    384: .DFLTy
                    385: .
                    386: .It Sy MKDOC
                    387: .YorN
                    388: Indicates whether system documentation destined for
1.14      lukem     389: .Sy DESTDIR Ns Pa /usr/share/doc
1.1       lukem     390: will be installed during a build.
                    391: .DFLTy
                    392: .
                    393: .It Sy MKHOSTOBJ
                    394: .YorN
                    395: If set to
                    396: .Dq yes ,
                    397: then for programs intended to be run on the compile host,
                    398: the name, release, and architecture of the host operating system
                    399: will be suffixed to the name of the object directory created by
                    400: .Dq make obj .
                    401: (This allows multiple host systems to compile NetBSD for a single target.)
                    402: If set to
                    403: .Dq no ,
                    404: then programs built to be run on the compile host will use the same
                    405: object directory names as programs built to be run on the target.
                    406: .DFLTn
                    407: .
                    408: .It Sy MKINFO
                    409: .YorN
                    410: Indicates whether GNU Info files, used for the documentation for
                    411: most of the compilation tools, will be created and installed during a
                    412: build.
                    413: .DFLTy
                    414: .
                    415: .It Sy MKLINT
                    416: .YorN
                    417: Indicates whether
                    418: .Xr lint 1
                    419: will be run against portions of the
                    420: .Nx
                    421: source code during the build, and whether lint libraries will be
                    422: installed into
1.14      lukem     423: .Sy DESTDIR Ns Pa /usr/libdata/lint .
1.1       lukem     424: .DFLTy
                    425: .
                    426: .It Sy MKMAN
                    427: .YorN
                    428: Indicates whether manual pages will be installed during a build.
                    429: .DFLTy
                    430: .
                    431: .It Sy MKNLS
                    432: .YorN
                    433: Indicates whether Native Language System locale zone files will be
                    434: compiled and installed during a build.
                    435: .DFLTy
                    436: .
                    437: .It Sy MKOBJ
                    438: .YorN
                    439: Indicates whether object directories will be created when running
                    440: .Dq make obj .
                    441: If set to
                    442: .Dq no ,
                    443: then all built files will be located inside the regular source tree.
                    444: .DFLTy
                    445: .
                    446: .It Sy MKPIC
                    447: .YorN
                    448: Indicates whether shared objects and libraries will be created and
1.6       wiz       449: installed during a build.
                    450: If set to
1.1       lukem     451: .Dq no ,
                    452: the entire built system will be statically linked.
                    453: .DFLT
1.6       wiz       454: Platform dependent.
                    455: As of this writing, all platforms except
1.1       lukem     456: .Sy sh3
                    457: default to
                    458: .Dq yes .
                    459: .
                    460: .It Sy MKPICINSTALL
                    461: .YorN
                    462: Indicates whether the
                    463: .Xr ar 1
                    464: format libraries
                    465: .Sy ( lib*_pic.a ) ,
                    466: used to generate shared libraries, are installed during a build.
                    467: .DFLTy
                    468: .
                    469: .It Sy MKPROFILE
                    470: .YorN
                    471: Indicates whether profiled libraries
                    472: .Sy ( lib*_p.a )
                    473: will be built and installed during a build.
                    474: .DFLT
                    475: .Dq yes ;
                    476: however, some platforms turn off
                    477: .Sy MKPROFILE
                    478: by default at times due to toolchain problems with profiled code.
                    479: .
                    480: .It Sy MKSHARE
                    481: .YorN
                    482: Indicates whether files destined to reside in
1.14      lukem     483: .Sy DESTDIR Ns Pa /usr/share
1.6       wiz       484: will be built and installed during a build.
                    485: If set to
1.1       lukem     486: .Dq no ,
                    487: then all of
                    488: .Sy MKCATPAGES , MKDOC , MKINFO , MKMAN ,
                    489: and
                    490: .Sy MKNLS
                    491: will be set to
                    492: .Dq no
                    493: unconditionally.
                    494: .DFLTy
                    495: .
1.35      wiz       496: .It Sy MKTTINTERP
                    497: .YorN
                    498: For X builds, decides if the TrueType bytecode interpreter
                    499: is turned on.
                    500: See
                    501: .Pa http://www.freetype.org/patents.html
                    502: for details.
                    503: .DFLTn
                    504: .
1.25      lukem     505: .It Sy MKUNPRIVED
                    506: .YorN
                    507: Indicates whether an unprivileged install will occur.
1.1       lukem     508: The user, group, permissions, and file flags, will not be set on
1.37      jmc       509: the installed items; instead the information will be appended to
1.1       lukem     510: a file called
                    511: .Pa METALOG
                    512: in
                    513: .Sy DESTDIR .
                    514: The contents of
                    515: .Pa METALOG
1.37      jmc       516: are used during the generation of the distribution tar files to ensure
1.1       lukem     517: that the appropriate file ownership is stored.
1.25      lukem     518: .DFLTn
1.1       lukem     519: .
1.25      lukem     520: .It Sy MKUPDATE
                    521: .YorN
                    522: Indicates whether all install operations intended to write to
1.1       lukem     523: .Sy DESTDIR
                    524: will compare file timestamps before installing, and skip the install
1.6       wiz       525: phase if the destination files are up-to-date.
                    526: This also has implications on full builds (see next subsection).
1.25      lukem     527: .DFLTn
                    528: .
1.34      lukem     529: .It Sy MKX11
                    530: .YorN
                    531: Indicates whether X11R6 is built from
                    532: .Sy X11SRCDIR .
                    533: .DFLTn
                    534: .
1.25      lukem     535: .It Sy TOOLDIR
                    536: Directory to hold the host tools, once built.
1.46      apb       537: If specified, must be an absolute path.
1.25      lukem     538: This directory should be unique to a given host system and
                    539: .Nx
                    540: source tree.
                    541: (However, multiple targets may share the same
                    542: .Sy TOOLDIR ;
                    543: the target-dependent files have unique names.)  If unset, a default based
                    544: on the
                    545: .Xr uname 1
                    546: information of the host platform will be created in the
                    547: .Sy .OBJDIR
                    548: of
1.26      lukem     549: .Pa src .
1.1       lukem     550: .DFLTu
                    551: .
                    552: .It Sy USETOOLS
                    553: Indicates whether the tools specified by
                    554: .Sy TOOLDIR
1.6       wiz       555: should be used as part of a build in progress.
                    556: Must be set to
1.1       lukem     557: .Dq yes
                    558: if cross-compiling.
                    559: .Bl -tag -width "never"
                    560: .It Sy yes
                    561: Use the tools from
                    562: .Sy TOOLDIR .
                    563: .It Sy no
                    564: Do not use the tools from
                    565: .Sy TOOLDIR ,
                    566: but refuse to build native compilation tool components that are
                    567: version-specific for that tool.
                    568: .It Sy never
                    569: Do not use the tools from
                    570: .Sy TOOLDIR ,
1.6       wiz       571: even when building native tool components.
                    572: This is similar to the traditional
1.1       lukem     573: .Nx
                    574: build method, but does
                    575: .Em not
                    576: verify that the compilation tools in use are up-to-date enough in order
1.6       wiz       577: to build the tree successfully.
                    578: This may cause build or runtime problems when building the whole
1.1       lukem     579: .Nx
                    580: source tree.
                    581: .El
                    582: .DFLT
                    583: .Dq yes
                    584: if building all or part of a whole
                    585: .Nx
                    586: source tree (detected automatically);
                    587: .Dq no
                    588: otherwise (to preserve traditional semantics of the
                    589: .Aq bsd.*.mk
                    590: .Xr make 1
                    591: include files).
                    592: .
1.34      lukem     593: .It Sy X11SRCDIR
                    594: Directory containing the X11R6 source.
1.46      apb       595: If specified, must be an absolute path.
1.34      lukem     596: The main X11R6 source is found in
                    597: .Sy X11SRCDIR Ns Pa /xfree/xc .
                    598: .DFLT
                    599: .Dq /usr/xsrc
                    600: .
1.1       lukem     601: .El
                    602: .
                    603: .Ss \*qmake\*q variables for full builds
                    604: These variables only affect the top level
                    605: .Dq Makefile
                    606: and do not affect manually building subtrees of the
                    607: .Nx
                    608: source code.
                    609: .
1.7       lukem     610: .Bl -tag -width "INSTALLWORLDDIR"
                    611: .
                    612: .It Sy INSTALLWORLDDIR
                    613: Location for the
                    614: .Dq make installworld
                    615: target to install to.
1.46      apb       616: If specified, must be an absolute path.
1.7       lukem     617: .DFLT
                    618: .Dq /
1.1       lukem     619: .
                    620: .It Sy MKOBJDIRS
                    621: .YorN
                    622: Indicates whether object directories will be created automatically
                    623: (via a
                    624: .Dq make obj
                    625: pass) at the start of a build.
1.21      lukem     626: .DFLTn
1.1       lukem     627: .
1.25      lukem     628: .It Sy MKUPDATE
                    629: .YorN
                    630: If set, then in addition to the effects described for
                    631: .Sy MKUPDATE=yes
                    632: above, this implies the effects of
                    633: .Sy NOCLEANDIR
                    634: (i.e.,
                    635: .Dq make cleandir
                    636: is avoided).
                    637: .DFLTn
                    638: .
1.1       lukem     639: .It Sy NBUILDJOBS
1.6       wiz       640: Now obsolete.
                    641: Use the
1.1       lukem     642: .Xr make 1
                    643: option
1.4       lukem     644: .Fl j ,
1.1       lukem     645: instead (see below)
                    646: .DFLTu
                    647: .
                    648: .It Sy NOCLEANDIR
                    649: If set, avoids the
                    650: .Dq make cleandir
1.6       wiz       651: phase of a full build.
                    652: This has the effect of allowing only changed
                    653: files in a source tree to be recompiled.
                    654: This can speed up builds when updating only a few files in the tree.
1.1       lukem     655: .DFLTu
                    656: .
                    657: .It Sy NODISTRIBDIRS
                    658: If set, avoids the
                    659: .Dq make distrib-dirs
1.6       wiz       660: phase of a full build.
                    661: This skips running
1.1       lukem     662: .Xr mtree 8
                    663: on
                    664: .Sy DESTDIR ,
                    665: useful on systems where building as an unprivileged user, or where it is
                    666: known that the system-wide mtree files have not changed.
                    667: .DFLTu
                    668: .
                    669: .It Sy NOINCLUDES
                    670: If set, avoids the
                    671: .Dq make includes
1.6       wiz       672: phase of a full build.
                    673: This has the effect of preventing
1.1       lukem     674: .Xr make 1
                    675: from thinking that some programs are out-of-date simply because the
1.6       wiz       676: system include files have changed.
                    677: However, this option should not be used when updating the entire
1.1       lukem     678: .Nx
                    679: source tree arbitrarily; it is suggested to use
1.25      lukem     680: .Sy MKUPDATE=yes
1.1       lukem     681: in that case.
                    682: .DFLTu
                    683: .
                    684: .It Sy RELEASEDIR
                    685: If set, specifies the directory to which a
                    686: .Xr release 7
                    687: layout will be written at the end of a
                    688: .Dq make release .
1.46      apb       689: If specified, must be an absolute path.
1.1       lukem     690: .DFLTu
1.17      lukem     691: .Pp
                    692: .Em Note :
                    693: .Sy build.sh
                    694: will provide a default of
                    695: .Pa releasedir
                    696: (in the top-level
                    697: .Sy .OBJDIR )
                    698: unless run in
                    699: .Sq expert
                    700: mode
1.1       lukem     701: .
                    702: .El
                    703: .
                    704: .Sh BUILDING
                    705: .
                    706: .Ss \*qmake\*q command line options
1.37      jmc       707: This is not a summary of all the options available to
1.1       lukem     708: .Xr make 1 ;
                    709: only the options used most frequently with
                    710: .Nx
                    711: builds are listed here.
                    712: .
                    713: .Bl -tag -width "var=value"
                    714: .
1.4       lukem     715: .It Fl j Ar njob
1.1       lukem     716: Run up to
1.4       lukem     717: .Ar njob
1.1       lukem     718: .Xr make 1
                    719: subjobs in parallel.
1.37      jmc       720: Makefiles should use .WAIT or have explicit dependencies
1.1       lukem     721: as necessary to enforce build ordering.
                    722: If you see build failures with -j, please save complete build logs
                    723: so the failures can be analyzed.
                    724: .
1.4       lukem     725: .It Fl m Ar dir
1.1       lukem     726: Specify the default directory for searching for system Makefile
                    727: segments, mainly the
                    728: .Aq bsd.*.mk
1.6       wiz       729: files.
                    730: When building any full
1.1       lukem     731: .Nx
                    732: source tree, this should be set to the
                    733: .Dq share/mk
1.6       wiz       734: directory in the source tree.
                    735: (This is set automatically when building from the top level.)
1.1       lukem     736: .
1.4       lukem     737: .It Fl n
1.1       lukem     738: Display the commands that would have been executed, but do not
1.6       wiz       739: actually execute them.
                    740: This will still cause recursion to take place.
1.1       lukem     741: .
1.32      zuntum    742: .It Fl V Ar var
1.1       lukem     743: Print
                    744: .Xr make 1 Ns 's
                    745: idea of the value of
1.4       lukem     746: .Ar var .
1.1       lukem     747: Does not build any targets.
                    748: .
                    749: .It Em var=value
                    750: Set the variable
                    751: .Em var
                    752: to
                    753: .Em value ,
                    754: overriding any setting specified by the process environment, the
                    755: .Sy MAKECONF
                    756: configuration file, or the system Makefile segments.
                    757: .
                    758: .El
                    759: .
                    760: .Ss \*qmake\*q targets
                    761: .
                    762: These default targets may be built by running
                    763: .Xr make 1
                    764: in any subtree of the
                    765: .Nx
1.6       wiz       766: source code.
                    767: It is recommended that none of these be used from the top
1.1       lukem     768: level Makefile; as a specific exception,
                    769: .Dq make obj
                    770: and
                    771: .Dq make cleandir
                    772: are useful in that context.
                    773: .
                    774: .Bl -tag -width "dependall"
                    775: .
                    776: .It Sy all
                    777: Build programs, libraries, and preformatted documentation.
                    778: .
                    779: .It Sy clean
                    780: Remove program and library object code files.
                    781: .
                    782: .It Sy cleandir
                    783: Same as
                    784: .Sy clean ,
                    785: but also remove preformatted documentation, dependency files generated
                    786: by
                    787: .Dq make depend ,
                    788: and any other files known to be created at build time.
                    789: .
                    790: .It Sy depend
                    791: Create dependency files
                    792: .Sy ( .depend )
                    793: containing more detailed information about the dependencies of source
1.6       wiz       794: code on header files.
                    795: Allows programs to be recompiled automatically when a dependency changes.
1.1       lukem     796: .
                    797: .It Sy dependall
                    798: Does a
                    799: .Dq make depend
                    800: immediately followed by a
                    801: .Dq make all .
                    802: This improves cache locality of the build since both passes read the source
                    803: files in their entirety.
                    804: .
1.34      lukem     805: .It Sy distclean
                    806: Synonym for
                    807: .Sy cleandir .
                    808: .
1.1       lukem     809: .It Sy includes
1.6       wiz       810: Build and install system header files.
                    811: Typically needed before any system libraries or programs can be built.
1.1       lukem     812: .
                    813: .It Sy install
                    814: Install programs, libraries, and documentation into
                    815: .Sy DESTDIR .
                    816: Few files will be installed to
1.14      lukem     817: .Sy DESTDIR Ns Pa /dev ,
                    818: .Sy DESTDIR Ns Pa /etc ,
                    819: .Sy DESTDIR Ns Pa /root
1.1       lukem     820: or
1.14      lukem     821: .Sy DESTDIR Ns Pa /var
1.1       lukem     822: in order to prevent user supplied configuration data from being overwritten.
                    823: .It Sy lint
                    824: Run
                    825: .Xr lint 1
                    826: against the C source code, where appropriate, and generate
                    827: system-installed lint libraries.
                    828: .
                    829: .It Sy obj
                    830: Create object directories to be used for built files, instead of
                    831: building directly in the source tree.
                    832: .
                    833: .It Sy tags
                    834: Create
                    835: .Xr ctags 1
                    836: searchable function lists usable by the
                    837: .Xr ex 1
                    838: and
                    839: .Xr vi 1
                    840: text editors.
                    841: .
                    842: .El
                    843: .
                    844: .Ss \*qmake\*q targets for the top level
                    845: .
                    846: Additional
                    847: .Xr make 1
                    848: targets are usable specifically from the top source level to facilitate
                    849: building the entire
                    850: .Nx
                    851: source tree.
                    852: .
1.7       lukem     853: .Bl -tag -width "distribution"
1.1       lukem     854: .
                    855: .It Sy build
                    856: Build the entire
                    857: .Nx
1.6       wiz       858: system.
                    859: This orders portions of the source tree such that prerequisites
1.1       lukem     860: will be built in the proper order.
                    861: .
1.7       lukem     862: .It Sy distribution
                    863: Do a
                    864: .Dq make build ,
                    865: and then install a full distribution into
1.9       lukem     866: .Sy DESTDIR ,
                    867: including files in
1.14      lukem     868: .Sy DESTDIR Ns Pa /dev ,
                    869: .Sy DESTDIR Ns Pa /etc ,
                    870: .Sy DESTDIR Ns Pa /root
1.9       lukem     871: and
1.14      lukem     872: .Sy DESTDIR Ns Pa /var .
1.7       lukem     873: .
                    874: .It Sy buildworld
                    875: As per
                    876: .Dq make distribution ,
                    877: except that it ensures that
                    878: .Sy DESTDIR
                    879: is not the root directory.
                    880: .
                    881: .It Sy installworld
                    882: Install the distribution from
                    883: .Sy DESTDIR
                    884: to
                    885: .Sy INSTALLWORLDDIR
                    886: (which defaults to the root directory).
                    887: Ensures that
                    888: .Sy INSTALLWORLDDIR
1.37      jmc       889: is not the root directory if cross compiling.
1.7       lukem     890: .Pp
1.46.2.1! bouyer    891: The
        !           892: .Sy INSTALLSETS
        !           893: environment variable may be set to a list of
        !           894: distribution sets to be installed.
        !           895: By default, all sets except
        !           896: .Dq etc
        !           897: and
        !           898: .Dq xetc
        !           899: are installed (so most files in
        !           900: .Sy INSTALLWORLDDIR Ns Pa /etc
        !           901: will not be installed or modified).
        !           902: .Pp
1.7       lukem     903: .Em Note :
1.46.2.1! bouyer    904: Before performing this operation with
        !           905: .Sy INSTALLWORLDDIR Ns = Ns Pa / ,
        !           906: it is highly recommended that you upgrade your kernel and reboot.
        !           907: After performing this operation,
        !           908: it is recommended that you use
        !           909: .Xr etcupdate 8
        !           910: to update files in
        !           911: .Sy INSTALLWORLDDIR Ns Pa /etc
        !           912: and that you use
        !           913: .Xr postinstall 8
        !           914: to check for inconsistencies (and possibly to fix them).
1.12      lukem     915: .It Sy sets
                    916: Create distribution sets from
                    917: .Sy DESTDIR
                    918: into
1.14      lukem     919: .Sy RELEASEDIR/MACHINE Ns Pa /binary/sets .
1.12      lukem     920: Should be run after
                    921: .Dq make distribution
                    922: (as
                    923: .Dq make build
                    924: does not install all of the required files).
                    925: .
1.18      lukem     926: .It Sy sourcesets
                    927: Create source sets of the source tree into
                    928: .Sy RELEASEDIR Ns Pa /source/sets .
                    929: .
1.40      apb       930: .It Sy syspkgs
                    931: Create syspkgs from
                    932: .Sy DESTDIR
                    933: into
                    934: .Sy RELEASEDIR/MACHINE Ns Pa /binary/syspkgs .
                    935: Should be run after
                    936: .Dq make distribution
                    937: (as
                    938: .Dq make build
                    939: does not install all of the required files).
                    940: .
1.1       lukem     941: .It Sy release
                    942: Do a
1.9       lukem     943: .Dq make distribution ,
1.12      lukem     944: build kernels, distribution media, and install sets
                    945: (this as per
                    946: .Dq make sets ) ,
                    947: and
1.1       lukem     948: then package the system into a standard release layout as described by
                    949: .Xr release 7 .
                    950: This requires that
                    951: .Sy RELEASEDIR
                    952: be set (see above).
                    953: .
1.42      apb       954: .It iso-image
                    955: Create a CD-ROM image in
                    956: .Sy RELEASEDIR/MACHINE Ns Pa /installation/cdrom .
                    957: RELEASEDIR must already have been populated by
                    958: .Dq make release
                    959: or equivalent.
                    960: This requires the
                    961: .Xr mkisofs 1
                    962: utility, which is not part of
                    963: .Nx ,
                    964: but which can be installed from
1.43      apb       965: .Pa pkgsrc/sysutils/cdrtools .
1.42      apb       966: .
1.1       lukem     967: .It Sy regression-tests
                    968: Can only be run after building the regression tests in the directory
                    969: .Dq regress .
                    970: Runs the compiled regression tests on the local host.
                    971: .
                    972: .El
                    973: .
                    974: .Ss The \*qbuild.sh\*q script
                    975: .
                    976: This script file is a Bourne shell script designed to build the
                    977: entire
                    978: .Nx
                    979: system on any host with a Bourne shell in
                    980: .Sy /bin/sh ,
1.6       wiz       981: including many that are not POSIX compliant.
                    982: Note that if a host system's
1.1       lukem     983: .Sy /bin/sh
                    984: is unusually old and broken, the Korn Shell
                    985: .Sy ( /bin/ksh ) ,
                    986: if available, may be a usable alternative.
                    987: .Pp
                    988: All cross-compile builds, and most native builds, of the entire system
                    989: should make use of
                    990: .Sy build.sh
                    991: rather than just running
                    992: .Dq make .
                    993: This way, the
                    994: .Xr make 1
                    995: program will be bootstrapped properly, in case the host system has an
                    996: older or incompatible
                    997: .Dq make
                    998: program.
                    999: .Pp
                   1000: When compiling the entire system via
                   1001: .Sy build.sh ,
                   1002: many
                   1003: .Xr make 1
                   1004: variables are set for you in order to help encapsulate the build
1.6       wiz      1005: process.
                   1006: In the list of options below, variables that are automatically set by
1.1       lukem    1007: .Sy build.sh
                   1008: are noted where applicable.
1.9       lukem    1009: .
1.1       lukem    1010: .Pp
1.9       lukem    1011: The following operations are supported by
1.1       lukem    1012: .Sy build.sh :
                   1013: .
1.9       lukem    1014: .Bl -tag -width "distribution"
                   1015: .
                   1016: .It Sy build
                   1017: Build the system as per
                   1018: .Dq make build .
                   1019: This option implies the
                   1020: .Sy obj
                   1021: and
                   1022: .Sy tools
                   1023: operations.
                   1024: .
                   1025: .It Sy distribution
                   1026: Build a full distribution as per
                   1027: .Dq make distribution .
                   1028: This option implies the
                   1029: .Sy build
                   1030: operation.
                   1031: .
                   1032: .It Sy release
                   1033: Build a full release as per
                   1034: .Dq make release .
                   1035: This option implies the
                   1036: .Sy distribution
                   1037: operation.
                   1038: .
1.10      lukem    1039: .It Sy makewrapper
                   1040: Create the
1.13      lukem    1041: .Sy \*[toolprefix]make-MACHINE
1.10      lukem    1042: wrapper.
                   1043: This operation is automatically performed for any of the other
                   1044: operations.
                   1045: .
1.9       lukem    1046: .It Sy obj
                   1047: Perform
                   1048: .Dq make obj .
1.11      lukem    1049: .
1.9       lukem    1050: .It Sy tools
                   1051: Build and install the host tools from
                   1052: .Pa src/tools .
1.22      lukem    1053: .
                   1054: .It Sy install Ns = Ns Ar idir
                   1055: Install the contents of
                   1056: .Sy DESTDIR
                   1057: to
                   1058: .Ar idir ,
                   1059: using
                   1060: .Dq make installworld .
1.46.2.1! bouyer   1061: Note that files that are part of the
        !          1062: .Dq etc
        !          1063: or
        !          1064: .Dq xetc
        !          1065: sets will not be installed.
1.22      lukem    1066: .
1.9       lukem    1067: .It Sy kernel Ns = Ns Ar kconf
                   1068: Build a new kernel.
                   1069: The
                   1070: .Ar kconf
                   1071: argument is the name of a configuration file suitable
                   1072: for use by
1.39      peter    1073: .Xr config 1 .
1.9       lukem    1074: If
                   1075: .Ar kconf
                   1076: does not contain any
                   1077: .Sq /
                   1078: characters, the configuration file is expected to be found in the
                   1079: .Sy KERNCONFDIR
                   1080: directory, which is typically
                   1081: .Sy sys/arch/MACHINE/conf .
                   1082: The new kernel will be built in a subdirectory of
                   1083: .Sy KERNOBJDIR ,
                   1084: which is typically
                   1085: .Sy sys/arch/MACHINE/compile
                   1086: or an associated object directory.
                   1087: In order to ensure that the kernel is built using up-to-date tools,
                   1088: it is strongly recommended that the tools be rebuilt (using the
                   1089: .Sy tools
                   1090: operation).
                   1091: .
1.22      lukem    1092: .It Sy releasekernel Ns = Ns Ar kconf
                   1093: Install a
                   1094: .Xr gzip 1 Ns ed
                   1095: copy of the kernel built by
                   1096: .Sy kernel Ns = Ns Ar kconf
                   1097: into
                   1098: .Sy RELEASEDIR/MACHINE Ns Pa /binary/kernel ,
                   1099: usually as
                   1100: .Pa netbsd- Ns Ar kconf Ns Pa .gz ,
                   1101: although the
                   1102: .Dq Pa netbsd
                   1103: prefix is determined from the
                   1104: .Dq Sy config
                   1105: directives in
                   1106: .Ar kconf .
1.9       lukem    1107: .
1.11      lukem    1108: .It Sy sets
                   1109: Perform
                   1110: .Dq make sets .
1.18      lukem    1111: .
                   1112: .It Sy sourcesets
                   1113: Perform
                   1114: .Dq make sourcesets .
                   1115: .
1.40      apb      1116: .It Sy syspkgs
                   1117: Perform
                   1118: .Dq make syspkgs .
                   1119: .
1.42      apb      1120: .It Sy iso-image
                   1121: Perform
                   1122: .Dq make iso-image .
                   1123: .
1.9       lukem    1124: .El
                   1125: .
                   1126: .Pp
                   1127: The following command line options alter the behaviour of the
                   1128: .Sy build.sh
                   1129: operations described above:
                   1130: .
1.1       lukem    1131: .Bl -tag -width "-T tools"
                   1132: .
1.4       lukem    1133: .It Fl a Ar arch
1.1       lukem    1134: Set the value of
                   1135: .Sy MACHINE_ARCH
                   1136: to
1.4       lukem    1137: .Ar arch .
1.1       lukem    1138: .
1.4       lukem    1139: .It Fl B Ar buildid
1.1       lukem    1140: Set the value of
                   1141: .Sy BUILDID
                   1142: to
1.4       lukem    1143: .Ar buildid .
1.1       lukem    1144: This will also append the build idenfitier to the name of the
                   1145: .Dq make
                   1146: wrapper script so that the resulting name is of the form
1.13      lukem    1147: .Dq Sy \*[toolprefix]make-MACHINE-BUILDID .
1.1       lukem    1148: .
1.4       lukem    1149: .It Fl D Ar dest
                   1150: Set the value of
                   1151: .Sy DESTDIR
                   1152: to
                   1153: .Ar dest .
1.46      apb      1154: If a relative path is specified, it will be converted to an
                   1155: absolute path before being used.
1.4       lukem    1156: .
1.5       lukem    1157: .It Fl E
                   1158: Set
                   1159: .Sq expert
1.10      lukem    1160: mode.
                   1161: This overrides various sanity checks, and allows:
1.5       lukem    1162: .Sy DESTDIR
1.10      lukem    1163: does not have to be set to a non-root path for builds,
                   1164: and
1.25      lukem    1165: .Sy MKUNPRIVED=yes
1.10      lukem    1166: does not have to be set when building as a non-root user.
                   1167: .Pp
                   1168: .Em Note :
                   1169: It is highly recommended that you know what you are doing when
                   1170: you use this option.
1.7       lukem    1171: .
1.36      wiz      1172: .It Fl h
                   1173: Print a help message.
                   1174: .
1.4       lukem    1175: .It Fl j Ar njob
1.1       lukem    1176: Passed through to
                   1177: .Xr make 1 .
                   1178: Makefiles should use .WAIT or have explicit dependancies
                   1179: as necessary to enforce build ordering.
                   1180: If you see build failures with -j, please save complete build logs
                   1181: so the failures can be analyzed.
                   1182: .
1.4       lukem    1183: .It Fl M Ar obj
                   1184: Set
                   1185: .Sy MAKEOBJDIRPREFIX
                   1186: to
                   1187: .Ar obj .
1.46      apb      1188: If a relative path is specified, it will be converted to an
                   1189: absolute path before being used.
1.27      lukem    1190: Unsets
                   1191: .Sy MAKEOBJDIR .
1.4       lukem    1192: .
                   1193: .It Fl m Ar mach
1.1       lukem    1194: Set the value of
                   1195: .Sy MACHINE
                   1196: to
1.4       lukem    1197: .Ar mach .
1.1       lukem    1198: This will also override any value of
                   1199: .Sy MACHINE_ARCH
                   1200: in the process environment with a value deduced from
1.4       lukem    1201: .Ar mach ,
1.1       lukem    1202: unless
1.4       lukem    1203: .Fl a
1.20      lukem    1204: is specified, or
                   1205: .Ar mach
                   1206: is a special case listed below.
1.6       wiz      1207: All cross builds require
1.4       lukem    1208: .Fl m ,
1.1       lukem    1209: but if unset on a NetBSD host, the host's value of MACHINE will be
                   1210: detected and used automatically.
1.20      lukem    1211: .Pp
                   1212: Some machines support multiple values for
                   1213: .Sy MACHINE_ARCH .
                   1214: For a given value of
                   1215: .Ar mach ,
                   1216: the following
                   1217: .Sy MACHINE
                   1218: and
                   1219: .Sy MACHINE_ARCH
                   1220: values will result:
                   1221: .Bl -column "evbmips-el" "MACHINE" "MACHINE_ARCH" -offset indent
1.24      lukem    1222: .It Sy mach Ta Sy "MACHINE" Ta Sy "MACHINE_ARCH"
1.20      lukem    1223: .It evbmips Ta evbmips Ta (not set)
                   1224: .It evbmips-eb Ta evbmips Ta mipseb
                   1225: .It evbmips-el Ta evbmips Ta mipsel
                   1226: .It evbsh3 Ta evbsh3 Ta (not set)
                   1227: .It evbsh3-eb Ta evbsh3 Ta sh3eb
                   1228: .It evbsh3-el Ta evbsh3 Ta sh3el
                   1229: .It sbmips Ta sbmips Ta (not set)
                   1230: .It sbmips-eb Ta sbmips Ta mipseb
                   1231: .It sbmips-el Ta sbmips Ta mipsel
1.30      lukem    1232: .El
                   1233: .
                   1234: .It Fl N Ar noiselevel
                   1235: Set the
                   1236: .Dq noisyness
1.31      lukem    1237: level of the build, by setting
                   1238: .Sy MAKEVERBOSE
                   1239: to
                   1240: .Ar noiselevel .
1.1       lukem    1241: .
1.4       lukem    1242: .It Fl n
1.1       lukem    1243: Show the commands that would be executed by
                   1244: .Sy build.sh ,
1.6       wiz      1245: but do not make any changes.
                   1246: This is similar in concept to
1.1       lukem    1247: .Dq make -n .
                   1248: .
1.4       lukem    1249: .It Fl O Ar obj
1.1       lukem    1250: Create an appropriate transform macro for
                   1251: .Sy MAKEOBJDIR
                   1252: that will place the built object files under
1.4       lukem    1253: .Ar obj .
1.46      apb      1254: If a relative path is specified, it will be converted to an
                   1255: absolute path before being used.
1.1       lukem    1256: For instance, a setting of
                   1257: .Sy /usr/obj
                   1258: will place build-time files under
1.27      lukem    1259: .Sy /usr/obj/bin ,
                   1260: .Sy /usr/obj/lib ,
                   1261: .Sy /usr/obj/usr.bin ,
1.1       lukem    1262: and so forth.
1.27      lukem    1263: Unsets
                   1264: .Sy MAKEOBJDIRPREFIX .
1.1       lukem    1265: .
1.4       lukem    1266: .It Fl o
                   1267: Set the value of
                   1268: .Sy MKOBJDIRS
                   1269: to
                   1270: .Dq no .
1.21      lukem    1271: Otherwise, it will be automatically set to
                   1272: .Dq yes
                   1273: (which is opposite to the default behaviour).
1.4       lukem    1274: .
                   1275: .It Fl R Ar rel
1.1       lukem    1276: Set the value of
                   1277: .Sy RELEASEDIR
                   1278: to
1.4       lukem    1279: .Ar rel .
1.46      apb      1280: If a relative path is specified, it will be converted to an
                   1281: absolute path before being used.
1.1       lukem    1282: .
1.4       lukem    1283: .It Fl r
                   1284: Remove the contents of
                   1285: .Sy DESTDIR
                   1286: and
                   1287: .Sy TOOLDIR
1.6       wiz      1288: before building (provides a clean starting point).
                   1289: This will skip deleting
1.4       lukem    1290: .Sy DESTDIR
                   1291: if building on a native system to the root directory.
                   1292: .
                   1293: .It Fl T Ar tools
1.1       lukem    1294: Set the value of
                   1295: .Sy TOOLDIR
                   1296: to
1.4       lukem    1297: .Ar tools .
1.46      apb      1298: If a relative path is specified, it will be converted to an
                   1299: absolute path before being used.
1.1       lukem    1300: If set, the bootstrap
                   1301: .Dq make
                   1302: will only be rebuilt as needed (when the source files for
                   1303: .Xr make 1
                   1304: change).
                   1305: .
1.4       lukem    1306: .It Fl U
1.25      lukem    1307: Set
                   1308: .Sy MKUNPRIVED=yes .
1.1       lukem    1309: .
1.4       lukem    1310: .It Fl u
1.25      lukem    1311: Set
                   1312: .Sy MKUPDATE=yes .
1.8       lukem    1313: .
                   1314: .It Xo
                   1315: .Fl V
                   1316: .Sm off
                   1317: .Ar var
                   1318: .Li =
                   1319: .Op Ar value
                   1320: .Sm on
                   1321: .Xc
1.27      lukem    1322: Set the environment variable
1.8       lukem    1323: .Ar var
1.27      lukem    1324: to an optional
                   1325: .Ar value .
                   1326: This is propagated to the
                   1327: .Sy \*[toolprefix]make
                   1328: wrapper.
1.4       lukem    1329: .
                   1330: .It Fl w Ar wrapper
1.27      lukem    1331: Create the
                   1332: .Sy \*[toolprefix]make
                   1333: wrapper script (see below) in a custom location,
1.4       lukem    1334: specified by
                   1335: .Ar wrapper .
                   1336: This allows, for instance, to place the wrapper in
                   1337: .Sy PATH
1.6       wiz      1338: automatically.
                   1339: Note that
1.4       lukem    1340: .Ar wrapper
                   1341: is the full name of the file, not just a directory name.
1.46      apb      1342: If a relative path is specified, it will be converted to an
                   1343: absolute path before being used.
1.4       lukem    1344: .
1.34      lukem    1345: .It Fl X Ar x11src
                   1346: Set the value of
                   1347: .Sy X11SRCDIR
                   1348: to
                   1349: .Ar x11src .
1.46      apb      1350: If a relative path is specified, it will be converted to an
                   1351: absolute path before being used.
1.34      lukem    1352: .
                   1353: .It Fl x
                   1354: Set
                   1355: .Sy MKX11=yes .
                   1356: .
1.27      lukem    1357: .It Fl Z Ar var
                   1358: Unset ("zap") the environment variable
                   1359: .Ar var .
                   1360: This is propagated to the
                   1361: .Sy \*[toolprefix]make
                   1362: wrapper.
                   1363: .
1.1       lukem    1364: .El
                   1365: .
1.13      lukem    1366: .Ss The \*q\*[toolprefix]make-MACHINE\*q wrapper script
1.1       lukem    1367: .
                   1368: If using the
                   1369: .Sy build.sh
                   1370: script to build
                   1371: .Nx ,
                   1372: a
1.13      lukem    1373: .Sy \*[toolprefix]make-MACHINE
1.1       lukem    1374: script will be created in
                   1375: .Sy TOOLDIR/bin
                   1376: upon the first build to assist in building subtrees on a cross-compile
                   1377: host.
                   1378: .Pp
1.13      lukem    1379: .Sy \*[toolprefix]make-MACHINE
1.1       lukem    1380: can be invoked in lieu of
                   1381: .Xr make 1 ,
                   1382: and will instead call the up-to-date version of
1.13      lukem    1383: .Dq \*[toolprefix]make
1.1       lukem    1384: installed into
                   1385: .Sy TOOLDIR/bin
                   1386: with several key variables pre-set, including
                   1387: .Sy MACHINE , MACHINE_ARCH ,
                   1388: and
                   1389: .Sy TOOLDIR .
1.27      lukem    1390: .Sy build.sh
                   1391: will also set variables specified with
                   1392: .Fl V ,
                   1393: and unset variables specified with
                   1394: .Fl Z .
                   1395: .Pp
1.1       lukem    1396: This script can be symlinked into a directory listed in
                   1397: .Sy PATH ,
                   1398: or called with an absolute path.
1.2       lukem    1399: .
                   1400: .Sh EXAMPLES
1.10      lukem    1401: .
1.15      lukem    1402: .Bl -enum
1.9       lukem    1403: .
1.15      lukem    1404: .It
1.29      lukem    1405: .Li "% ./build.sh tools kernel=GENERIC"
1.15      lukem    1406: .Pp
1.2       lukem    1407: Build a new toolchain, and use the new toolchain to
                   1408: configure and build a new GENERIC kernel.
1.9       lukem    1409: .
1.15      lukem    1410: .It
1.29      lukem    1411: .Li "% ./build.sh -U distribution"
1.15      lukem    1412: .Pp
1.2       lukem    1413: Using unprivileged mode,
1.17      lukem    1414: build a complete distribution to a
                   1415: .Sy DESTDIR
                   1416: directory that
                   1417: .Sy build.sh
                   1418: selects (and will display).
1.9       lukem    1419: .
1.15      lukem    1420: .It
1.17      lukem    1421: .Li "# ./build.sh -U install=/"
1.15      lukem    1422: .Pp
1.16      lukem    1423: As root, install to
                   1424: .Pa /
                   1425: the distribution that was built
                   1426: by example 2.
1.15      lukem    1427: Even though this is run as root,
1.9       lukem    1428: .Fl U
                   1429: is required so that the permissions stored in
1.17      lukem    1430: .Sy DESTDIR Ns Pa /METALOG
1.9       lukem    1431: are correctly applied to the files as they're copied to
1.15      lukem    1432: .Pa / .
1.9       lukem    1433: .
1.15      lukem    1434: .It
1.29      lukem    1435: .Li "% ./build.sh -U -u release"
1.15      lukem    1436: .Pp
1.2       lukem    1437: Using unprivileged mode,
1.17      lukem    1438: build a complete release to
                   1439: .Sy DESTDIR
                   1440: and
                   1441: .Sy RELEASEDIR
                   1442: directories that
                   1443: .Sy build.sh
                   1444: selects (and will display).
1.25      lukem    1445: .Sy MKUPDATE=yes
1.15      lukem    1446: .Pq Fl u
                   1447: is set to prevent the
                   1448: .Dq make cleandir ,
                   1449: so that if this is run after example 2, it doesn't need to redo that
                   1450: portion of the release build.
1.2       lukem    1451: .El
1.1       lukem    1452: .
                   1453: .Sh OBSOLETE VARIABLES
                   1454: .
                   1455: .Bl -tag -width "NBUILDJOBS"
                   1456: .
                   1457: .It Sy NBUILDJOBS
                   1458: Use the
                   1459: .Xr make 1
                   1460: option
1.4       lukem    1461: .Fl j ,
1.1       lukem    1462: instead.
                   1463: .
                   1464: .It Sy USE_NEW_TOOLCHAIN
                   1465: The new toolchain is now the default.
                   1466: To disable, use
                   1467: .Sy TOOLCHAIN_MISSING=yes .
                   1468: .El
                   1469: .Sh SEE ALSO
                   1470: .Xr make 1 ,
                   1471: .Xr hier 7 ,
1.42      apb      1472: .Xr release 7 ,
1.46.2.1! bouyer   1473: .Xr etcupdate 8 ,
        !          1474: .Xr postinstall 8 ,
1.43      apb      1475: .Pa pkgsrc/sysutils/cdrtools
1.1       lukem    1476: .
                   1477: .Sh HISTORY
                   1478: .
                   1479: The
                   1480: .Nm build.sh
                   1481: based build scheme was introduced for
                   1482: .Nx 1.6
                   1483: as
                   1484: .Sy USE_NEW_TOOLCHAIN ,
                   1485: and re-worked to
                   1486: .Sy TOOLCHAIN_MISSING
                   1487: after that.
                   1488: .
                   1489: .Sh BUGS
                   1490: .
                   1491: A few platforms are not yet using this build system.

CVSweb <webmaster@jp.NetBSD.org>