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

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

1.102   ! apb         1: .\"    $NetBSD: BUILDING.mdoc,v 1.101 2014/08/03 09:24:08 apb Exp $
1.1       lukem       2: .\"
1.82      apb         3: .\" Copyright (c) 2001-2011 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: .\"
                     18: .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
                     19: .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
                     20: .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
                     21: .\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
                     22: .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
                     23: .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
                     24: .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
                     25: .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
                     26: .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
                     27: .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
                     28: .\" POSSIBILITY OF SUCH DAMAGE.
                     29: .\"
1.84      apb        30: .\" NOTE: After changing this file, run "make regen" in the src/doc
                     31: .\" directory, and check in both src/BUILDING and src/doc/BUILDING.mdoc.
1.1       lukem      32: .\"
1.13      lukem      33: .\" Toolchain prefix for commands
                     34: .ds toolprefix nb
                     35: .
1.102   ! apb        36: .Dd August 3, 2014
1.1       lukem      37: .Dt BUILDING 8
                     38: .Os NetBSD
                     39: .
                     40: .Sh NAME
                     41: .
                     42: .Nm BUILDING
                     43: .Nd Procedure for building
                     44: .Nx
                     45: from source code.
                     46: .
                     47: .Sh REQUIREMENTS
                     48: .
                     49: .Nx
                     50: is designed to be buildable on most POSIX-compliant host systems.
                     51: The basic build procedure is the same whether compiling
                     52: .Em natively
                     53: (on the same
                     54: .Nx
                     55: architecture) or
                     56: .Em cross compiling
                     57: (on another architecture or OS).
                     58: .Pp
                     59: This source tree contains a special subtree,
                     60: .Dq tools ,
                     61: which uses the host system to create a build toolchain for the target
1.6       wiz        62: architecture.
                     63: The host system must have at least C and C++
1.1       lukem      64: compilers in order to create the toolchain
                     65: .Nm ( make
                     66: is not required); all other tools are created as part of the
                     67: .Nx
                     68: build process.
1.38      reed       69: (See the environment variables section below if you need
                     70: to override or manually select your compilers.)
1.1       lukem      71: .
                     72: .Sh FILES
                     73: .
                     74: .Ss Source tree layout
                     75: .
                     76: .Bl -tag -width "BUILDING.mdoc"
1.99      wiz        77: .It Pa doc/BUILDING.mdoc
1.1       lukem      78: This document (in -mdoc troff format; the original copy).
1.99      wiz        79: .It Pa BUILDING
1.1       lukem      80: This document (in plaintext).
1.99      wiz        81: .It Pa tools/compat/README
1.33      jmc        82: Special notes for cross-hosting a NetBSD build on non-NetBSD platforms.
1.99      wiz        83: .It Pa Makefile
1.1       lukem      84: The main Makefile for
                     85: .Nx ;
                     86: should only be run for native builds with an appropriately up-to-date
                     87: version of
                     88: .Nx
                     89: .Xr make 1 .
                     90: (For building from out-of-date systems or on a non-native host, see the
                     91: .Nm build.sh
                     92: shell script.)
1.99      wiz        93: .It Pa UPDATING
1.1       lukem      94: Special notes for updating from an earlier revision of
                     95: .Nx .
                     96: It is important to read this file before every build of an updated
                     97: source tree.
1.99      wiz        98: .It Pa build.sh
1.1       lukem      99: Bourne-compatible shell script used for building the host build tools
                    100: and the
                    101: .Nx
1.6       wiz       102: system from scratch.
                    103: Can be used for both native and cross builds, and should be used instead of
1.1       lukem     104: .Xr make 1
                    105: for any source tree that is updated and recompiled regularly.
1.99      wiz       106: .It Pa crypto/dist/ , dist/ , gnu/dist/
1.1       lukem     107: Sources imported verbatim from third parties, without mangling the
1.6       wiz       108: existing build structure.
                    109: Other source trees in
1.1       lukem     110: .Sy bin
                    111: through
                    112: .Sy usr.sbin
                    113: use the
                    114: .Nx
                    115: .Xr make 1
                    116: .Dq reachover
                    117: Makefile semantics when building these programs for a native host.
1.99      wiz       118: .It Pa external , sys/external
1.96      martin    119: Sources and build infrastructure for components imported (mostly) unchanged
                    120: from upstream maintainers, sorted by applicable license.
1.99      wiz       121: This is (slowly) replacing the
                    122: .Pa crypto/dist ,
                    123: .Pa dist ,
                    124: and
                    125: .Pa gnu/dist
                    126: directories.
                    127: .It Pa distrib/ , etc/
1.1       lukem     128: Sources for items used when making a full release snapshot, such as
                    129: files installed in
1.14      lukem     130: .Sy DESTDIR Ns Pa /etc
1.1       lukem     131: on the destination system, boot media, and release notes.
1.99      wiz       132: .It Pa tests/ , regress/
1.6       wiz       133: Regression test harness.
                    134: Can be cross-compiled, but only run natively.
1.57      dholland  135: .Pa tests/
                    136: uses the
                    137: .Xr atf 7
                    138: test framework;
                    139: .Pa regress/
                    140: contains older tests that have not yet been migrated to
                    141: .Xr atf 7 .
1.99      wiz       142: .It Pa sys/
1.1       lukem     143: .Nx
                    144: kernel sources.
1.99      wiz       145: .It Pa tools/
1.1       lukem     146: .Dq Reachover
1.6       wiz       147: build structure for the host build tools.
                    148: This has a special method of determining out-of-date status.
1.99      wiz       149: .It Pa bin/ ... usr.sbin/
1.1       lukem     150: Sources to the
                    151: .Nx
1.6       wiz       152: userland (non-kernel) programs.
                    153: If any of these directories are missing, they will be skipped during the build.
1.99      wiz       154: .It Pa x11/
1.34      lukem     155: .Dq Reachover
                    156: build structure for X11R6; the source is in
                    157: .Sy X11SRCDIR .
1.1       lukem     158: .El
                    159: .
                    160: .Ss Build tree layout
                    161: .
                    162: The
                    163: .Nx
                    164: build tree is described in
                    165: .Xr hier 7 ,
                    166: and the release layout is described in
                    167: .Xr release 7 .
                    168: .
                    169: .Sh CONFIGURATION
                    170: .
                    171: .Ss Environment variables
1.94      wiz       172: .
1.1       lukem     173: Several environment variables control the behaviour of
                    174: .Nx
                    175: builds.
                    176: .
                    177: .Bl -tag -width "MAKEOBJDIRPREFIX"
                    178: .
1.38      reed      179: .
1.44      apb       180: .It Sy HOST_SH
1.85      apb       181: Path name to a shell available on the host system
                    182: and suitable for use during the build.
                    183: The
                    184: .Nx
                    185: build system requires a modern Bourne-like shell
                    186: with POSIX-compliant features,
                    187: and also requires support for the
                    188: .Dq local
                    189: keyword to declare local variables in shell functions
                    190: (which is a widely-implemented but non-standardised feature).
                    191: .Pp
                    192: Depending on the host system, a suitable shell may be
                    193: .Pa /bin/sh ,
                    194: .Pa /usr/xpg4/bin/sh ,
                    195: .Pa /bin/ksh
                    196: (provided it is a variant of ksh that supports the
                    197: .Dq local
                    198: keyword,
                    199: such as ksh88, but not ksh93),
                    200: or
                    201: .Pa /usr/local/bin/bash .
                    202: .Pp
                    203: Most parts of the build require
                    204: .Sy HOST_SH
                    205: to be an absolute path; however,
1.44      apb       206: .Nm build.sh
1.85      apb       207: allows it to be a simple command name, which will be converted
                    208: to an absolute path by searching the
1.44      apb       209: .Sy PATH .
                    210: .
1.38      reed      211: .It Sy HOST_CC
                    212: Path name to C compiler used to create the toolchain.
                    213: .
                    214: .It Sy HOST_CXX
                    215: Path name to C++ compiler used to create the toolchain.
                    216: .
1.1       lukem     217: .It Sy MACHINE
1.57      dholland  218: Machine type, e.g.,
                    219: .Dq macppc .
1.1       lukem     220: .
                    221: .It Sy MACHINE_ARCH
1.57      dholland  222: Machine architecture, e.g.,
                    223: .Dq powerpc .
1.1       lukem     224: .
                    225: .It Sy MAKE
                    226: Path name to invoke
                    227: .Xr make 1
                    228: as.
                    229: .
                    230: .It Sy MAKEFLAGS
                    231: Flags to invoke
                    232: .Xr make 1
                    233: with.
1.82      apb       234: Note that
                    235: .Sy build.sh
                    236: ignores the value of
                    237: .Sy MAKEFLAGS
                    238: passed in the environment, but allows
                    239: .Sy MAKEFLAGS
                    240: to be set via the
                    241: .Fl V
                    242: option.
1.1       lukem     243: .
                    244: .It Sy MAKEOBJDIR
                    245: Directory to use as the
                    246: .Sy .OBJDIR
                    247: for the current directory.
1.46      apb       248: The value is subjected to variable expansion by
                    249: .Xr make 1 .
1.61      apb       250: Typical usage is to set this variable to a value involving the use of
                    251: .Sq ${.CURDIR:S...}
                    252: or
                    253: .Sq ${.CURDIR:C...} ,
                    254: to derive the value of
                    255: .Sy .OBJDIR
                    256: from the value of
                    257: .Sy .CURDIR .
1.1       lukem     258: Used only if
                    259: .Sy MAKEOBJDIRPREFIX
                    260: is not defined.
                    261: .Sy MAKEOBJDIR
1.61      apb       262: can be provided only in the environment or via the
1.28      lukem     263: .Fl O
1.23      lukem     264: flag of
1.61      apb       265: .Nm build.sh ;
1.71      mrg       266: it cannot usefully be set inside a Makefile, including
                    267: .Pa mk.conf
                    268: or
                    269: .Sy ${MAKECONF} .
