forked from IIJ-NetBSD/netbsd-src
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBUILDING.mdoc
982 lines (982 loc) · 22.1 KB
/
BUILDING.mdoc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
.\" $NetBSD: BUILDING.mdoc,v 1.19 2002/07/22 09:49:05 wiz Exp $
.\"
.\" Copyright (c) 2001 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Todd Vierling.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the NetBSD
.\" Foundation, Inc. and its contributors.
.\" 4. Neither the name of The NetBSD Foundation nor the names of its
.\" contributors may be used to endorse or promote products derived
.\" from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.\" =====
.\" NOTE: After changing this file, run "make build-docs" to generate the
.\" proper plaintext versions, and check in all BUILDING.* files!
.\"
.Dd May 3, 2002
.Dt BUILDING 8
.Os NetBSD
.
.Sh NAME
.
.Nm BUILDING
.Nd Procedure for building
.Nx
from source code.
.
.Sh STATUS
.
This document is a work-in-progress. As such, the information described
here may not match the reality of the build system as of this writing.
Once this document is completely in sync with reality, this paragraph
will be removed.
.Pp
Discrepancies between this documentation and the current reality of
implementation are noted specially, as with the note below:
.Pp
.Em Note :
This document applies only to platforms which use the new toolchain as
indicated by the default setting of
.Sy USE_NEW_TOOLCHAIN
in
.Aq bsd.own.mk .
Platforms which have not yet been switched to the new toolchain should
continue building traditionally, using the notes specified in the file
.Sy UPDATING .
.
.Sh REQUIREMENTS
.
.Nx
is designed to be buildable on most POSIX-compliant host systems.
The basic build procedure is the same whether compiling
.Em natively
(on the same
.Nx
architecture) or
.Em cross compiling
(on another architecture or OS).
.Pp
This source tree contains a special subtree,
.Dq tools ,
which uses the host system to create a build toolchain for the target
architecture. The host system must have at least C and C++
compilers in order to create the toolchain
.Nm ( make
is not required); all other tools are created as part of the
.Nx
build process.
.Pp
.Bd -ragged -offset indent
.Em Note :
A couple host toolchain components are not yet available in the tools
directory. Also, some tools use non-POSIX, non-ANSI C extensions
and need to be standardized. As a result, cross-compiling from
systems other than
.Nx
is not currently supported.
.Ed
.
.Sh FILES
.
.Ss Source tree layout
.
.Bl -tag -width "BUILDING.mdoc"
.It Sy BUILDING.mdoc
This document (in -mdoc troff format; the original copy).
.It Sy BUILDING
This document (in plaintext).
.It Sy Makefile
The main Makefile for
.Nx ;
should only be run for native builds with an appropriately up-to-date
version of
.Nx
.Xr make 1 .
(For building from out-of-date systems or on a non-native host, see the
.Nm build.sh
shell script.)
.It Sy UPDATING
Special notes for updating from an earlier revision of
.Nx .
It is important to read this file before every build of an updated
source tree.
.It Sy build.sh
Bourne-compatible shell script used for building the host build tools
and the
.Nx
system from scratch. Can be used for both native and cross builds, and
should be used instead of
.Xr make 1
for any source tree that is updated and recompiled regularly.
.It Sy crypto/dist/ , dist/ , gnu/dist/
Sources imported verbatim from third parties, without mangling the
existing build structure. Other source trees in
.Sy bin
through
.Sy usr.sbin
use the
.Nx
.Xr make 1
.Dq reachover
Makefile semantics when building these programs for a native host.
.It Sy distrib/ , etc/
Sources for items used when making a full release snapshot, such as
files installed in
.Sy /etc
on the destination system, boot media, and release notes.
.It Sy regress/
Regression test harness. Can be cross-compiled, but only run natively.
.It Sy sys/
.Nx
kernel sources.
.It Sy tools/
.Dq Reachover
build structure for the host build tools. This has a special method of
determining out-of-date status.
.It Sy bin/ ... usr.sbin/
Sources to the
.Nx
userland (non-kernel) programs. If any of these directories are
missing, they will be skipped during the build.
.El
.
.Ss Build tree layout
.
The
.Nx
build tree is described in
.Xr hier 7 ,
and the release layout is described in
.Xr release 7 .
.Pp
.
.Sh CONFIGURATION
.
.Ss Environment variables
..
Several environment variables control the behaviour of
.Nx
builds.
.
.Bl -tag -width "MAKEOBJDIRPREFIX"
.
.It Sy MACHINE
Machine type.
.
.It Sy MACHINE_ARCH
Machine architecture.
.
.It Sy MAKE
Path name to invoke
.Xr make 1
as.
.
.It Sy MAKEFLAGS
Flags to invoke
.Xr make 1
with.
.
.It Sy MAKEOBJDIR
Directory to use as the
.Sy .OBJDIR
for the current directory.
Used only if
.Sy MAKEOBJDIRPREFIX
is not defined.
.Sy MAKEOBJDIR
can only be provided in the environment.
.
.It Sy MAKEOBJDIRPREFIX
Top level directory of the object directory tree.
If this is defined,
${MAKEOBJDIRPREFIX}/${.CURDIR}
is used as the
.Sy .OBJDIR
for the current directory.
The current directory may be read only.
.Sy MAKEOBJDIRPREFIX
can only be provided in the environment.
.
.El
.
.Ss \*qmake\*q variables
.
.de YorN
Can be set to
.Dq yes
or
.Dq no .
..
.de DFLT
.Pp
.Em Default :
..
.de DFLTu
.DFLT
Unset.
..
.de DFLTy
.DFLT
.Dq yes
..
.de DFLTn
.DFLT
.Dq no
..
Several variables control the behavior of
.Nx
builds. Unless otherwise specified, these variables may be set in
either the process environment or the
.Xr make 1
configuration file specified by
.Sy MAKECONF .
.
.Bl -tag -width "MKCATPAGES"
.
.It Sy BUILDID
Identifier for the build. The identifier will be appended to
object directory names, and can be consulted in the
.Xr make 1
configuration file in order to set additional build parameters,
such as compiler flags.
.
.It Sy DESTDIR
Directory to contain the built
.Nx
system. If set, special options are passed to the compilation tools to
prevent their default use of the host system's
.Sy /usr/include , /usr/lib ,
and so forth. This pathname should
.Em not
end with a slash
.Pq /
character (for installation into the system's root directory, set
.Sy DESTDIR
to an empty string).
The directory must reside on a file system which supports long file
names and hard links.
.DFLT
Empty string if
.Sy USETOOLS
is
.Dq yes ;
unset otherwise.
.
.It Sy MAKECONF
The name of the
.Xr make 1
configuration file.
.Em Only settable in the process environment.
.DFLT
.Dq /etc/mk.conf
.
.It Sy MKCATPAGES
.YorN
Indicates whether preformatted plaintext manual pages will be created
during a build.
.DFLTy
.
.It Sy MKCRYPTO
.YorN
Indicates whether cryptographic code will be included in a build;
provided for the benefit of countries that do not allow strong
cryptography. Will not affect use of the standard low-security password
encryption system,
.Xr crypt 3 .
.DFLTy
.
.It Sy MKDOC
.YorN
Indicates whether system documentation destined for
.Sy /usr/share/doc
will be installed during a build.
.DFLTy
.
.It Sy MKHOSTOBJ
.YorN
If set to
.Dq yes ,
then for programs intended to be run on the compile host,
the name, release, and architecture of the host operating system
will be suffixed to the name of the object directory created by
.Dq make obj .
(This allows multiple host systems to compile NetBSD for a single target.)
If set to
.Dq no ,
then programs built to be run on the compile host will use the same
object directory names as programs built to be run on the target.
.DFLTn
.
.It Sy MKINFO
.YorN
Indicates whether GNU Info files, used for the documentation for
most of the compilation tools, will be created and installed during a
build.
.DFLTy
.
.It Sy MKLINT
.YorN
Indicates whether
.Xr lint 1
will be run against portions of the
.Nx
source code during the build, and whether lint libraries will be
installed into
.Sy /usr/libdata/lint .
.DFLTy
.
.It Sy MKMAN
.YorN
Indicates whether manual pages will be installed during a build.
.DFLTy
.
.It Sy MKNLS
.YorN
Indicates whether Native Language System locale zone files will be
compiled and installed during a build.
.DFLTy
.
.It Sy MKOBJ
.YorN
Indicates whether object directories will be created when running
.Dq make obj .
If set to
.Dq no ,
then all built files will be located inside the regular source tree.
.DFLTy
.
.It Sy MKPIC
.YorN
Indicates whether shared objects and libraries will be created and
installed during a build. If set to
.Dq no ,
the entire built system will be statically linked.
.DFLT
Platform dependent. As of this writing, all platforms except
.Sy sh3
default to
.Dq yes .
.
.It Sy MKPICINSTALL
.YorN
Indicates whether the
.Xr ar 1
format libraries
.Sy ( lib*_pic.a ) ,
used to generate shared libraries, are installed during a build.
.DFLTy
.
.It Sy MKPROFILE
.YorN
Indicates whether profiled libraries
.Sy ( lib*_p.a )
will be built and installed during a build.
.DFLT
.Dq yes ;
however, some platforms turn off
.Sy MKPROFILE
by default at times due to toolchain problems with profiled code.
.
.It Sy MKSHARE
.YorN
Indicates whether files destined to reside in
.Sy /usr/share
will be built and installed during a build. If set to
.Dq no ,
then all of
.Sy MKCATPAGES , MKDOC , MKINFO , MKMAN ,
and
.Sy MKNLS
will be set to
.Dq no
unconditionally.
.DFLTy
.
.It Sy TOOLDIR
Directory to hold the host tools, once built. This directory should be
unique to a given host system and
.Nx
source tree. (However, multiple targets may share the same
.Sy TOOLDIR ;
the target-dependent files have unique names.) If unset, a default based
on the
.Xr uname 1
information of the host platform will be created in the
.Sy .OBJDIR
of
.Sy src/tools .
.DFLTu
.
.It Sy UNPRIVED
If set, then an unprivileged install will occur.
The user, group, permissions, and file flags, will not be set on
the installed item; instead the information will be appended to
a file called
.Pa METALOG
in
.Sy DESTDIR .
The contents of
.Pa METALOG
is used during the generation of the distribution tar files to ensure
that the appropriate file ownership is stored.
.DFLTu
.
.It Sy UPDATE
If set, then all install operations intended to write to
.Sy DESTDIR
will compare file timestamps before installing, and skip the install
phase if the destination files are up-to-date. This also has
implications on full builds (see next subsection).
.DFLTu
.
.It Sy USETOOLS
Indicates whether the tools specified by
.Sy TOOLDIR
should be used as part of a build in progress. Must be set to
.Dq yes
if cross-compiling.
.Bl -tag -width "never"
.It Sy yes
Use the tools from
.Sy TOOLDIR .
.It Sy no
Do not use the tools from
.Sy TOOLDIR ,
but refuse to build native compilation tool components that are
version-specific for that tool.
.It Sy never
Do not use the tools from
.Sy TOOLDIR ,
even when building native tool components. This is similar to the
traditional
.Nx
build method, but does
.Em not
verify that the compilation tools in use are up-to-date enough in order
to build the tree successfully. This may cause build or runtime
problems when building the whole
.Nx
source tree.
.El
.DFLT
.Dq yes
if building all or part of a whole
.Nx
source tree (detected automatically);
.Dq no
otherwise (to preserve traditional semantics of the
.Aq bsd.*.mk
.Xr make 1
include files).
.
.El
.
.Ss \*qmake\*q variables for full builds
These variables only affect the top level
.Dq Makefile
and do not affect manually building subtrees of the
.Nx
source code.
.
.Bl -tag -width "NODISTRIBDIRS"
.
.It Sy MKOBJDIRS
.YorN
Indicates whether object directories will be created automatically
(via a
.Dq make obj
pass) at the start of a build.
.DFLTy
.
.It Sy NBUILDJOBS
Now obsolete. Use the
.Xr make 1
option
.Sy -j ,
instead (see below)
.DFLTu
.
.It Sy NOCLEANDIR
If set, avoids the
.Dq make cleandir
phase of a full build. This has the effect of allowing only changed
files in a source tree to be recompiled. This can speed up builds when
updating only a few files in the tree.
.DFLTu
.
.It Sy NODISTRIBDIRS
If set, avoids the
.Dq make distrib-dirs
phase of a full build. This skips running
.Xr mtree 8
on
.Sy DESTDIR ,
useful on systems where building as an unprivileged user, or where it is
known that the system-wide mtree files have not changed.
.DFLTu
.
.It Sy NOINCLUDES
If set, avoids the
.Dq make includes
phase of a full build. This has the effect of preventing
.Xr make 1
from thinking that some programs are out-of-date simply because the
system include files have changed. However, this option should not be
used when updating the entire
.Nx
source tree arbitrarily; it is suggested to use
.Sy UPDATE
in that case.
.DFLTu
.
.It Sy RELEASEDIR
If set, specifies the directory to which a
.Xr release 7
layout will be written at the end of a
.Dq make release .
.DFLTu
.
.It Sy UPDATE
If set, then in addition to the effects described for UPDATE above, this
implies the effects of
.Sy NOCLEANDIR .
.
.El
.
.Sh BUILDING
.
.Ss \*qmake\*q command line options
This is only a summary of options available to
.Xr make 1 ;
only the options used most frequently with
.Nx
builds are listed here.
.
.Bl -tag -width "var=value"
.
.It Sy -j Em njob
Run up to
.Em njob
.Xr make 1
subjobs in parallel.
Makefiles should use .WAIT or have explicit dependancies
as necessary to enforce build ordering.
If you see build failures with -j, please save complete build logs
so the failures can be analyzed.
.
.It Sy -m Em dir
Specify the default directory for searching for system Makefile
segments, mainly the
.Aq bsd.*.mk
files. When building any full
.Nx
source tree, this should be set to the
.Dq share/mk
directory in the source tree. (This is set automatically when building
from the top level.)
.
.It Sy -n
Display the commands that would have been executed, but do not
actually execute them. This will still cause recursion to take place.
.
.It Sy -v Em var
Print
.Xr make 1 Ns 's
idea of the value of
.Em var .
Does not build any targets.
.
.It Em var=value
Set the variable
.Em var
to
.Em value ,
overriding any setting specified by the process environment, the
.Sy MAKECONF
configuration file, or the system Makefile segments.
.
.El
.
.Ss \*qmake\*q targets
.
These default targets may be built by running
.Xr make 1
in any subtree of the
.Nx
source code. It is recommended that none of these be used from the top
level Makefile; as a specific exception,
.Dq make obj
and
.Dq make cleandir
are useful in that context.
.
.Bl -tag -width "dependall"
.
.It Sy all
Build programs, libraries, and preformatted documentation.
.
.It Sy clean
Remove program and library object code files.
.
.It Sy cleandir
Same as
.Sy clean ,
but also remove preformatted documentation, dependency files generated
by
.Dq make depend ,
and any other files known to be created at build time.
.Dq make distclean
may be used as a synonym, for familiarity with a similar well-known
convention.
.
.It Sy depend
Create dependency files
.Sy ( .depend )
containing more detailed information about the dependencies of source
code on header files. Allows programs to be recompiled automatically
when a dependency changes.
.
.It Sy dependall
Does a
.Dq make depend
immediately followed by a
.Dq make all .
This improves cache locality of the build since both passes read the source
files in their entirety.
.
.It Sy includes
Build and install system header files. Typically needed before any
system libraries or programs can be built.
.
.It Sy install
Install programs, libraries, and documentation into
.Sy DESTDIR .
.
.It Sy lint
Run
.Xr lint 1
against the C source code, where appropriate, and generate
system-installed lint libraries.
.
.It Sy obj
Create object directories to be used for built files, instead of
building directly in the source tree.
.
.It Sy tags
Create
.Xr ctags 1
searchable function lists usable by the
.Xr ex 1
and
.Xr vi 1
text editors.
.
.El
.
.Ss \*qmake\*q targets for the top level
.
Additional
.Xr make 1
targets are usable specifically from the top source level to facilitate
building the entire
.Nx
source tree.
.
.Bl -tag -width "dependall"
.
.It Sy build
Build the entire
.Nx
system. This orders portions of the source tree such that prerequisites
will be built in the proper order.
.
.It Sy release
Do a
.Dq make build ,
then package the system into a standard release layout as described by
.Xr release 7 .
This requires that
.Sy RELEASEDIR
be set (see above).
.
.It Sy regression-tests
Can only be run after building the regression tests in the directory
.Dq regress .
Runs the compiled regression tests on the local host.
.
.El
.
.Ss The \*qbuild.sh\*q script
.
This script file is a Bourne shell script designed to build the
entire
.Nx
system on any host with a Bourne shell in
.Sy /bin/sh ,
including many that are not POSIX compliant. Note that if a host
system's
.Sy /bin/sh
is unusually old and broken, the Korn Shell
.Sy ( /bin/ksh ) ,
if available, may be a usable alternative.
.Pp
All cross-compile builds, and most native builds, of the entire system
should make use of
.Sy build.sh
rather than just running
.Dq make .
This way, the
.Xr make 1
program will be bootstrapped properly, in case the host system has an
older or incompatible
.Dq make
program.
.Pp
When compiling the entire system via
.Sy build.sh ,
many
.Xr make 1
variables are set for you in order to help encapsulate the build
process. In the list of options below, variables that are automatically
set by
.Sy build.sh
are noted where applicable.
.Pp
The following are available command line options that may be supplied to
.Sy build.sh :
.
.Bl -tag -width "-T tools"
.
.It Sy -a Em arch
Set the value of
.Sy MACHINE_ARCH
to
.Em arch .
.
.It Sy -B Em buildid
Set the value of
.Sy BUILDID
to
.Em buildid .
This will also append the build idenfitier to the name of the
.Dq make
wrapper script so that the resulting name is of the form
.Dq Sy nbmake-MACHINE-BUILDID .
.
.It Sy -b
Bootstrap
.Dq make
and create a
.Sy nbmake-MACHINE
script (see below).
.
.It Sy -d
Build a full distribution. This differs from a normal build in that
etc files will also be installed. Note this does not build a
.Dq release ;
no release sets are placed in ${RELEASEDIR}.
.
.It Sy -j Em njob
Passed through to
.Xr make 1 .
Makefiles should use .WAIT or have explicit dependancies
as necessary to enforce build ordering.
If you see build failures with -j, please save complete build logs
so the failures can be analyzed.
.
.It Sy -m Em mach
Set the value of
.Sy MACHINE
to
.Em mach .
This will also override any value of
.Sy MACHINE_ARCH
in the process environment with a value deduced from
.Em mach ,
unless
.Sy -a
is specified. All cross builds require
.Sy -m ,
but if unset on a NetBSD host, the host's value of MACHINE will be
detected and used automatically.
.
.It Sy -n
Show the commands that would be executed by
.Sy build.sh ,
but do not make any changes. This is similar in concept to
.Dq make -n .
.
.It Sy -o
Set the value of
.Sy MKOBJDIRS
to
.Dq no .
.
.It Sy -r
Remove the contents of
.Sy DESTDIR
and
.Sy TOOLDIR
before building (provides a clean starting point). This will skip deleting
.Sy DESTDIR
if building on a native system to the root directory.
.
.It Sy -t
Build and install the host tools from
.Sy src/tools
only. This option implies
.Sy -b .
.
.It Sy -u
Set the
.Sy UPDATE
variable.
.
.It Sy -w Em wrapper
Create the nbmake wrapper script (see below) in a custom location,
specified by
.Em wrapper .
This allows, for instance, to place the wrapper in
.Sy PATH
automatically. Note that
.Em wrapper
is the full name of the file, not just a directory name.
.
.It Sy -D Em dest
Set the value of
.Sy DESTDIR
to
.Em dest .
.
.It Sy -M Em obj
Set
.Sy MAKEOBJDIRPREFIX
to
.Em obj .
.
.It Sy -O Em obj
Create an appropriate transform macro for
.Sy MAKEOBJDIR
that will place the built object files under
.Em obj .
For instance, a setting of
.Sy /usr/obj
will place build-time files under
.Sy /usr/obj/bin , /usr/obj/lib ,
and so forth.
.
.It Sy -R Em rel
Set the value of
.Sy RELEASEDIR
to
.Em rel .
Setting this option will cause
.Sy build.sh
to run
.Dq make release
instead of
.Dq make build .
.
.It Sy -T Em tools
Set the value of
.Sy TOOLDIR
to
.Em tools .
If set, the bootstrap
.Dq make
will only be rebuilt as needed (when the source files for
.Xr make 1
change).
.
.It Sy -U
Set the
.Sy UNPRIVED
variable.
.
.El
.
.Ss The \*qnbmake-MACHINE\*q wrapper script
.
If using the
.Sy build.sh
script to build
.Nx ,
a
.Sy nbmake-MACHINE
script will be created in
.Sy TOOLDIR/bin
upon the first build to assist in building subtrees on a cross-compile
host.
.Pp
.Sy nbmake-MACHINE
can be invoked in lieu of
.Xr make 1 ,
and will instead call the up-to-date version of
.Dq nbmake
installed into
.Sy TOOLDIR/bin
with several key variables pre-set, including
.Sy MACHINE , MACHINE_ARCH ,
and
.Sy TOOLDIR .
This script can be symlinked into a directory listed in
.Sy PATH ,
or called with an absolute path.
.
.Sh OBSOLETE VARIABLES
.
.Bl -tag -width "NBUILDJOBS"
.
.It Sy NBUILDJOBS
Now obsolete. Use the
.Xr make 1
option
.Sy -j ,
instead.
.El
.Sh SEE ALSO
.Xr make 1 ,
.Xr hier 7 ,
.Xr release 7
.
.Sh HISTORY
.
The
.Sy USE_NEW_TOOLCHAIN
based build scheme was introduced in the
.Dq Nx Ns -current
development sources between
.Nx 1.5
and
.Nx 1.6 .
.
.Sh BUGS
.
A few platforms are not yet using the
.Sy USE_NEW_TOOLCHAIN
system.