/
bsd.README
1465 lines (1012 loc) · 47.5 KB
/
bsd.README
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
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# $NetBSD: bsd.README,v 1.196 2007/07/29 17:06:01 joerg Exp $
# @(#)bsd.README 8.2 (Berkeley) 4/2/94
This is the README file for the new (as of 1993) make "include" files
for the BSD source tree. The files are installed in /usr/share/mk, and
are, by convention, named with the suffix ".mk".
Note, this file is not intended to replace reading through the .mk
files for anything tricky.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
RANDOM THINGS WORTH KNOWING:
The files are simply C-style #include files, and pretty much behave like
you'd expect. The syntax is slightly different in that a single '.' is
used instead of the hash mark, i.e. ".include <bsd.prog.mk>".
One difference that will save you lots of debugging time is that inclusion
of the file is normally done at the *end* of the Makefile. The reason for
this is because .mk files often modify variables and behavior based on the
values of variables set in the Makefile. To make this work, remember that
the FIRST target found is the target that is used, i.e. if the Makefile has:
a:
echo a
a:
echo a number two
the command "make a" will echo "a". To make things confusing, the SECOND
variable assignment is the overriding one, i.e. if the Makefile has:
a= foo
a= bar
b:
echo ${a}
the command "make b" will echo "bar". This is for compatibility with the
way the V7 make behaved.
It's fairly difficult to make the BSD .mk files work when you're building
multiple programs in a single directory. It's a lot easier to split up the
programs than to deal with the problem. Most of the agony comes from making
the "obj" directory stuff work right, not because we switched to a new version
of make. So, don't get mad at us, figure out a better way to handle multiple
architectures so we can quit using the symbolic link stuff. (Imake doesn't
count.)
The file .depend in the source directory is expected to contain dependencies
for the source files. This file is read automatically by make after reading
the Makefile.
The variable DESTDIR works as before. It's not set anywhere but will change
the tree where the file gets installed.
The profiled libraries are no longer built in a different directory than
the regular libraries. A new suffix, ".po", is used to denote a profiled
object, and ".so" denotes a shared (position-independent) object.
There are various make variables used during the build.
Many variables support a (case sensitive) value of "no" or "yes",
and are tested with ${VAR} == "no" and ${VAR} != "no" .
The basic rule for the variable naming scheme is as follows:
MKxxx Can be set to "no" to disable functionality, or
"yes" to enable it.
Usually defaults to "yes", although some variables
default to "no".
Due to make(1) implementation issues, if a temporary
command-line override of a mk.conf or <bsd.own.mk>
setting is required whilst still honouring a particular
Makefile's setting of MKxxx, use
env MKxxx=value make
instead of
make MKxxx=value
NOxxx If defined, disables a feature.
Not intended for users.
This is to allow Makefiles to disable functionality
that they don't support (such as missing man pages).
NOxxx variables must be defined before <bsd.own.mk>
is included.
The following variables that control how things are made/installed that
are not set by default. These should not be set by Makefiles; they're for
the user to define in MAKECONF (see <bsd.own.mk>, below) or on the make(1)
command line:
BUILD If defined, 'make install' checks that the targets in the
source directories are up-to-date and remakes them if they
are out of date, instead of blindly trying to install
out of date or non-existent targets.
MAKEVERBOSE Control how "verbose" the standard make(1) rules are.
Default: 2
Supported values:
0 Minimal output ("quiet")
1 Describe what is occurring
2 Describe what is occurring and echo the actual command
MKBFD If "no", don't build libbfd, libiberty, or any of the things
that depend on them (binutils/gas/ld, gdb, dbsym, mdsetimage).
Default: yes
MKCATPAGES If "no", don't build or install the catman pages.
Default: yes
MKCRYPTO If "no", no cryptography support will be built into the system,
and also acts as "MKKERBEROS=no".
Default: yes
MKCRYPTO_IDEA If not "no", IDEA support will be built into libcrypto_idea.a.
Default: no
MKCRYPTO_MDC2 If not "no", MDC2 support will be built into libcrypto_mdc2.a
Default: no
MKCRYPTO_RC5 If not "no", RC5 support will be built into libcrypto_rc5.a.
Default: no
MKCVS If "no", don't build or install cvs(1).
Default: yes
MKDEBUG If "no", don't build and install separate debugging symbols
into /usr/libdata/debug.
Default: no
MKDEBUGLIB Build debugging libraries.
Default: no
MKDOC If "no", don't build or install the documentation.
Default: yes
MKDYNAMICROOT If "no", build programs in /bin and /sbin statically,
don't install certain libraries in /lib, and don't
install the shared linker into /libexec.
Default: yes
MKGCC If "no", don't build gcc(1) or any of the gcc-related
libraries (libgcc, libobjc, libstdc++).
Default: yes
MKGCCCMDS If "no", don't build gcc(1).
Default: yes
MKGDB If "no", don't build gdb(1).
Default: yes
MKHESIOD If "no", disables building of Hesiod infrastructure
(libraries and support programs).
Default: yes
MKHOSTOBJ If not "no", 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 "make obj".
Default: no
MKHTML If "no", don't build or install the html man pages.
Default: no
MKIEEEFP If "no", don't add code for IEEE754/IEC60559 conformance.
Has no effect on most platforms.
Default: yes
MKINET6 If "no", disables building of INET6 (IPv6) infrastructure
(libraries and support programs).
Default: yes
MKINFO If "no", don't build or install Info documentation from
Texinfo source files.
Default: yes
MKIPFILTER If "no", don't build or install the IP Filter programs and LKM.
Default: yes
MKISCSI If "no", don't build or install iscsi library or applications
(depends on libpthread.)
Default: yes
MKKERBEROS If "no", disables building of Kerberos v5
infrastructure (libraries and support programs).
Default: yes
MKLINKLIB If "no", act as "MKPICINSTALL=no MKPROFILE=no".
Also:
- don't install the .a libraries
- don't install _pic.a libraries on PIC systems
- don't build .a libraries on PIC systems
- don't install the .so symlink on ELF systems
I.e, only install the shared library (and the .so.major
symlink on ELF).
Default: yes
MKLINT If "no", don't build or install the lint libraries.
Default: yes
MKMAN If "no", don't build or install the man or catman pages,
and also acts as "MKCATPAGES=no MKHTML=no".
Default: yes
MKMANZ If not "no", compress manual pages at installation time.
Default: no
MKNLS If "no", don't build or install the NLS files and locale
definition files.
Default: yes
MKOBJ If "no", don't enable the rule which creates objdirs,
and also acts as "MKOBJDIRS=no".
Default: yes
MKOBJDIRS If "no", don't create objdirs during a "make build".
Default: no
MKPAM If "no", disables building of PAM authentication
infrastructure (libraries and support programs).
Default: yes
MKPF If "no", don't build or install the pf programs and LKM.
Default: yes
MKPIC If "no", don't build or install shared libraries, and
also acts as "MKPICLIB=no"
Default: yes (for MACHINE_ARCHs that support it)
MKPICINSTALL If "no", don't install the *_pic.a libraries.
Default: yes
MKPICLIB If "no", don't build *_pic.a libraries, and build the
shared object libraries from the .a libraries.
A symlink is installed in ${DESTDIR}/usr/lib for the
_pic.a library pointing to the .a library.
Default: yes
MKPOSTFIX If "no", don't build or install postfix(1).
Default: yes
MKPROFILE If "no", don't build or install the profiling (*_p.a) libraries.
Default: yes
MKPUFFS If "no", don't build librefuse (lib/librefuse) or
puffs applications (usr.sbin/puffs). NOTE: libpuffs
is always built due to historic reasons. This flag will
disappear once puffs is no longer considered experimental,
i.e. it will effectively default to "yes".
Default: no
MKSHARE If "no", act as "MKCATPAGES=no MKDOC=no MKHTML=no MKINFO=no
MKMAN=no MKNLS=no".
I.e, don't build catman pages, documentation, Info
documentation, man pages, NLS files, ...
Default: yes
MKSKEY If "no", disables building of S/key authentication
infrastructure (libraries and support programs).
Default: yes
MKSOFTFLOAT If not "no", build with options to enable the compiler to
generate output containing library calls for floating
point and possibly soft-float library support.
Default: no
MKSTATICLIB If "no", don't build or install the normal static (*.a)
libraries.
Default: yes
MKUNPRIVED If not "no", don't set the owner/group/mode when installing
files or directories, and keep a metadata log of what
the owner/group/mode should be. This allows a
non-root "make install".
Default: no
MKUPDATE If not "no", 'make install' only installs targets that are
more recently modified in the source directories that their
installed counterparts.
Default: no
MKX11 If not "no", 'make build' also descends into src/x11
to cross build X11R6 and automatically enables creation
of X sets.
Default: no
MKYP If "no", disables building of YP (NIS)
infrastructure (libraries and support programs).
Default: yes
USE_HESIOD If "no", disables building Hesiod support into
various system utilities/libraries that support it.
If ${MKHESIOD} is "no", USE_HESIOD will also be
forced to "no".
USE_INET6 If "no", disables building INET6 (IPv6) support into
various system utilities/libraries that support it.
If ${MKINET6} is "no", USE_INET6 will also be
forced to "no".
USE_KERBEROS If "no", disables building Kerberos v5
support into various system utilities/libraries that
support it. If ${MKKERBEROS} is "no", USE_KERBEROS
will also be forced to "no".
USE_PAM If "no", disables building PAM authentication support
into various system utilities/libraries that support it.
If ${MKPAM} is "no", USE_PAM will also be forced to "no".
USE_SKEY If "no", disables building S/key authentication
support into various system utilities/libraries that
support it. If ${MKSKEY} is "no", USE_SKEY will
also be forced to "no".
USE_SSP If "no", disables gcc stack protection code, which
detects stack overflows and aborts the program. This
imposes some performance penalty.
Default: no
USE_YP If "no", disables building YP (NIS) support into
various system utilities/libraries that support it.
If ${MKYP} is "no", USE_YP will also be forced to "no".
COPTS.lib<lib>
OBJCOPTS.lib<lib>
LDADD.lib<lib>
CPPFLAGS.lib<lib>
CXXFLAGS.lib<lib>
COPTS.<prog>
OBJCCOPTS.<prog>
LDADD.<prog>
CPPFLAGS.<prog>
CXXFLAGS.<prog> These provide a way to specify additions to the associated
variables in a way that applies only to a particular library
or program. <lib> corresponds to the LIB variable set in
the library's makefile. <prog> corresponds to either PROG
or PROG_CXX (if set). For example, if COPTS.libcrypto is
set to "-g", "-g" will be added to COPTS only when compiling
the crypto library.
=-=-=-=-= sys.mk =-=-=-=-=
The include file <sys.mk> has the default rules for all makes, in the BSD
environment or otherwise. You probably don't want to touch this file.
=-=-=-=-= bsd.own.mk =-=-=-=-=
The include file <bsd.own.mk> contains source tree configuration parameters,
such as the owners, groups, etc. for both manual pages and binaries, and
a few global "feature configuration" parameters.
It has no targets.
To get system-specific configuration parameters, <bsd.own.mk> will try to
include the file specified by the "MAKECONF" variable. If MAKECONF is not
set, or no such file exists, the system make configuration file, /etc/mk.conf
is included. These files may define any of the variables described below.
<bsd.own.mk> sets the following variables, if they are not already defined
(defaults are in brackets):
NETBSDSRCDIR Top of the NetBSD source tree.
If _SRC_TOP_ != "", that will be used as the default,
otherwise BSDSRCDIR will be used as the default.
Various makefiles within the NetBSD source tree will
use this to reference the top level of the source tree.
_SRC_TOP_ Top of the system source tree, as determined by <bsd.own.mk>
based on the presence of tools/ and build.sh. This variable
is "internal" to <bsd.own.mk>, although its value is only
determined once and then propagated to all sub-makes.
BSDSRCDIR The real path to the system sources, so that 'make obj'
will work correctly. [/usr/src]
BSDOBJDIR The real path to the system 'obj' tree, so that 'make obj'
will work correctly. [/usr/obj]
BINGRP Binary group. [wheel]
BINOWN Binary owner. [root]
BINMODE Binary mode. [555]
NONBINMODE Mode for non-executable files. [444]
MANDIR Base path for manual installation. [/usr/share/man/cat]
MANGRP Manual group. [wheel]
MANOWN Manual owner. [root]
MANMODE Manual mode. [${NONBINMODE}]
MANINSTALL Manual installation type: maninstall, catinstall, or both
[maninstall catinstall]
LDSTATIC Control program linking; if set blank, link everything
dynamically. If set to "-static", link everything statically.
If not set, programs link according to their makefile.
LIBDIR Base path for library installation. [/usr/lib]
LINTLIBDIR Base path for lint(1) library installation. [/usr/libdata/lint]
LIBGRP Library group. [${BINGRP}]
LIBOWN Library owner. [${BINOWN}]
LIBMODE Library mode. [${NONBINMODE}]
DOCDIR Base path for system documentation (e.g. PSD, USD, etc.)
installation. [/usr/share/doc]
HTMLDOCDIR Base path for html system documentation installation.
[/usr/share/doc/html]
DOCGRP Documentation group. [wheel]
DOCOWN Documentation owner. [root]
DOCMODE Documentation mode. [${NONBINMODE}]
NLSDIR Base path for Native Language Support files installation.
[/usr/share/nls]
NLSGRP Native Language Support files group. [wheel]
NLSOWN Native Language Support files owner. [root]
NLSMODE Native Language Support files mode. [${NONBINMODE}]
X11SRCDIR The path to the xsrc tree. [/usr/xsrc]
X11SRCDIR.xc The path to the X11R6 xc src tree. [${X11SRCDIR}/xfree/xc]
X11SRCDIR.local The path to the local X11R6 src tree. [${X11SRCDIR}/local]
X11ROOTDIR Root directory of the X11 installation. [/usr/X11R6]
X11BINDIR X11 bin directory. [${X11ROOTDIR}/bin]
X11FONTDIR X11 font directory. [${X11ROOTDIR}/lib/X11/fonts]
X11INCDIR X11 include directory. [${X11ROOTDIR}/include]
X11LIBDIR X11 lib/x11 (config) directory. [${X11ROOTDIR}/lib/X11]
X11MANDIR X11 manual directory. [${X11ROOTDIR}/man]
X11USRLIBDIR X11 library directory. [${X11ROOTDIR}/lib]
STRIPFLAG The flag passed to the install program to cause the binary
to be stripped. This is to be used when building your
own install script so that the entire system can be made
stripped/not-stripped using a single knob. []
COPY The flag passed to the install program to cause the binary
to be copied rather than moved. This is to be used when
building our own install script so that the entire system
can either be installed with copies, or with moves using
a single knob. [-c]
MAKEDIRTARGET dir target [params]
Runs "cd $${dir} && ${MAKE} [params] $${target}",
displaying a "pretty" message whilst doing so.
RELEASEMACHINEDIR
Subdirectory used below RELEASEDIR when building
a release. [${MACHINE}]
RELEASEMACHINE Subdirectory or path component used for the following
paths:
distrib/${RELEASEMACHINE}
distrib/notes/${RELEASEMACHINE}
etc/etc.${RELEASEMACHINE}
Used when building a release. [${MACHINE}]
Additionally, the following variables may be set by <bsd.own.mk> or in a
make configuration file to modify the behaviour of the system build
process (default values are in brackets along with comments, if set by
<bsd.own.mk>):
USETOOLS Indicates whether the tools specified by ${TOOLDIR} should
be used as part of a build in progress.
Supported values:
yes Use the tools from TOOLDIR.
Must be set to this if cross-compiling.
no Do not use the tools from TOOLDIR, but refuse to
build native compilation tool components that are
version-specific for that tool.
never Do not use the tools from TOOLDIR, even when
building native tool components. This is similar to
the traditional NetBSD build method, but does 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 NetBSD source tree.
Default: "yes" if building all or part of a whole NetBSD
source tree (detected automatically); "no" otherwise
(to preserve traditional semantics of the <bsd.*.mk>
make(1) include files).
OBJECT_FMT Object file format. [set to "ELF" on architectures that
use ELF -- currently all architectures but ns32k, set to
"a.out" on ns32k].
TOOLCHAIN_MISSING
If not "no", this indicates that the platform being built
does not have a working in-tree toolchain. If the
${MACHINE_ARCH} in question falls into this category,
TOOLCHAIN_MISSING is conditionally assigned the value "yes".
Otherwise, the variable is unconditionally assigned the
value "no".
If not "no", ${MKBFD}, ${MKGCC}, and ${MKGDB} are
unconditionally assigned the value "no".
EXTERNAL_TOOLCHAIN
This variable is not directly set by <bsd.own.mk>, but
including <bsd.own.mk> is the canonical way to gain
access to this variable. The variable should be defined
either in the user's environment or in the user's mk.conf
file. If defined, this variable indicates the root of
an external toolchain which will be used to build the
tree. For example, if a platform is a ${TOOLCHAIN_MISSING}
platform, EXTERNAL_TOOLCHAIN can be used to re-enable the
cross-compile framework.
If EXTERNAL_TOOLCHAIN is defined, ${MKGCC} is unconditionally
assigned the value "no", since the external version of the
compiler may not be able to build the library components of
the in-tree compiler.
NOTE: This variable is not yet used in as many places as
it should be. Expect the exact semantics of this variable
to change in the short term as parts of the cross-compile
framework continue to be cleaned up.
<bsd.own.mk> is generally useful when building your own Makefiles so that
they use the same default owners etc. as the rest of the tree.
=-=-=-=-= bsd.dep.mk =-=-=-=-=
The include file <bsd.dep.mk> contains the default targets for building
.depend files. It creates .d files from entries in SRCS and DPSRCS
that are C, C++, or Objective C source files, and builds .depend from the
.d files. All other files in SRCS and all of DPSRCS will be used as
dependencies for the .d files. In order for this to function correctly,
it should be .included after all other .mk files and directives that may
modify SRCS or DPSRCS. It uses the following variables:
SRCS List of source files to build the program.
DPSRCS List of source files which are needed for generating
dependencies, but are not needed in ${SRCS}.
=-=-=-=-= bsd.files.mk =-=-=-=-=
The include file <bsd.files.mk> handles the FILES variables and is included
from <bsd.lib.mk> and <bsd.prog.mk>, and uses the following variables:
FILES The list of files to install.
CONFIGFILES Similar semantics to FILES, except that the files
are installed by the `configinstall' target,
not the `install' target.
The FILES* variables documented below also apply.
FILESOWN File owner. [${BINOWN}]
FILESGRP File group. [${BINGRP}]
FILESMODE File mode. [${BINMODE}]
FILESDIR The location to install the files.
FILESNAME Optional name to install each file as.
FILESOWN_<fn> File owner of the specific file <fn>.
FILESGRP_<fn> File group of the specific file <fn>.
FILESMODE_<fn> File mode of the specific file <fn>.
FILESDIR_<fn> The location to install the specific file <fn>>
FILESNAME_<fn> Optional name to install <fn> as.
BUILDSYMLINKS List of two word items:
lnsrc lntgt
For each lnsrc item, create a symlink named lntgt.
The lntgt symlinks are removed by the cleandir target.
UUDECODE_FILES List of files which are stored as <file>.uue in the source
tree. Each one will be decoded with ${TOOL_UUDECODE}.
The source files have a `.uue' suffix, the generated files do
not.
UUDECODE_FILES_RENAME_fn Rename the output from the decode to the provided name.
*NOTE: These files are simply decoded, with no install or other
rule applying implicitly except being added to the clean
target.
=-=-=-=-= bsd.gcc.mk =-=-=-=-=
The include file <bsd.gcc.mk> computes various parameters related to GCC
support libraries. It defines no targets. <bsd.own.mk> MUST be included
before <bsd.gcc.mk>.
The primary users of <bsd.gcc.mk> are <bsd.prog.mk> and <bsd.lib.mk>, each
of which need to know where to find certain GCC support libraries.
The behavior of <bsd.gcc.mk> is influenced by the EXTERNAL_TOOLCHAIN variable,
which is generally set by the user. If EXTERNAL_TOOLCHAIN it set, then
the compiler is asked where to find the support libraries, otherwise the
support libraries are found in ${DESTDIR}/usr/lib.
<bsd.gcc.mk> sets the following variables:
_GCC_CRTBEGIN The full path name to crtbegin.o.
_GCC_CRTBEGINS The full path name to crtbeginS.o.
_GCC_CRTEND The full path name to crtend.o.
_GCC_CRTENDS The full path name to crtendS.o.
_GCC_LIBGCCDIR The directory where libgcc.a is located.
=-=-=-=-= bsd.inc.mk =-=-=-=-=
The include file <bsd.inc.mk> defines the includes target and uses the
variables:
INCS The list of include files.
INCSDIR The location to install the include files.
INCSNAME Target name of the include file, if only one; same as
FILESNAME, but for include files.
INCSYMLINKS Similar to SYMLINKS in <bsd.links.mk>, except that these
are installed in the 'includes' target and not the
(much later) 'install' target.
INCSNAME_<file> The name file <file> should be installed as, if not <file>,
same as FILESNAME_<file>, but for include files.
=-=-=-=-= bsd.info.mk =-=-=-=-=
The include file <bsd.info.mk> is used to generate and install GNU Info
documentation from respective Texinfo source files. It defines three
implicit targets (.txi.info, .texi.info, and .texinfo.info), and uses the
following variables:
TEXINFO List of Texinfo source files. Info documentation will
consist of single files with the extension replaced by
.info.
INFOFLAGS Flags to pass to makeinfo. []
=-=-=-=-= bsd.kernobj.mk =-=-=-=-=
The include file <bsd.kernobj.mk> defines variables related to the
location of kernel sources and object directories.
KERNSRCDIR Is the location of the top of the kernel src.
[${_SRC_TOP_}/sys]
KERNARCHDIR Is the location of the machine dependent kernel sources.
[arch/${MACHINE}]
KERNCONFDIR Is where the configuration files for kernels are found.
[${KERNSRCDIR}/${KERNARCHDIR}/conf]
KERNOBJDIR Is the kernel build directory. The kernel GENERIC for
instance will be compiled in ${KERNOBJDIR}/GENERIC.
The default value is
${MAKEOBJDIRPREFIX}${KERNSRCDIR}/${KERNARCHDIR}/compile
if it exists or the target 'obj' is being made.
Otherwise the default is
${KERNSRCDIR}/${KERNARCHDIR}/compile.
It is important that Makefiles (such as those under src/distrib) that
wish to find compiled kernels use <bsd.kernobj.mk> and ${KERNOBJDIR}
rather than make assumptions about the location of the compiled kernel.
=-=-=-=-= bsd.kinc.mk =-=-=-=-=
The include file <bsd.kinc.mk> defines the many targets (includes,
subdirectories, etc.), and is used by kernel makefiles to handle
include file installation. It is intended to be included alone, by
kernel Makefiles. It uses similar variables to <bsd.inc.mk>.
Please see <bsd.kinc.mk> for more details, and keep the documentation
in that file up to date.
=-=-=-=-= bsd.lib.mk =-=-=-=-=
The include file <bsd.lib.mk> has support for building libraries. It has
the same eight targets as <bsd.prog.mk>: all, clean, cleandir, depend,
includes, install, lint, and tags. Additionally, it has a checkver target
which checks for installed shared object libraries whose version is greater
that the version of the source. It has a limited number of suffixes,
consistent with the current needs of the BSD tree. <bsd.lib.mk> includes
<bsd.shlib.mk> to get shared library parameters.
It sets/uses the following variables:
LIB The name of the library to build.
LIBDIR Target directory for libraries.
SHLIBINSTALLDIR Target directory for shared libraries if ${USE_SHLIBDIR}
is not "no".
USE_SHLIBDIR If not "no", use ${SHLIBINSTALLDIR} instead of ${LIBDIR}
as the path to install shared libraries to.
USE_SHLIBDIR must be defined before <bsd.own.mk> is included.
Default: no
MKPRIVATELIB If not "no", act as "MKPROFILE=no MKPIC=no MKLINT=no",
and don't install the (.a) library.
This is useful for "build only" helper libraries.
Default: no
LINTLIBDIR Target directory for lint libraries.
LIBGRP Library group.
LIBOWN Library owner.
LIBMODE Library mode.
LDADD Additional loader objects.
MAN The manual pages to be installed (use a .1 - .9 suffix).
NOCHECKVER_<library>
NOCHECKVER If set, disables checking for installed shared object
libraries with versions greater than the source. A
particular library name, without the "lib" prefix, may
be appended to the variable name to disable the check for
only that library.
SRCS List of source files to build the library. Suffix types
.s, .c, and .f are supported. Note, .s files are preferred
to .c files of the same name. (This is not the default for
versions of make.)
LIBDPLIBS A list of the tuples:
libname path-to-srcdir-of-libname
For each tuple;
* LIBDO.libname contains the .OBJDIR of the library
`libname', and if it is not set it is determined
from the srcdir and added to MAKEOVERRIDES (the
latter is to allow for build time optimization).
* LDADD gets -L${LIBDO.libname} -llibname added.
* DPADD gets ${LIBDO.libname}/liblibname.so or
${LIBDO.libname}/liblibname.a added.
This variable may be used for individual libraries, as
well as in parent directories to cache common libraries
as a build-time optimization.
The include file <bsd.lib.mk> includes the file named "../Makefile.inc"
if it exists, as well as the include file <bsd.man.mk>.
It has rules for building profiled objects; profiled libraries are
built by default.
Libraries are ranlib'd when made.
=-=-=-=-= bsd.links.mk =-=-=-=-=
The include file <bsd.links.mk> handles the LINKS and SYMLINKS variables
and is included from from <bsd.lib.mk> and <bsd.prog.mk>.
LINKS The list of hard links, consisting of pairs of paths:
source-file target-file
${DESTDIR} is prepended to both paths before linking.
For example, to link /bin/test and /bin/[, use:
LINKS=/bin/test /bin/[
CONFIGLINKS Similar semantics to LINKS, except that the links
are installed by the `configinstall' target,
not the `install' target.
SYMLINKS The list of symbolic links, consisting of pairs of paths:
source-file target-file
${DESTDIR} is only prepended to target-file before linking.
For example, to symlink /usr/bin/tar to /bin/tar resulting
in ${DESTDIR}/usr/bin/tar -> /bin/tar:
SYMLINKS=/bin/tar /usr/bin/tar
CONFIGSYMLINKS Similar semantics to SYMLINKS, except that the symbolic links
are installed by the `configinstall' target,
not the `install' target.
=-=-=-=-= bsd.man.mk =-=-=-=-=
The include file <bsd.man.mk> handles installing manual pages and their
links.
It has a two targets:
maninstall:
Install the manual page sources and their links.
catinstall:
Install the preformatted manual pages and their links.
It sets/uses the following variables:
MANDIR Base path for manual installation.
MANGRP Manual group.
MANOWN Manual owner.
MANMODE Manual mode.
MANSUBDIR Subdirectory under the manual page section, i.e. "/vax"
or "/tahoe" for machine specific manual pages.
MAN The manual pages to be installed (use a .1 - .9 suffix).
MLINKS List of manual page links (using a .1 - .9 suffix). The
linked-to file must come first, the linked file second,
and there may be multiple pairs. The files are soft-linked.
The include file <bsd.man.mk> includes a file named "../Makefile.inc" if
it exists.
=-=-=-=-= bsd.obj.mk =-=-=-=-=
The include file <bsd.obj.mk> defines targets related to the creation
and use of separated object and source directories.
If an environment variable named MAKEOBJDIRPREFIX is set, make(1) uses
${MAKEOBJDIRPREFIX}${.CURDIR} as the name of the object directory if
it exists. Otherwise make(1) looks for the existence of a
subdirectory (or a symlink to a directory) of the source directory
into which built targets should be placed. If an environment variable
named MAKEOBJDIR is set, make(1) uses its value as the name of the
object directory; failing that, make first looks for a subdirectory
named "obj.${MACHINE}", and if that doesn't exist, it looks for "obj".
Object directories are not created automatically by make(1) if they
don't exist; you need to run a separate "make obj". (This will happen
during a top-level build if "MKOBJDIRS" is set to a value other than
"no"). When the source directory is a subdirectory of ${BSDSRCDIR} --
and this is determined by a simple string prefix comparison -- object
directories are created in a separate object directory tree, and a
symlink to the object directory in that tree is created in the source
directory; otherwise, "make obj" assumes that you're not in the main
source tree and that it's not safe to use a separate object tree.
Several variables used by <bsd.obj.mk> control exactly what
directories and links get created during a "make obj":
MAKEOBJDIR If set, this is the component name of the object
directory.
OBJMACHINE If this is set but MAKEOBJDIR is not set, creates
object directories or links named "obj.${MACHINE}";
otherwise, just creates ones named "obj".
USR_OBJMACHINE If set, and the current directory is a subdirectory of
${BSDSRCDIR}, create object directory in the
corresponding subdirectory of ${BSDOBJDIR}.${MACHINE};
otherwise, create it in the corresponding subdirectory
of ${BSDOBJDIR}
BUILDID If set, the contents of this variable are appended
to the object directory name. If OBJMACHINE is also
set, ".${BUILDID}" is added after ".${MACHINE}".
=-=-=-=-= bsd.prog.mk =-=-=-=-=
The include file <bsd.prog.mk> handles building programs from one or
more source files, along with their manual pages. It has a limited number
of suffixes, consistent with the current needs of the BSD tree.
<bsd.prog.mk> includes <bsd.shlib.mk> to get shared library parameters.
It has eight targets:
all:
build the program and its manual page. This also
creates a GDB initialization file (.gdbinit) in
the objdir. The .gdbinit file sets the shared library
prefix to ${DESTDIR} to facilitate cross-debugging.
clean:
remove the program, any object files and the files a.out,
Errs, errs, mklog, and ${PROG}.core.
cleandir:
remove all of the files removed by the target clean, as
well as .depend, tags, and any manual pages.
`distclean' is a synonym for `cleandir'.
depend:
make the dependencies for the source files, and store
them in the file .depend.
includes:
install any header files.
install:
install the program and its manual pages; if the Makefile
does not itself define the target install, the targets
beforeinstall and afterinstall may also be used to cause
actions immediately before and after the install target
is executed.
lint:
run lint on the source files
tags:
create a tags file for the source files.
It sets/uses the following variables:
BINGRP Binary group.
BINOWN Binary owner.
BINMODE Binary mode.
CLEANFILES Additional files to remove for the clean and cleandir targets.
COPTS Additional flags to the compiler when creating C objects.
COPTS.<fn> Additional flags to the compiler when creating the
C objects for <fn>.
For <fn>.[ly], "<fn>.c" must be used.
CPUFLAGS Additional flags to the compiler/assembler to select
CPU instruction set options, CPU tuning options, etc.
CPUFLAGS.<fn> Additional flags to the compiler/assembler for <fn>.
For <fn>.[ly], "<fn>.c" must be used.
CPPFLAGS Additional flags to the C pre-processor.
CPPFLAGS.<fn> Additional flags to the C pre-processor for <fn>.
For <fn>.[ly], "<fn>.c" must be used.
GDBINIT List of GDB initialization files to add to "source"
directives in the .gdbinit file that is created in the
objdir.
LDADD Additional loader objects. Usually used for libraries.
For example, to load with the compatibility and utility
libraries, use:
LDADD+=-lutil -lcompat
LDFLAGS Additional linker flags (passed to ${CC} during link).
LINKS See <bsd.links.mk>
OBJCOPTS Additional flags to the compiler when creating ObjC objects.
OBJCOPTS.<fn> Additional flags to the compiler when creating the
ObjC objects for <fn>.
For <fn>.[ly], "<fn>.c" must be used.
SYMLINKS See <bsd.links.mk>
MAN Manual pages (should end in .1 - .9). If no MAN variable is
defined, "MAN=${PROG}.1" is assumed.
PAXCTL_FLAGS If defined then paxctl(1) is ran on binary after link
time, with the value of the variable as args to it.
PAXCTL_FLAGS.${PROG} Custom override for PAXCTL_FLAGS.
PROG The name of the program to build. If not supplied, nothing
is built.
PROG_CXX If defined, the name of the program to build. Also
causes <bsd.prog.mk> to link the program with the C++
compiler rather than the C compiler. PROG_CXX overrides
the value of PROG if PROG is also set.
PROGNAME The name that the above program will be installed as, if
different from ${PROG}.