1.1       lukem     270: .
                    271: .It Sy MAKEOBJDIRPREFIX
                    272: Top level directory of the object directory tree.
1.77      apb       273: The value is subjected to variable expansion by
                    274: .Xr make 1 .
                    275: .Sy build.sh
                    276: will create the
                    277: ${MAKEOBJDIRPREFIX}
                    278: directory if necessary, but if
                    279: .Xr make 1
                    280: is used without
                    281: .Sy build.sh ,
                    282: then rules in
                    283: .Aq bsd.obj.mk
                    284: will abort the build if the
                    285: ${MAKEOBJDIRPREFIX}
                    286: directory does not exist.
                    287: If the value is defined and valid, then
1.1       lukem     288: ${MAKEOBJDIRPREFIX}/${.CURDIR}
                    289: is used as the
                    290: .Sy .OBJDIR
                    291: for the current directory.
                    292: The current directory may be read only.
                    293: .Sy MAKEOBJDIRPREFIX
1.61      apb       294: can be provided only in the environment or via the
1.23      lukem     295: .Fl M
                    296: flag of
1.61      apb       297: .Nm build.sh ;
1.91      abs       298: it cannot usefully be set inside a Makefile, including
1.71      mrg       299: .Pa mk.conf
                    300: or
                    301: .Sy ${MAKECONF} .
1.1       lukem     302: .
                    303: .El
                    304: .
                    305: .Ss \*qmake\*q variables
                    306: .
                    307: .de YorN
                    308: Can be set to
                    309: .Dq yes
                    310: or
                    311: .Dq no .
                    312: ..
                    313: .de DFLT
                    314: .Pp
                    315: .Em Default :
                    316: ..
                    317: .de DFLTu
                    318: .DFLT
                    319: Unset.
                    320: ..
                    321: .de DFLTy
                    322: .DFLT
                    323: .Dq yes
                    324: ..
                    325: .de DFLTn
                    326: .DFLT
                    327: .Dq no
                    328: ..
                    329: Several variables control the behavior of
                    330: .Nx
1.6       wiz       331: builds.
                    332: Unless otherwise specified, these variables may be set in
1.1       lukem     333: either the process environment or the
                    334: .Xr make 1
                    335: configuration file specified by
                    336: .Sy MAKECONF .
                    337: .
                    338: .Bl -tag -width "MKCATPAGES"
                    339: .
                    340: .It Sy BUILDID
1.6       wiz       341: Identifier for the build.
1.100     apb       342: If set, this should be a short string that is suitable for use as
                    343: part of a file or directory name.
1.6       wiz       344: The identifier will be appended to
1.1       lukem     345: object directory names, and can be consulted in the
                    346: .Xr make 1
                    347: configuration file in order to set additional build parameters,
                    348: such as compiler flags.
1.100     apb       349: It will also be used as part of the kernel version string,
                    350: which can be printed by
                    351: .Dq Li uname \-v .
                    352: .DFLTu
1.1       lukem     353: .
1.101     apb       354: .It Sy BUILDINFO
                    355: This may be a multi-line string containing information about the build.
                    356: This will appear in
                    357: .Sy DESTDIR Ns Pa /etc/release ,
                    358: and it will be stored in the
                    359: .Va buildinfo
                    360: variable in any kernels that are built.
                    361: When such kernels are booted, the
                    362: .Xr sysctl 7
                    363: .Va kern.buildinfo
                    364: variable will report this value.
                    365: The string may contain backslash escape sequences, such as
                    366: .Dq "\e\e"
                    367: (representing a backslash character)
                    368: and
                    369: .Dq "\en"
                    370: (representing a newline).
                    371: .DFLTu
                    372: .
1.60      perry     373: .It Sy BUILDSEED
                    374: GCC uses random numbers when compiling C++ code.
                    375: This variable seeds the gcc random number generator using
                    376: the -frandom-seed flag with this value.
                    377: By default, it is set to NetBSD-(majorversion).
                    378: Using a fixed value causes C++ binaries to be the same when
1.74      hubertf   379: built from the same sources, resulting in identical (reproducible) builds.
1.60      perry     380: Additional information is available in the GCC
                    381: documentation of -frandom-seed.
                    382: .
1.1       lukem     383: .It Sy DESTDIR
                    384: Directory to contain the built
                    385: .Nx
1.6       wiz       386: system.
                    387: If set, special options are passed to the compilation tools to
1.1       lukem     388: prevent their default use of the host system's
1.99      wiz       389: .Pa /usr/include , /usr/lib ,
1.6       wiz       390: and so forth.
1.46      apb       391: This pathname must be an absolute path, and should
1.1       lukem     392: .Em not
                    393: end with a slash
                    394: .Pq /
1.46      apb       395: character.
                    396: (For installation into the system's root directory, set
1.1       lukem     397: .Sy DESTDIR
1.46      apb       398: to an empty string, not to
                    399: .Dq / ) .
1.1       lukem     400: The directory must reside on a file system which supports long file
                    401: names and hard links.
                    402: .DFLT
                    403: Empty string if
                    404: .Sy USETOOLS
                    405: is
                    406: .Dq yes ;
                    407: unset otherwise.
1.17      lukem     408: .Pp
                    409: .Em Note :
                    410: .Sy build.sh
                    411: will provide a default of
                    412: .Pa destdir. Ns Sy MACHINE
                    413: (in the top-level
                    414: .Sy .OBJDIR )
                    415: unless run in
                    416: .Sq expert
1.57      dholland  417: mode.
1.1       lukem     418: .
                    419: .It Sy MAKECONF
                    420: The name of the
                    421: .Xr make 1
                    422: configuration file.
                    423: .Em Only settable in the process environment.
                    424: .DFLT
                    425: .Dq /etc/mk.conf
                    426: .
1.30      lukem     427: .It Sy MAKEVERBOSE
                    428: Level of verbosity of status messages.
                    429: Supported values:
                    430: .Bl -tag -width xxx
                    431: .It 0
1.69      apb       432: No descriptive messages or commands executed by
                    433: .Xr make 1
                    434: are shown.
1.30      lukem     435: .It 1
1.69      apb       436: Brief messages are shown describing what is being done,
                    437: but the actual commands executed by
                    438: .Xr make 1
                    439: are not displayed.
