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