1.30      lukem     440: .It 2
1.69      apb       441: Descriptive messages are shown as above (prefixed with a
                    442: .Sq # ) ,
                    443: and ordinary commands performed by
                    444: .Xr make 1
                    445: are displayed.
                    446: .It 3
                    447: In addition to the above, all commands performed by
                    448: .Xr make 1
                    449: are displayed, even if they would ordinarily have been hidden
                    450: through use of the
                    451: .Dq \&@
                    452: prefix in the relevant makefile.
                    453: .It 4
                    454: In addition to the above, commands executed by
                    455: .Xr make 1
                    456: are traced through use of the
                    457: .Xr sh 1
                    458: .Dq Fl x
                    459: flag.
1.30      lukem     460: .El
                    461: .DFLT
                    462: 2
                    463: .
1.1       lukem     464: .It Sy MKCATPAGES
                    465: .YorN
                    466: Indicates whether preformatted plaintext manual pages will be created
                    467: during a build.
1.93      dholland  468: .DFLTn
1.1       lukem     469: .
1.98      martin    470: .It Sy MKCROSSGDB
                    471: .YorN
                    472: Create a cross-gdb as a host tool.
                    473: .DFLTn
                    474: .
1.1       lukem     475: .It Sy MKCRYPTO
                    476: .YorN
                    477: Indicates whether cryptographic code will be included in a build;
                    478: provided for the benefit of countries that do not allow strong
1.6       wiz       479: cryptography.
                    480: Will not affect use of the standard low-security password encryption system,
1.1       lukem     481: .Xr crypt 3 .
                    482: .DFLTy
                    483: .
1.97      martin    484: .It Sy MKDEBUG
                    485: .YorN
                    486: Indicates whether debug information should be generated for all userland
                    487: binaries compiled.
                    488: The result is collected as an additional
                    489: .Sy debug.tgz
                    490: and
                    491: .Sy xdebug.tgz
                    492: set and installed in
                    493: .Pa /usr/libdata/debug .
                    494: .DFLTn
                    495: .
                    496: .It Sy MKDEBUGLIB
                    497: .YorN
1.99      wiz       498: Indicates whether debug information (see
1.97      martin    499: .Sy MKDEBUG )
                    500: should also be generated for all libraries build.
                    501: .DFLTn
                    502: .
1.1       lukem     503: .It Sy MKDOC
                    504: .YorN
                    505: Indicates whether system documentation destined for
1.14      lukem     506: .Sy DESTDIR Ns Pa /usr/share/doc
1.1       lukem     507: will be installed during a build.
                    508: .DFLTy
                    509: .
1.65      lukem     510: .It Sy MKHTML
                    511: .YorN
                    512: Indicates whether preformatted HTML manual pages will be built
                    513: and installed
                    514: .DFLTy
                    515: .
1.1       lukem     516: .It Sy MKHOSTOBJ
                    517: .YorN
                    518: If set to
                    519: .Dq yes ,
                    520: then for programs intended to be run on the compile host,
                    521: the name, release, and architecture of the host operating system
                    522: will be suffixed to the name of the object directory created by
                    523: .Dq make obj .
                    524: (This allows multiple host systems to compile NetBSD for a single target.)
                    525: If set to
                    526: .Dq no ,
                    527: then programs built to be run on the compile host will use the same
                    528: object directory names as programs built to be run on the target.
                    529: .DFLTn
                    530: .
                    531: .It Sy MKINFO
                    532: .YorN
                    533: Indicates whether GNU Info files, used for the documentation for
                    534: most of the compilation tools, will be created and installed during a
                    535: build.
                    536: .DFLTy
                    537: .
1.98      martin    538: .It Sy MKKDEBUG
                    539: .YorN
                    540: Force generation of full-debug symbol versions of all kernels compiled.
                    541: Alongside of the
                    542: .Pa netbsd
                    543: kernel file, an unstripped version
                    544: .Pa netbsd.gdb
                    545: is created.
1.99      wiz       546: This is useful if a cross-gdb is built as well (see
1.98      martin    547: .Sy MKCROSSGDB ) .
                    548: .DFLTn
                    549: .
1.83      apb       550: .It Sy MKKMOD
                    551: .YorN
                    552: Indicates whether kernel modules are built and installed.
                    553: .DFLTy
                    554: .
1.1       lukem     555: .It Sy MKLINT
                    556: .YorN
                    557: Indicates whether
                    558: .Xr lint 1
                    559: will be run against portions of the
                    560: .Nx
                    561: source code during the build, and whether lint libraries will be
                    562: installed into
1.14      lukem     563: .Sy DESTDIR Ns Pa /usr/libdata/lint .
1.1       lukem     564: .DFLTy
                    565: .
                    566: .It Sy MKMAN
                    567: .YorN
                    568: Indicates whether manual pages will be installed during a build.
                    569: .DFLTy
                    570: .
                    571: .It Sy MKNLS
                    572: .YorN
                    573: Indicates whether Native Language System locale zone files will be
                    574: compiled and installed during a build.
                    575: .DFLTy
                    576: .
                    577: .It Sy MKOBJ
                    578: .YorN
                    579: Indicates whether object directories will be created when running
                    580: .Dq make obj .
                    581: If set to
                    582: .Dq no ,
                    583: then all built files will be located inside the regular source tree.
                    584: .DFLTy
1.57      dholland  585: .Pp
                    586: Note that setting
                    587: .Sy MKOBJ
                    588: to
                    589: .Dq no
                    590: is not recommended and may cause problems when updating the tree with
                    591: .Xr cvs 1 .
1.1       lukem     592: .
                    593: .It Sy MKPIC
                    594: .YorN
                    595: Indicates whether shared objects and libraries will be created and
1.6       wiz       596: installed during a build.
                    597: If set to
1.1       lukem     598: .Dq no ,
                    599: the entire built system will be statically linked.
                    600: .DFLT
1.6       wiz       601: Platform dependent.
                    602: As of this writing, all platforms except
1.1       lukem     603: .Sy sh3
                    604: default to
                    605: .Dq yes .
                    606: .
                    607: .It Sy MKPICINSTALL
                    608: .YorN
                    609: Indicates whether the
                    610: .Xr ar 1
                    611: format libraries
                    612: .Sy ( lib*_pic.a ) ,
                    613: used to generate shared libraries, are installed during a build.
                    614: .DFLTy
                    615: .
                    616: .It Sy MKPROFILE
                    617: .YorN
                    618: Indicates whether profiled libraries
                    619: .Sy ( lib*_p.a )
                    620: will be built and installed during a build.
                    621: .DFLT
                    622: .Dq yes ;
                    623: however, some platforms turn off
                    624: .Sy MKPROFILE
                    625: by default at times due to toolchain problems with profiled code.
                    626: .
1.89      wiz       627: .It Sy MKREPRO
                    628: .YorN
                    629: Create reproducable builds.
                    630: This enables different switches to make two builds from the same
                    631: source tree result in the same build results.
                    632: .DFLTn
                    633: .
1.1       lukem     634: .It Sy MKSHARE
                    635: .YorN
                    636: Indicates whether files destined to reside in
1.14      lukem     637: .Sy DESTDIR Ns Pa /usr/share
1.6       wiz       638: will be built and installed during a build.
                    639: If set to
1.1       lukem     640: .Dq no ,
                    641: then all of
                    642: .Sy MKCATPAGES , MKDOC , MKINFO , MKMAN ,
                    643: and
                    644: .Sy MKNLS
                    645: will be set to
                    646: .Dq no
                    647: unconditionally.
                    648: .DFLTy
                    649: .
1.66      joerg     650: .It Sy MKSTRIPIDENT
                    651: .YorN
1.90      abs       652: Indicates whether RCS IDs, for use with
                    653: .Xr ident 1 ,
                    654: should be stripped from program binaries and shared libraries.
1.66      joerg     655: .DFLTn
                    656: .
1.25      lukem     657: .It Sy MKUNPRIVED
                    658: .YorN
                    659: Indicates whether an unprivileged install will occur.
1.1       lukem     660: The user, group, permissions, and file flags, will not be set on
1.37      jmc       661: the installed items; instead the information will be appended to
1.1       lukem     662: a file called
                    663: .Pa METALOG
                    664: in
                    665: .Sy DESTDIR .
                    666: The contents of
                    667: .Pa METALOG
1.37      jmc       668: are used during the generation of the distribution tar files to ensure
1.1       lukem     669: that the appropriate file ownership is stored.
1.25      lukem     670: .DFLTn
1.1       lukem     671: .
1.25      lukem     672: .It Sy MKUPDATE
                    673: .YorN
                    674: Indicates whether all install operations intended to write to
1.1       lukem     675: .Sy DESTDIR
                    676: will compare file timestamps before installing, and skip the install
1.6       wiz       677: phase if the destination files are up-to-date.
                    678: This also has implications on full builds (see next subsection).
1.25      lukem     679: .DFLTn
                    680: .
1.34      lukem     681: .It Sy MKX11
                    682: .YorN
1.68      mrg       683: Indicates whether X11 is built from
1.34      lukem     684: .Sy X11SRCDIR .
                    685: .DFLTn
                    686: .
1.25      lukem     687: .It Sy TOOLDIR
                    688: Directory to hold the host tools, once built.
1.46      apb       689: If specified, must be an absolute path.
1.25      lukem     690: This directory should be unique to a given host system and
                    691: .Nx
                    692: source tree.
                    693: (However, multiple targets may share the same
                    694: .Sy TOOLDIR ;
                    695: the target-dependent files have unique names.)  If unset, a default based
                    696: on the
                    697: .Xr uname 1
                    698: information of the host platform will be created in the
                    699: .Sy .OBJDIR
                    700: of
1.26      lukem     701: .Pa src .
1.1       lukem     702: .DFLTu
                    703: .
                    704: .It Sy USETOOLS
                    705: Indicates whether the tools specified by
                    706: .Sy TOOLDIR
1.6       wiz       707: should be used as part of a build in progress.
                    708: Must be set to
1.1       lukem     709: .Dq yes
                    710: if cross-compiling.
                    711: .Bl -tag -width "never"
                    712: .It Sy yes
                    713: Use the tools from
                    714: .Sy TOOLDIR .
                    715: .It Sy no
                    716: Do not use the tools from
                    717: .Sy TOOLDIR ,
                    718: but refuse to build native compilation tool components that are
                    719: version-specific for that tool.
                    720: .It Sy never
                    721: Do not use the tools from
                    722: .Sy TOOLDIR ,
1.6       wiz       723: even when building native tool components.
                    724: This is similar to the traditional
1.1       lukem     725: .Nx
                    726: build method, but does
                    727: .Em not
                    728: verify that the compilation tools in use are up-to-date enough in order
1.6       wiz       729: to build the tree successfully.
                    730: This may cause build or runtime problems when building the whole
1.1       lukem     731: .Nx
                    732: source tree.
                    733: .El
1.58      dholland  734: .DFLT
                    735: .Dq yes ,
                    736: unless
                    737: .Sy TOOLCHAIN_MISSING
                    738: is set to
                    739: .Dq yes .
                    740: .Pp
                    741: .Sy USETOOLS
                    742: is also set to
                    743: .Dq no
                    744: when using
                    745: .Aq bsd.*.mk
                    746: outside the
                    747: .Nx
                    748: source tree.
1.1       lukem     749: .
1.34      lukem     750: .It Sy X11SRCDIR
                    751: Directory containing the X11R6 source.
1.46      apb       752: If specified, must be an absolute path.
1.34      lukem     753: The main X11R6 source is found in
                    754: .Sy X11SRCDIR Ns Pa /xfree/xc .
                    755: .DFLT
1.80      apb       756: .Sy NETBSDRCDIR Ns Pa /../xsrc ,
                    757: if that exists; otherwise
                    758: .Pa /usr/xsrc .
1.34      lukem     759: .
1.68      mrg       760: .It Sy X11FLAVOUR
                    761: The style of X11 cross-built, set to either
                    762: .Dq Xorg
                    763: or
                    764: .Dq XFree86 .
                    765: .DFLT
                    766: .Dq Xorg
1.70      mrg       767: on amd64, i386, macppc, shark and sparc64 platforms,
1.68      mrg       768: .Dq XFree86
                    769: on everything else.
                    770: .
1.1       lukem     771: .El
                    772: .
                    773: .Ss \*qmake\*q variables for full builds
                    774: These variables only affect the top level
                    775: .Dq Makefile
                    776: and do not affect manually building subtrees of the
                    777: .Nx
                    778: source code.
                    779: .
1.7       lukem     780: .Bl -tag -width "INSTALLWORLDDIR"
                    781: .
                    782: .It Sy INSTALLWORLDDIR
                    783: Location for the
                    784: .Dq make installworld
                    785: target to install to.
1.46      apb       786: If specified, must be an absolute path.
1.7       lukem     787: .DFLT
                    788: .Dq /
1.1       lukem     789: .
                    790: .It Sy MKOBJDIRS
                    791: .YorN
                    792: Indicates whether object directories will be created automatically
                    793: (via a
                    794: .Dq make obj
                    795: pass) at the start of a build.
1.21      lukem     796: .DFLTn
1.57      dholland  797: .Pp
                    798: If using
                    799: .Sy build.sh ,
                    800: the default is
                    801: .Dq yes .
                    802: This may be set back to
                    803: .Dq no
                    804: by giving
                    805: .Sy build.sh
                    806: the
                    807: .Fl o
                    808: option.
1.1       lukem     809: .
1.25      lukem     810: .It Sy MKUPDATE
                    811: .YorN
                    812: If set, then in addition to the effects described for
                    813: .Sy MKUPDATE=yes
                    814: above, this implies the effects of
                    815: .Sy NOCLEANDIR
1.91      abs       816: (i.e.,
1.25      lukem     817: .Dq make cleandir
                    818: is avoided).
                    819: .DFLTn
1.57      dholland  820: .Pp
                    821: If using
                    822: .Sy build.sh ,
                    823: this may be set by giving the
                    824: .Fl u
                    825: option.
1.25      lukem     826: .
1.1       lukem     827: .It Sy NBUILDJOBS
1.6       wiz       828: Now obsolete.
1.91      abs       829: Use the
1.1       lukem     830: .Xr make 1
                    831: option
1.4       lukem     832: .Fl j ,
1.57      dholland  833: instead.
                    834: See below.
1.1       lukem     835: .DFLTu
                    836: .
                    837: .It Sy NOCLEANDIR
                    838: If set, avoids the
                    839: .Dq make cleandir
1.6       wiz       840: phase of a full build.
                    841: This has the effect of allowing only changed
                    842: files in a source tree to be recompiled.
                    843: This can speed up builds when updating only a few files in the tree.
1.1       lukem     844: .DFLTu
1.57      dholland  845: .Pp
                    846: See also
                    847: .Sy MKUPDATE .
1.1       lukem     848: .
                    849: .It Sy NODISTRIBDIRS
                    850: If set, avoids the
                    851: .Dq make distrib-dirs
1.6       wiz       852: phase of a full build.
                    853: This skips running
1.1       lukem     854: .Xr mtree 8
                    855: on
                    856: .Sy DESTDIR ,
                    857: useful on systems where building as an unprivileged user, or where it is
                    858: known that the system-wide mtree files have not changed.
                    859: .DFLTu
                    860: .
                    861: .It Sy NOINCLUDES
                    862: If set, avoids the
                    863: .Dq make includes
1.6       wiz       864: phase of a full build.
                    865: This has the effect of preventing
1.1       lukem     866: .Xr make 1
                    867: from thinking that some programs are out-of-date simply because the
1.6       wiz       868: system include files have changed.
                    869: However, this option should not be used when updating the entire
1.1       lukem     870: .Nx
                    871: source tree arbitrarily; it is suggested to use
1.25      lukem     872: .Sy MKUPDATE=yes
1.57      dholland  873: instead in that case.
1.1       lukem     874: .DFLTu
                    875: .
                    876: .It Sy RELEASEDIR
                    877: If set, specifies the directory to which a
                    878: .Xr release 7
                    879: layout will be written at the end of a
                    880: .Dq make release .
1.46      apb       881: If specified, must be an absolute path.
1.1       lukem     882: .DFLTu
1.17      lukem     883: .Pp
                    884: .Em Note :
                    885: .Sy build.sh
                    886: will provide a default of
                    887: .Pa releasedir
                    888: (in the top-level
                    889: .Sy .OBJDIR )
                    890: unless run in
                    891: .Sq expert
1.57      dholland  892: mode.
1.1       lukem     893: .
                    894: .El
                    895: .
                    896: .Sh BUILDING
                    897: .
                    898: .Ss \*qmake\*q command line options
1.37      jmc       899: This is not a summary of all the options available to
1.1       lukem     900: .Xr make 1 ;
                    901: only the options used most frequently with
                    902: .Nx
                    903: builds are listed here.
                    904: .
                    905: .Bl -tag -width "var=value"
                    906: .
1.4       lukem     907: .It Fl j Ar njob
1.1       lukem     908: Run up to
1.4       lukem     909: .Ar njob
1.91      abs       910: .Xr make 1
1.1       lukem     911: subjobs in parallel.
1.91      abs       912: Makefiles should use .WAIT or have explicit dependencies
1.1       lukem     913: as necessary to enforce build ordering.
                    914: .
1.4       lukem     915: .It Fl m Ar dir
1.1       lukem     916: Specify the default directory for searching for system Makefile
                    917: segments, mainly the
                    918: .Aq bsd.*.mk
1.6       wiz       919: files.
                    920: When building any full
1.1       lukem     921: .Nx
                    922: source tree, this should be set to the
1.99      wiz       923: .Dq Pa share/mk
1.6       wiz       924: directory in the source tree.
1.57      dholland  925: This is set automatically when building from the top level, or when using
                    926: .Sy build.sh .
1.1       lukem     927: .
1.4       lukem     928: .It Fl n
1.1       lukem     929: Display the commands that would have been executed, but do not
1.6       wiz       930: actually execute them.
                    931: This will still cause recursion to take place.
1.1       lukem     932: .
1.32      zuntum    933: .It Fl V Ar var
1.1       lukem     934: Print
                    935: .Xr make 1 Ns 's
                    936: idea of the value of
1.4       lukem     937: .Ar var .
1.1       lukem     938: Does not build any targets.
                    939: .
                    940: .It Em var=value
                    941: Set the variable
                    942: .Em var
                    943: to
                    944: .Em value ,
                    945: overriding any setting specified by the process environment, the
                    946: .Sy MAKECONF
                    947: configuration file, or the system Makefile segments.
                    948: .
                    949: .El
                    950: .
                    951: .Ss \*qmake\*q targets
                    952: .
                    953: These default targets may be built by running
                    954: .Xr make 1
                    955: in any subtree of the
                    956: .Nx
1.6       wiz       957: source code.
                    958: It is recommended that none of these be used from the top
1.1       lukem     959: level Makefile; as a specific exception,
                    960: .Dq make obj
                    961: and
                    962: .Dq make cleandir
                    963: are useful in that context.
                    964: .
                    965: .Bl -tag -width "dependall"
                    966: .
                    967: .It Sy all
                    968: Build programs, libraries, and preformatted documentation.
                    969: .
                    970: .It Sy clean
                    971: Remove program and library object code files.
                    972: .
                    973: .It Sy cleandir
                    974: Same as
                    975: .Sy clean ,
                    976: but also remove preformatted documentation, dependency files generated
                    977: by
                    978: .Dq make depend ,
                    979: and any other files known to be created at build time.
                    980: .
                    981: .It Sy depend
                    982: Create dependency files
                    983: .Sy ( .depend )
                    984: containing more detailed information about the dependencies of source
1.6       wiz       985: code on header files.
                    986: Allows programs to be recompiled automatically when a dependency changes.
1.1       lukem     987: .
                    988: .It Sy dependall
                    989: Does a
                    990: .Dq make depend
                    991: immediately followed by a
                    992: .Dq make all .
                    993: This improves cache locality of the build since both passes read the source
                    994: files in their entirety.
                    995: .
1.34      lukem     996: .It Sy distclean
                    997: Synonym for
                    998: .Sy cleandir .
                    999: .
1.1       lukem    1000: .It Sy includes
1.6       wiz      1001: Build and install system header files.
                   1002: Typically needed before any system libraries or programs can be built.
1.1       lukem    1003: .
                   1004: .It Sy install
                   1005: Install programs, libraries, and documentation into
                   1006: .Sy DESTDIR .
                   1007: Few files will be installed to
1.14      lukem    1008: .Sy DESTDIR Ns Pa /dev ,
                   1009: .Sy DESTDIR Ns Pa /etc ,
                   1010: .Sy DESTDIR Ns Pa /root
1.1       lukem    1011: or
1.14      lukem    1012: .Sy DESTDIR Ns Pa /var
1.1       lukem    1013: in order to prevent user supplied configuration data from being overwritten.
                   1014: .It Sy lint
                   1015: Run
                   1016: .Xr lint 1
                   1017: against the C source code, where appropriate, and generate
                   1018: system-installed lint libraries.
                   1019: .
                   1020: .It Sy obj
                   1021: Create object directories to be used for built files, instead of
                   1022: building directly in the source tree.
                   1023: .
                   1024: .It Sy tags
                   1025: Create
                   1026: .Xr ctags 1
                   1027: searchable function lists usable by the
                   1028: .Xr ex 1
                   1029: and
                   1030: .Xr vi 1
                   1031: text editors.
                   1032: .
                   1033: .El
                   1034: .
                   1035: .Ss \*qmake\*q targets for the top level
                   1036: .
                   1037: Additional
                   1038: .Xr make 1
                   1039: targets are usable specifically from the top source level to facilitate
                   1040: building the entire
                   1041: .Nx
                   1042: source tree.
                   1043: .
1.7       lukem    1044: .Bl -tag -width "distribution"
1.1       lukem    1045: .
                   1046: .It Sy build
                   1047: Build the entire
                   1048: .Nx
1.55      reed     1049: system (except the kernel).
1.6       wiz      1050: This orders portions of the source tree such that prerequisites
1.1       lukem    1051: will be built in the proper order.
                   1052: .
1.7       lukem    1053: .It Sy distribution
                   1054: Do a
                   1055: .Dq make build ,
1.55      reed     1056: and then install a full distribution (which does not include a kernel) into
1.9       lukem    1057: .Sy DESTDIR ,
                   1058: including files in
1.14      lukem    1059: .Sy DESTDIR Ns Pa /dev ,
                   1060: .Sy DESTDIR Ns Pa /etc ,
                   1061: .Sy DESTDIR Ns Pa /root
1.9       lukem    1062: and
1.14      lukem    1063: .Sy DESTDIR Ns Pa /var .
1.7       lukem    1064: .
                   1065: .It Sy buildworld
                   1066: As per
                   1067: .Dq make distribution ,
                   1068: except that it ensures that
                   1069: .Sy DESTDIR
                   1070: is not the root directory.
                   1071: .
                   1072: .It Sy installworld
                   1073: Install the distribution from
                   1074: .Sy DESTDIR
                   1075: to
1.57      dholland 1076: .Sy INSTALLWORLDDIR ,
                   1077: which defaults to the root directory.
1.7       lukem    1078: Ensures that
                   1079: .Sy INSTALLWORLDDIR
1.37      jmc      1080: is not the root directory if cross compiling.
1.7       lukem    1081: .Pp
1.48      apb      1082: The
                   1083: .Sy INSTALLSETS
1.83      apb      1084: environment variable may be set to a space-separated list of
1.48      apb      1085: distribution sets to be installed.
                   1086: By default, all sets except
                   1087: .Dq etc
                   1088: and
                   1089: .Dq xetc
1.57      dholland 1090: are installed, so most files in
1.48      apb      1091: .Sy INSTALLWORLDDIR Ns Pa /etc
1.57      dholland 1092: will not be installed or modified.
1.48      apb      1093: .Pp
1.7       lukem    1094: .Em Note :
1.48      apb      1095: Before performing this operation with
                   1096: .Sy INSTALLWORLDDIR Ns = Ns Pa / ,
                   1097: it is highly recommended that you upgrade your kernel and reboot.
                   1098: After performing this operation,
                   1099: it is recommended that you use
                   1100: .Xr etcupdate 8
                   1101: to update files in
1.92      abs      1102: .Sy INSTALLWORLDDIR Ns Pa /etc ,
                   1103: and
1.48      apb      1104: .Xr postinstall 8
1.92      abs      1105: to check for or fix inconsistencies.
1.12      lukem    1106: .It Sy sets
                   1107: Create distribution sets from
                   1108: .Sy DESTDIR
                   1109: into
1.56      lukem    1110: .Sy RELEASEDIR/RELEASEMACHINEDIR Ns Pa /binary/sets .
1.12      lukem    1111: Should be run after
1.57      dholland 1112: .Dq make distribution ,
                   1113: as
1.12      lukem    1114: .Dq make build
1.57      dholland 1115: alone does not install all of the required files.
1.12      lukem    1116: .
1.18      lukem    1117: .It Sy sourcesets
                   1118: Create source sets of the source tree into
                   1119: .Sy RELEASEDIR Ns Pa /source/sets .
                   1120: .
1.40      apb      1121: .It Sy syspkgs
                   1122: Create syspkgs from
                   1123: .Sy DESTDIR
                   1124: into
1.56      lukem    1125: .Sy RELEASEDIR/RELEASEMACHINEDIR Ns Pa /binary/syspkgs .
1.40      apb      1126: Should be run after
1.57      dholland 1127: .Dq make distribution ,
                   1128: as
1.40      apb      1129: .Dq make build
1.57      dholland 1130: alone does not install all of the required files.
1.40      apb      1131: .
1.1       lukem    1132: .It Sy release
                   1133: Do a
1.9       lukem    1134: .Dq make distribution ,
1.12      lukem    1135: build kernels, distribution media, and install sets
                   1136: (this as per
                   1137: .Dq make sets ) ,
                   1138: and
1.1       lukem    1139: then package the system into a standard release layout as described by
                   1140: .Xr release 7 .
                   1141: This requires that
                   1142: .Sy RELEASEDIR
                   1143: be set (see above).
                   1144: .
1.57      dholland 1145: .It Sy iso-image
1.49      apb      1146: Create a
                   1147: .Nx
                   1148: installation CD-ROM image in the
                   1149: .Sy RELEASEDIR Ns Pa /iso
                   1150: directory.
                   1151: The CD-ROM file system will have a layout as described in
                   1152: .Xr release 7 .
                   1153: .Pp
                   1154: For most machine types, the CD-ROM will be bootable, and will automatically
                   1155: run the
                   1156: .Xr sysinst 8
                   1157: menu-based installation program, which can be used to install or upgrade a
                   1158: .Nx
                   1159: system.
                   1160: Bootable CD-ROMs also contain tools that may be useful in
                   1161: repairing a damaged
                   1162: .Nx
                   1163: installation.
                   1164: .Pp
                   1165: Before
                   1166: .Dq make iso-image
                   1167: is attempted, RELEASEDIR must be populated by
1.42      apb      1168: .Dq make release
                   1169: or equivalent.
1.49      apb      1170: .Pp
                   1171: Note that other, smaller, CD-ROM images may be created in the
1.56      lukem    1172: .Sy RELEASEDIR/RELEASEMACHINEDIR Ns Pa /installation/cdrom
1.49      apb      1173: directory by
                   1174: .Dq "make release" .
                   1175: These smaller images usually contain the same tools as the larger images in
                   1176: .Sy RELEASEDIR Ns Pa /iso ,
                   1177: but do not contain additional content such as the distribution sets.
                   1178: .Pp
                   1179: Note that the mac68k port still uses an older method of creating
                   1180: CD-ROM images.
1.42      apb      1181: This requires the
                   1182: .Xr mkisofs 1
                   1183: utility, which is not part of
                   1184: .Nx ,
                   1185: but which can be installed from
1.43      apb      1186: .Pa pkgsrc/sysutils/cdrtools .
1.42      apb      1187: .
1.63      lukem    1188: .It Sy iso-image-source
1.51      jnemeth  1189: Create a
                   1190: .Nx
                   1191: installation CD-ROM image in the
                   1192: .Sy RELEASEDIR Ns Pa /iso
                   1193: directory.
                   1194: The CD-ROM file system will have a layout as described in
                   1195: .Xr release 7 .
                   1196: It will have top level directories for the machine type and source.
                   1197: .Pp
                   1198: For most machine types, the CD-ROM will be bootable, and will automatically
                   1199: run the
                   1200: .Xr sysinst 8
                   1201: menu-based installation program, which can be used to install or upgrade a
                   1202: .Nx
                   1203: system.
                   1204: Bootable CD-ROMs also contain tools that may be useful in
                   1205: repairing a damaged
                   1206: .Nx
                   1207: installation.
                   1208: .Pp
                   1209: Before
                   1210: .Dq make iso-image-source
                   1211: is attempted, RELEASEDIR must be populated by
                   1212: .Dq make sourcesets release
                   1213: or equivalent.
                   1214: .Pp
                   1215: Note that other, smaller, CD-ROM images may be created in the
1.56      lukem    1216: .Sy RELEASEDIR/RELEASEMACHINEDIR Ns Pa /installation/cdrom
1.51      jnemeth  1217: directory by
                   1218: .Dq make release .
                   1219: These smaller images usually contain the same tools as the larger images in
                   1220: .Sy RELEASEDIR Ns Pa /iso ,
                   1221: but do not contain additional content such as the distribution sets.
                   1222: .Pp
                   1223: Note that the mac68k port still uses an older method of creating
                   1224: CD-ROM images.
                   1225: This requires the
                   1226: .Xr mkisofs 1
                   1227: utility, which is not part of
                   1228: .Nx ,
                   1229: but which can be installed from
                   1230: .Pa pkgsrc/sysutils/cdrtools .
                   1231: .
1.86      apb      1232: .It Sy install-image
                   1233: Create a bootable
                   1234: .Nx
                   1235: installation disk image in the
                   1236: .Sy RELEASEDIR/RELEASEMACHINEDIR Ns Pa /installation/installimage
                   1237: directory.
1.87      apb      1238: The installation disk image is suitable for copying to
                   1239: bootable USB flash memory sticks, etc., for machines which
                   1240: are able to boot from such devices.
                   1241: The file system in the bootable disk image will have a layout
1.86      apb      1242: as described in
                   1243: .Xr release 7 .
                   1244: .Pp
                   1245: The installation image is bootable, and will automatically
                   1246: run the
                   1247: .Xr sysinst 8
                   1248: menu-based installation program, which can be used to install or upgrade a
                   1249: .Nx
                   1250: system.
1.87      apb      1251: The image also contains tools that may be
1.86      apb      1252: useful in repairing a damaged
                   1253: .Nx
                   1254: installation.
                   1255: .Pp
                   1256: Before
                   1257: .Dq make install-image
1.87      apb      1258: is attempted,
                   1259: .Sy RELEASEDIR
                   1260: must be populated by
1.86      apb      1261: .Dq make release
1.87      apb      1262: or equivalent.
                   1263: The build must have been performed with
1.91      abs      1264: .Sy MKUNPRIVED=yes
1.87      apb      1265: because
                   1266: .Dq make install-image
                   1267: relies on information in
                   1268: .Sy DESTDIR Ns Pa /METALOG .
1.86      apb      1269: .
                   1270: .It live-image
                   1271: Create
                   1272: .Nx
                   1273: live images in the
                   1274: .Sy RELEASEDIR/RELEASEMACHINEDIR Ns Pa /installation/liveimage
                   1275: directory.
                   1276: The live image contains all necessary files
                   1277: to boot
                   1278: .Nx
1.87      apb      1279: up to multi-user mode, including all files
1.86      apb      1280: which should be extracted during installation,
                   1281: .Nx
1.87      apb      1282: disklabel, bootloaders, etc.
1.86      apb      1283: .Pp
1.87      apb      1284: The live image is suitable for use as a disk image in
                   1285: virtual machine environments such as QEMU,
                   1286: and also useful to boot
1.86      apb      1287: .Nx
1.87      apb      1288: from a USB flash memory stick
                   1289: on a real machine, without the need for installation.
1.86      apb      1290: .Pp
                   1291: Before
                   1292: .Dq make live-image
                   1293: is attempted, RELEASEDIR must be populated by
                   1294: .Dq make release
1.88      tsutsui  1295: or equivalent.
1.87      apb      1296: The build must have been performed with
1.91      abs      1297: .Sy MKUNPRIVED=yes
1.87      apb      1298: because
                   1299: .Dq make install-image
                   1300: relies on information in
                   1301: .Sy DESTDIR Ns Pa /METALOG .
1.86      apb      1302: .
1.1       lukem    1303: .It Sy regression-tests
                   1304: Can only be run after building the regression tests in the directory
                   1305: .Dq regress .
1.57      dholland 1306: Runs those compiled regression tests on the local host.
                   1307: Note that most tests are now managed instead using
                   1308: .Xr atf 7 ;
                   1309: this target should probably run those as well but currently does not.
1.1       lukem    1310: .
                   1311: .El
                   1312: .
                   1313: .Ss The \*qbuild.sh\*q script
                   1314: .
1.85      apb      1315: This script file is a shell script designed to build the
1.1       lukem    1316: entire
                   1317: .Nx
1.85      apb      1318: system on any host with a suitable modern shell and some common
                   1319: utilities.
                   1320: The required shell features are described under the
                   1321: .Sy HOST_SH
                   1322: variable.
                   1323: .Pp
                   1324: If a host system's default shell does support the required
                   1325: features, then we suggest that you explicitly specify
                   1326: a suitable shell using a command like
                   1327: .Bd -unfilled -offset indent
                   1328: .Li /path/to/suitable/shell build.sh Op Ar options
                   1329: .Ed
                   1330: .Pp
                   1331: The above command will usually enable
                   1332: .Nm build.sh
                   1333: to automatically set
                   1334: .Sy HOST_SH Ns Cm = Ns Pa /path/to/suitable/shell ,
                   1335: but if that fails, then the following set of commands may be used instead:
                   1336: .Bd -unfilled -offset indent
                   1337: .Li HOST_SH= Ns Va /path/to/suitable/shell
                   1338: .Li export HOST_SH
                   1339: .Li ${HOST_SH} build.sh Op Ar options
                   1340: .Ed
                   1341: .Pp
                   1342: If
                   1343: .Sy build.sh
                   1344: detects that it is being executed under an unsuitable shell, it attempts
                   1345: to exec a suitable shell instead, or prints an error message.
                   1346: If
                   1347: .Sy HOST_SH
                   1348: is not set explicitly, then
                   1349: .Nm build.sh
                   1350: sets a default using heuristics dependent on the host platform,
                   1351: or from the shell under which
                   1352: .Nm build.sh
                   1353: is executed (if that can be determined),
                   1354: or using the first copy of
                   1355: .Pa sh
                   1356: found in
                   1357: .Sy PATH .
1.1       lukem    1358: .Pp
                   1359: All cross-compile builds, and most native builds, of the entire system
                   1360: should make use of
                   1361: .Sy build.sh
                   1362: rather than just running
                   1363: .Dq make .
                   1364: This way, the
                   1365: .Xr make 1
                   1366: program will be bootstrapped properly, in case the host system has an
                   1367: older or incompatible
                   1368: .Dq make
                   1369: program.
                   1370: .Pp
                   1371: When compiling the entire system via
                   1372: .Sy build.sh ,
                   1373: many
                   1374: .Xr make 1
                   1375: variables are set for you in order to help encapsulate the build
1.6       wiz      1376: process.
                   1377: In the list of options below, variables that are automatically set by
1.1       lukem    1378: .Sy build.sh
                   1379: are noted where applicable.
1.9       lukem    1380: .
1.1       lukem    1381: .Pp
1.9       lukem    1382: The following operations are supported by
1.1       lukem    1383: .Sy build.sh :
                   1384: .
1.9       lukem    1385: .Bl -tag -width "distribution"
                   1386: .
                   1387: .It Sy build
                   1388: Build the system as per
                   1389: .Dq make build .
1.57      dholland 1390: Before the main part of the build commences, this command runs the
1.9       lukem    1391: .Sy obj
1.57      dholland 1392: operation (unless the
                   1393: .Fl o
                   1394: option is given),
                   1395: .Dq make cleandir
                   1396: (unless the
                   1397: .Fl u
                   1398: option is given),
                   1399: and the
1.9       lukem    1400: .Sy tools
1.57      dholland 1401: operation.
1.9       lukem    1402: .
                   1403: .It Sy distribution
                   1404: Build a full distribution as per
                   1405: .Dq make distribution .
1.57      dholland 1406: This command first runs the
1.9       lukem    1407: .Sy build
                   1408: operation.
                   1409: .
                   1410: .It Sy release
                   1411: Build a full release as per
                   1412: .Dq make release .
1.57      dholland 1413: This command first runs the
1.9       lukem    1414: .Sy distribution
                   1415: operation.
                   1416: .
1.10      lukem    1417: .It Sy makewrapper
                   1418: Create the
1.13      lukem    1419: .Sy \*[toolprefix]make-MACHINE
1.10      lukem    1420: wrapper.
                   1421: This operation is automatically performed for any of the other
                   1422: operations.
                   1423: .
1.63      lukem    1424: .It Sy cleandir
                   1425: Perform
                   1426: .Dq make cleandir .
                   1427: .
1.9       lukem    1428: .It Sy obj
                   1429: Perform
                   1430: .Dq make obj .
1.11      lukem    1431: .
1.9       lukem    1432: .It Sy tools
                   1433: Build and install the host tools from
                   1434: .Pa src/tools .
1.57      dholland 1435: This command will first run
                   1436: .Dq make obj
                   1437: and
                   1438: .Dq make cleandir
1.91      abs      1439: in the
1.57      dholland 1440: .Pa tools
                   1441: subdirectory unless the
                   1442: .Fl o
                   1443: or
                   1444: .Fl u
                   1445: options (respectively) are given.
1.22      lukem    1446: .
                   1447: .It Sy install Ns = Ns Ar idir
                   1448: Install the contents of
                   1449: .Sy DESTDIR
                   1450: to
                   1451: .Ar idir ,
                   1452: using
                   1453: .Dq make installworld .
1.48      apb      1454: Note that files that are part of the
                   1455: .Dq etc
                   1456: or
                   1457: .Dq xetc
1.83      apb      1458: sets will not be installed, unless overridden by
                   1459: the INSTALLSETS environment variable.
1.22      lukem    1460: .
1.9       lukem    1461: .It Sy kernel Ns = Ns Ar kconf
                   1462: Build a new kernel.
                   1463: The
                   1464: .Ar kconf
                   1465: argument is the name of a configuration file suitable
                   1466: for use by
1.39      peter    1467: .Xr config 1 .
1.9       lukem    1468: If
                   1469: .Ar kconf
                   1470: does not contain any
                   1471: .Sq /
                   1472: characters, the configuration file is expected to be found in the
                   1473: .Sy KERNCONFDIR
                   1474: directory, which is typically
1.99      wiz      1475: .Pa sys/arch/MACHINE/conf .
1.9       lukem    1476: The new kernel will be built in a subdirectory of
                   1477: .Sy KERNOBJDIR ,
                   1478: which is typically
1.99      wiz      1479: .Pa sys/arch/MACHINE/compile
1.9       lukem    1480: or an associated object directory.
1.57      dholland 1481: .Pp
                   1482: This command does
                   1483: .Em not
                   1484: imply the
                   1485: .Sy tools
                   1486: command; run the
1.9       lukem    1487: .Sy tools
1.57      dholland 1488: command first unless it is
                   1489: .Em certain
                   1490: that the tools already exist and are up to date.
                   1491: .Pp
                   1492: This command will run
                   1493: .Dq make cleandir
                   1494: on the kernel in question first unless the
                   1495: .Fl u
                   1496: option is given.
1.9       lukem    1497: .
1.98      martin   1498: .It Sy kernel.gdb Ns = Ns Ar kconf
                   1499: Build a new kernel with debug information.
                   1500: Similar to the above
                   1501: .Sy kernel Ns = Ns Ar kconf
                   1502: operation, but creates a
                   1503: .Pa netbsd.gdb
                   1504: file alongside of the kernel
                   1505: .Pa netbsd ,
                   1506: which contains a full symbol table and can be used for debugging
1.99      wiz      1507: (for example with a cross-gdb built by
1.98      martin   1508: .Sy MKCROSSGDB ) .
1.75      apb      1509: .It Sy modules
                   1510: This command will build kernel modules and install them into
                   1511: .Sy DESTDIR .
                   1512: .
1.22      lukem    1513: .It Sy releasekernel Ns = Ns Ar kconf
                   1514: Install a
                   1515: .Xr gzip 1 Ns ed
1.57      dholland 1516: copy of the kernel previously built by
1.22      lukem    1517: .Sy kernel Ns = Ns Ar kconf
                   1518: into
1.56      lukem    1519: .Sy RELEASEDIR/RELEASEMACHINEDIR Ns Pa /binary/kernel ,
1.22      lukem    1520: usually as
                   1521: .Pa netbsd- Ns Ar kconf Ns Pa .gz ,
                   1522: although the
                   1523: .Dq Pa netbsd
                   1524: prefix is determined from the
                   1525: .Dq Sy config
                   1526: directives in
                   1527: .Ar kconf .
1.9       lukem    1528: .
1.11      lukem    1529: .It Sy sets
                   1530: Perform
                   1531: .Dq make sets .
1.18      lukem    1532: .
                   1533: .It Sy sourcesets
                   1534: Perform
                   1535: .Dq make sourcesets .
                   1536: .
1.40      apb      1537: .It Sy syspkgs
                   1538: Perform
                   1539: .Dq make syspkgs .
                   1540: .
1.42      apb      1541: .It Sy iso-image
                   1542: Perform
                   1543: .Dq make iso-image .
                   1544: .
1.52      jnemeth  1545: .It Sy iso-image-source
                   1546: Perform
                   1547: .Dq make iso-image-source .
                   1548: .
1.86      apb      1549: .It Sy install-image
                   1550: Perform
                   1551: .Dq make install-image .
                   1552: .
                   1553: .It Sy live-image
                   1554: Perform
                   1555: .Dq make live-image .
                   1556: .
1.9       lukem    1557: .El
                   1558: .
                   1559: .Pp
                   1560: The following command line options alter the behaviour of the
                   1561: .Sy build.sh
                   1562: operations described above:
                   1563: .
1.1       lukem    1564: .Bl -tag -width "-T tools"
                   1565: .
1.4       lukem    1566: .It Fl a Ar arch
1.1       lukem    1567: Set the value of
                   1568: .Sy MACHINE_ARCH
                   1569: to
1.4       lukem    1570: .Ar arch .
1.1       lukem    1571: .
1.4       lukem    1572: .It Fl B Ar buildid
1.1       lukem    1573: Set the value of
                   1574: .Sy BUILDID
                   1575: to
1.4       lukem    1576: .Ar buildid .
1.54      sborrill 1577: This will also append the build identifier to the name of the
1.1       lukem    1578: .Dq make
                   1579: wrapper script so that the resulting name is of the form
1.13      lukem    1580: .Dq Sy \*[toolprefix]make-MACHINE-BUILDID .
1.1       lukem    1581: .
1.54      sborrill 1582: .It Fl C Ar cdextras
1.76      apb      1583: Append
1.91      abs      1584: .Ar cdextras
1.76      apb      1585: to the
1.53      jnemeth  1586: .Sy CDEXTRA
1.76      apb      1587: variable,
                   1588: which is a space-separated list of files or directories that will be
                   1589: added to the CD-ROM image that may be create by the
1.53      jnemeth  1590: .Dq iso-image
                   1591: or
1.76      apb      1592: .Dq iso-image-source
                   1593: operations.
1.54      sborrill 1594: Files will be added to the root of the CD-ROM image, whereas directories
                   1595: will be copied recursively.
                   1596: If relative paths are specified, they will be converted to
                   1597: absolute paths before being used.
1.76      apb      1598: Multiple paths may be specified via multiple
                   1599: .Fl C
                   1600: options, or via a single option whose argument contains multiple
                   1601: space-separated paths.
1.53      jnemeth  1602: .
1.4       lukem    1603: .It Fl D Ar dest
                   1604: Set the value of
                   1605: .Sy DESTDIR
                   1606: to
                   1607: .Ar dest .
1.46      apb      1608: If a relative path is specified, it will be converted to an
                   1609: absolute path before being used.
1.4       lukem    1610: .
1.5       lukem    1611: .It Fl E
                   1612: Set
                   1613: .Sq expert
1.10      lukem    1614: mode.
                   1615: This overrides various sanity checks, and allows:
1.5       lukem    1616: .Sy DESTDIR
1.10      lukem    1617: does not have to be set to a non-root path for builds,
                   1618: and
1.25      lukem    1619: .Sy MKUNPRIVED=yes
1.10      lukem    1620: does not have to be set when building as a non-root user.
                   1621: .Pp
                   1622: .Em Note :
                   1623: It is highly recommended that you know what you are doing when
                   1624: you use this option.
1.7       lukem    1625: .
1.36      wiz      1626: .It Fl h
                   1627: Print a help message.
                   1628: .
1.4       lukem    1629: .It Fl j Ar njob
1.57      dholland 1630: Run up to
                   1631: .Ar njob
1.91      abs      1632: .Xr make 1
1.57      dholland 1633: subjobs in parallel;
1.91      abs      1634: passed through to
1.1       lukem    1635: .Xr make 1 .
1.62      apb      1636: If you see failures for reasons other than running out of memory
                   1637: while using
                   1638: .Sy build.sh
                   1639: with
                   1640: .Fl j ,
1.91      abs      1641: please save complete build logs
1.1       lukem    1642: so the failures can be analyzed.
1.62      apb      1643: .Pp
                   1644: To achieve the fastest builds,
                   1645: .Fl j
                   1646: values between (1 + the number of CPUs) and (2 * the number of CPUs)
                   1647: are recommended.
                   1648: Use lower values on machines with limited memory or I/O bandwidth.
1.1       lukem    1649: .
1.4       lukem    1650: .It Fl M Ar obj
                   1651: Set
                   1652: .Sy MAKEOBJDIRPREFIX
                   1653: to
                   1654: .Ar obj .
1.77      apb      1655: Unsets
                   1656: .Sy MAKEOBJDIR .
                   1657: See
1.95      uwe      1658: .Dq Fl O Ar obj
1.77      apb      1659: for more information.
                   1660: .Pp
1.61      apb      1661: For instance, if the source directory is
                   1662: .Pa /usr/src ,
                   1663: a setting of
                   1664: .Dq Fl M Pa /usr/obj
                   1665: will place build-time files under
                   1666: .Pa /usr/obj/usr/src/bin ,
                   1667: .Pa /usr/obj/usr/src/lib ,
                   1668: .Pa /usr/obj/usr/src/usr.bin ,
                   1669: and so forth.
1.77      apb      1670: .Pp
1.46      apb      1671: If a relative path is specified, it will be converted to an
                   1672: absolute path before being used.
1.77      apb      1673: .Sy build.sh
                   1674: imposes the restriction that the argument to the
                   1675: .Fl M
                   1676: option must not begin with a
                   1677: .Dq \&$
                   1678: (dollar sign)
                   1679: character; otherwise it would be too difficult
                   1680: to determine whether the value is an absolute or a relative path.
                   1681: If the directory does not already exist,
                   1682: .Sy build.sh
                   1683: will create it.
1.4       lukem    1684: .
                   1685: .It Fl m Ar mach
1.1       lukem    1686: Set the value of
                   1687: .Sy MACHINE
                   1688: to
1.47      apb      1689: .Ar mach ,
                   1690: except in some special cases listed below.
1.1       lukem    1691: This will also override any value of
                   1692: .Sy MACHINE_ARCH
                   1693: in the process environment with a value deduced from
1.4       lukem    1694: .Ar mach ,
1.1       lukem    1695: unless
1.4       lukem    1696: .Fl a
1.47      apb      1697: is specified.
1.6       wiz      1698: All cross builds require
1.4       lukem    1699: .Fl m ,
1.1       lukem    1700: but if unset on a NetBSD host, the host's value of MACHINE will be
                   1701: detected and used automatically.
1.20      lukem    1702: .Pp
                   1703: Some machines support multiple values for
                   1704: .Sy MACHINE_ARCH .
1.47      apb      1705: The following special cases for the
                   1706: .Ar mach
                   1707: argument are defined to set the listed values of
1.20      lukem    1708: .Sy MACHINE
                   1709: and
1.47      apb      1710: .Sy MACHINE_ARCH :
1.20      lukem    1711: .Bl -column "evbmips-el" "MACHINE" "MACHINE_ARCH" -offset indent
1.24      lukem    1712: .It Sy mach Ta Sy "MACHINE" Ta Sy "MACHINE_ARCH"
1.47      apb      1713: .It evbarm Ta evbarm Ta (not set)
                   1714: .It evbarm-eb Ta evbarm Ta armeb
                   1715: .It evbarm-el Ta evbarm Ta arm
1.20      lukem    1716: .It evbmips Ta evbmips Ta (not set)
                   1717: .It evbmips-eb Ta evbmips Ta mipseb
                   1718: .It evbmips-el Ta evbmips Ta mipsel
                   1719: .It evbsh3 Ta evbsh3 Ta (not set)
                   1720: .It evbsh3-eb Ta evbsh3 Ta sh3eb
                   1721: .It evbsh3-el Ta evbsh3 Ta sh3el
                   1722: .It sbmips Ta sbmips Ta (not set)
                   1723: .It sbmips-eb Ta sbmips Ta mipseb
                   1724: .It sbmips-el Ta sbmips Ta mipsel
1.30      lukem    1725: .El
                   1726: .
                   1727: .It Fl N Ar noiselevel
                   1728: Set the
                   1729: .Dq noisyness
1.31      lukem    1730: level of the build, by setting
                   1731: .Sy MAKEVERBOSE
                   1732: to
                   1733: .Ar noiselevel .
1.1       lukem    1734: .
1.4       lukem    1735: .It Fl n
1.1       lukem    1736: Show the commands that would be executed by
                   1737: .Sy build.sh ,
1.6       wiz      1738: but do not make any changes.
                   1739: This is similar in concept to
1.1       lukem    1740: .Dq make -n .
                   1741: .
1.4       lukem    1742: .It Fl O Ar obj
1.1       lukem    1743: Create an appropriate transform macro for
                   1744: .Sy MAKEOBJDIR
                   1745: that will place the built object files under
1.4       lukem    1746: .Ar obj .
1.77      apb      1747: Unsets
                   1748: .Sy MAKEOBJDIRPREFIX .
                   1749: .Pp
1.1       lukem    1750: For instance, a setting of
1.61      apb      1751: .Dq Fl O Pa /usr/obj
1.1       lukem    1752: will place build-time files under
1.61      apb      1753: .Pa /usr/obj/bin ,
                   1754: .Pa /usr/obj/lib ,
                   1755: .Pa /usr/obj/usr.bin ,
1.1       lukem    1756: and so forth.
1.77      apb      1757: .Pp
1.61      apb      1758: If a relative path is specified, it will be converted to an
                   1759: absolute path before being used.
1.77      apb      1760: .Sy build.sh
                   1761: imposes the restriction that the argument to the
                   1762: .Fl O
                   1763: option must not contain a
                   1764: .Dq \&$
                   1765: (dollar sign)
                   1766: character.
                   1767: If the directory does not already exist,
                   1768: .Sy build.sh
                   1769: will create it.
1.61      apb      1770: .Pp
                   1771: In normal use, exactly one of the
                   1772: .Fl M
                   1773: or
                   1774: .Fl O
                   1775: options should be specified.
1.67      apb      1776: If neither
1.61      apb      1777: .Fl M
                   1778: nor
                   1779: .Fl O
                   1780: is specified, then a default object directory will be chosen
                   1781: according to rules in
1.67      apb      1782: .Aq bsd.obj.mk .
                   1783: Relying on this default is not recommended because
                   1784: it is determined by complex rules that are influenced
                   1785: by the values of several variables and
                   1786: by the location of the source directory.
1.4       lukem    1787: .It Fl o
                   1788: Set the value of
                   1789: .Sy MKOBJDIRS
                   1790: to
                   1791: .Dq no .
1.21      lukem    1792: Otherwise, it will be automatically set to
1.57      dholland 1793: .Dq yes .
                   1794: This default is opposite to the behaviour when not using
                   1795: .Sy build.sh .
1.4       lukem    1796: .
                   1797: .It Fl R Ar rel
1.1       lukem    1798: Set the value of
                   1799: .Sy RELEASEDIR
                   1800: to
1.4       lukem    1801: .Ar rel .
1.46      apb      1802: If a relative path is specified, it will be converted to an
                   1803: absolute path before being used.
1.1       lukem    1804: .
1.4       lukem    1805: .It Fl r
                   1806: Remove the contents of
                   1807: .Sy DESTDIR
                   1808: and
                   1809: .Sy TOOLDIR
1.6       wiz      1810: before building (provides a clean starting point).
                   1811: This will skip deleting
1.4       lukem    1812: .Sy DESTDIR
                   1813: if building on a native system to the root directory.
                   1814: .
1.60      perry    1815: .It Fl S Ar seed
                   1816: Change the value of
                   1817: .Sy BUILDSEED
                   1818: to
                   1819: .Ar seed .
                   1820: This should rarely be necessary.
                   1821: .
1.4       lukem    1822: .It Fl T Ar tools
1.1       lukem    1823: Set the value of
                   1824: .Sy TOOLDIR
                   1825: to
1.4       lukem    1826: .Ar tools .
1.46      apb      1827: If a relative path is specified, it will be converted to an
                   1828: absolute path before being used.
1.1       lukem    1829: If set, the bootstrap
                   1830: .Dq make
1.57      dholland 1831: will only be rebuilt if the source files for
1.1       lukem    1832: .Xr make 1
1.57      dholland 1833: have changed.
1.1       lukem    1834: .
1.4       lukem    1835: .It Fl U
1.25      lukem    1836: Set
                   1837: .Sy MKUNPRIVED=yes .
1.1       lukem    1838: .
1.4       lukem    1839: .It Fl u
1.25      lukem    1840: Set
                   1841: .Sy MKUPDATE=yes .
1.8       lukem    1842: .
                   1843: .It Xo
                   1844: .Fl V
                   1845: .Sm off
                   1846: .Ar var
                   1847: .Li =
                   1848: .Op Ar value
                   1849: .Sm on
                   1850: .Xc
1.27      lukem    1851: Set the environment variable
1.8       lukem    1852: .Ar var
1.27      lukem    1853: to an optional
                   1854: .Ar value .
1.91      abs      1855: This is propagated to the
1.27      lukem    1856: .Sy \*[toolprefix]make
                   1857: wrapper.
1.4       lukem    1858: .
                   1859: .It Fl w Ar wrapper
1.27      lukem    1860: Create the
                   1861: .Sy \*[toolprefix]make
                   1862: wrapper script (see below) in a custom location,
1.4       lukem    1863: specified by
                   1864: .Ar wrapper .
                   1865: This allows, for instance, to place the wrapper in
                   1866: .Sy PATH
1.6       wiz      1867: automatically.
                   1868: Note that
1.4       lukem    1869: .Ar wrapper
                   1870: is the full name of the file, not just a directory name.
1.46      apb      1871: If a relative path is specified, it will be converted to an
                   1872: absolute path before being used.
1.4       lukem    1873: .
1.34      lukem    1874: .It Fl X Ar x11src
                   1875: Set the value of
                   1876: .Sy X11SRCDIR
                   1877: to
                   1878: .Ar x11src .
1.46      apb      1879: If a relative path is specified, it will be converted to an
                   1880: absolute path before being used.
1.34      lukem    1881: .
                   1882: .It Fl x
                   1883: Set
                   1884: .Sy MKX11=yes .
                   1885: .
1.27      lukem    1886: .It Fl Z Ar var
                   1887: Unset ("zap") the environment variable
                   1888: .Ar var .
1.91      abs      1889: This is propagated to the
1.27      lukem    1890: .Sy \*[toolprefix]make
                   1891: wrapper.
                   1892: .
1.1       lukem    1893: .El
                   1894: .
1.13      lukem    1895: .Ss The \*q\*[toolprefix]make-MACHINE\*q wrapper script
1.1       lukem    1896: .
                   1897: If using the
                   1898: .Sy build.sh
                   1899: script to build
                   1900: .Nx ,
                   1901: a
1.13      lukem    1902: .Sy \*[toolprefix]make-MACHINE
1.1       lukem    1903: script will be created in
1.99      wiz      1904: .Sy TOOLDIR Ns Pa /bin
1.1       lukem    1905: upon the first build to assist in building subtrees on a cross-compile
                   1906: host.
                   1907: .Pp
1.13      lukem    1908: .Sy \*[toolprefix]make-MACHINE
1.1       lukem    1909: can be invoked in lieu of
                   1910: .Xr make 1 ,
                   1911: and will instead call the up-to-date version of
1.13      lukem    1912: .Dq \*[toolprefix]make
1.1       lukem    1913: installed into
1.99      wiz      1914: .Sy TOOLDIR Ns Pa /bin
1.1       lukem    1915: with several key variables pre-set, including
                   1916: .Sy MACHINE , MACHINE_ARCH ,
                   1917: and
                   1918: .Sy TOOLDIR .
1.57      dholland 1919: .Sy \*[toolprefix]make-MACHINE
1.27      lukem    1920: will also set variables specified with
                   1921: .Fl V ,
                   1922: and unset variables specified with
                   1923: .Fl Z .
                   1924: .Pp
1.1       lukem    1925: This script can be symlinked into a directory listed in
                   1926: .Sy PATH ,
                   1927: or called with an absolute path.
1.2       lukem    1928: .
                   1929: .Sh EXAMPLES
1.10      lukem    1930: .
1.15      lukem    1931: .Bl -enum
1.9       lukem    1932: .
1.15      lukem    1933: .It
1.67      apb      1934: .Li "% ./build.sh [options] tools kernel=GENERIC"
1.15      lukem    1935: .Pp
1.2       lukem    1936: Build a new toolchain, and use the new toolchain to
                   1937: configure and build a new GENERIC kernel.
1.9       lukem    1938: .
1.15      lukem    1939: .It
1.67      apb      1940: .Li "% ./build.sh [options] -U distribution"
1.15      lukem    1941: .Pp
1.2       lukem    1942: Using unprivileged mode,
1.17      lukem    1943: build a complete distribution to a
                   1944: .Sy DESTDIR
                   1945: directory that
                   1946: .Sy build.sh
                   1947: selects (and will display).
1.9       lukem    1948: .
1.15      lukem    1949: .It
1.67      apb      1950: .Li "# ./build.sh [options] -U install=/"
1.15      lukem    1951: .Pp
1.16      lukem    1952: As root, install to
                   1953: .Pa /
                   1954: the distribution that was built
                   1955: by example 2.
1.15      lukem    1956: Even though this is run as root,
1.9       lukem    1957: .Fl U
                   1958: is required so that the permissions stored in
1.17      lukem    1959: .Sy DESTDIR Ns Pa /METALOG
1.9       lukem    1960: are correctly applied to the files as they're copied to
1.15      lukem    1961: .Pa / .
1.9       lukem    1962: .
1.15      lukem    1963: .It
1.67      apb      1964: .Li "% ./build.sh [options] -U -u release"
1.15      lukem    1965: .Pp
1.2       lukem    1966: Using unprivileged mode,
1.17      lukem    1967: build a complete release to
                   1968: .Sy DESTDIR
                   1969: and
                   1970: .Sy RELEASEDIR
                   1971: directories that
                   1972: .Sy build.sh
                   1973: selects (and will display).
1.25      lukem    1974: .Sy MKUPDATE=yes
1.15      lukem    1975: .Pq Fl u
                   1976: is set to prevent the
                   1977: .Dq make cleandir ,
                   1978: so that if this is run after example 2, it doesn't need to redo that
                   1979: portion of the release build.
1.2       lukem    1980: .El
1.1       lukem    1981: .
                   1982: .Sh OBSOLETE VARIABLES
                   1983: .
                   1984: .Bl -tag -width "NBUILDJOBS"
                   1985: .
                   1986: .It Sy NBUILDJOBS
1.91      abs      1987: Use the
1.1       lukem    1988: .Xr make 1
                   1989: option
1.57      dholland 1990: .Fl j
1.1       lukem    1991: instead.
                   1992: .
                   1993: .It Sy USE_NEW_TOOLCHAIN
                   1994: The new toolchain is now the default.
                   1995: To disable, use
                   1996: .Sy TOOLCHAIN_MISSING=yes .
                   1997: .El
                   1998: .Sh SEE ALSO
                   1999: .Xr make 1 ,
                   2000: .Xr hier 7 ,
1.42      apb      2001: .Xr release 7 ,
1.48      apb      2002: .Xr etcupdate 8 ,
                   2003: .Xr postinstall 8 ,
1.49      apb      2004: .Xr sysinst 8 ,
1.43      apb      2005: .Pa pkgsrc/sysutils/cdrtools
1.1       lukem    2006: .
                   2007: .Sh HISTORY
                   2008: .
                   2009: The
                   2010: .Nm build.sh
                   2011: based build scheme was introduced for
                   2012: .Nx 1.6
                   2013: as
                   2014: .Sy USE_NEW_TOOLCHAIN ,
                   2015: and re-worked to
                   2016: .Sy TOOLCHAIN_MISSING
                   2017: after that.

CVSweb <webmaster@jp.NetBSD.org>