1#         $NetBSD: bsd.README,v 1.454 2025/01/28 20:34:55 christos Exp $
2#         @(#)bsd.README      8.2 (Berkeley) 4/2/94
3
4This is the README file for the make "include" files for the NetBSD
5source tree.  The files are installed in /usr/share/mk, and are,
6by convention, named with the suffix ".mk".
7
8Other sources of relevant documentation are BUILDING in the top
9level of the NetBSD source tree, and the mk.conf(5) man page.
10
11Note: this file is not intended to replace reading through the .mk
12files for anything tricky.
13
14=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
15
16RANDOM THINGS WORTH KNOWING:
17
18The files are simply C-style #include files, and pretty much behave like
19you'd expect.  The syntax is slightly different in that a single '.' is
20used instead of the hash mark, i.e. ".include <bsd.prog.mk>".
21
22One difference that will save you lots of debugging time is that inclusion
23of the file is normally done at the *end* of the Makefile.  The reason for
24this is because .mk files often modify variables and behavior based on the
25values of variables set in the Makefile.  To make this work, remember that
26the FIRST target found is the target that is used, i.e. if the Makefile has:
27
28          a:
29                    echo a
30          a:
31                    echo a number two
32
33the command "make a" will echo "a".  To make things confusing, the SECOND
34variable assignment is the overriding one, i.e. if the Makefile has:
35
36          a=        foo
37          a=        bar
38
39          b:
40                    echo ${a}
41
42the command "make b" will echo "bar".  This is for compatibility with the
43way the V7 make behaved.
44
45It's fairly difficult to make the BSD .mk files work when you're building
46multiple programs in a single directory.  It's a lot easier to split up the
47programs than to deal with the problem.  Most of the agony comes from making
48the "obj" directory stuff work right, not because we switched to a new version
49of make.  So, don't get mad at us, figure out a better way to handle multiple
50architectures so we can quit using the symbolic link stuff.  (Imake doesn't
51count.)
52
53The file .depend in the source directory is expected to contain dependencies
54for the source files.  This file is read automatically by make after reading
55the Makefile.
56
57The variable DESTDIR works as before.  It's not set anywhere but will change
58the tree where the file gets installed.
59
60The profiled libraries are no longer built in a different directory than
61the regular libraries.  A new suffix, ".po", is used to denote a profiled
62object, and ".pico" denotes a shared (position-independent) object.
63
64There are various make variables used during the build.
65
66Many variables support a (case sensitive) value of "no" or "yes",
67and are tested with  ${VAR} == "no"  and  ${VAR} != "no" .
68
69
70The basic rule for the variable naming scheme is as follows:
71
72HOST_<cmd>          A command that runs on the host machine regardless of
73                    whether or not the system is being cross compiled, or
74                    options for such a command.
75
76MK<feature>         Can be set to "no" to disable feature <feature>,
77                    or "yes" to enable feature <feature>.
78                    Usually defaults to "yes", although some variables
79                    default to "no".
80                    Due to make(1) implementation issues, if a temporary
81                    command-line override of a mk.conf(5) or <bsd.own.mk>
82                    setting is required whilst still honoring a particular
83                    Makefile's setting of MK<feature>, use
84                              env MK<feature>=value make
85                    instead of
86                              make MK<feature>=value
87
88NO<feature>         If defined, disables feature <feature>, overriding
89                    a user's MK<feature>=yes configuration.
90                    Not intended for users.
91                    This is to allow Makefiles to disable functionality
92                    that they don't support (such as missing man pages).
93                    NO<feature> variables must be defined before <bsd.own.mk>
94                    is included, which generally means define before
95                    any <*.mk> is included.
96                    See "Variables for a Makefile".
97
98TOOL_<tool>         A tool that is provided as part of the USETOOLS
99                    framework.  When not using the USETOOLS framework,
100                    TOOL_<tool> variables should refer to tools that are
101                    already installed on the host system.
102
103Various mk.conf(5) variables control the NetBSD system build.
104These should not be set by Makefiles; they're for the user to define
105in MAKECONF (see mk.conf(5) or <bsd.own.mk> documented below) or on
106the make(1) command line.
107
108The supported mk.conf(5) make variables are:
109
110          BSDOBJDIR, BSDSRCDIR, BUILD, BUILDID, BUILDINFO, BUILDSEED,
111          CDEXTRA, CONFIGOPTS, COPTS, CPUFLAGS, DESTDIR, EXTERNAL_TOOLCHAIN,
112          INSTALLBOOT_BOARDS, INSTALLWORLDDIR, KERNARCHDIR, KERNCONFDIR,
113          KERNEL_DIR, KERNOBJDIR, KERNSRCDIR, LOCALTIME, MAKEVERBOSE,
114          MKAMDGPUFIRMWARE, MKARGON2, MKARZERO, MKATF, MKBINUTILS, MKBSDGREP,
115          MKBSDTAR, MKCATPAGES, MKCLEANSRC, MKCLEANVERIFY, MKCOMPAT,
116          MKCOMPATMODULES, MKCOMPATTESTS, MKCOMPATX11, MKCOMPLEX, MKCROSSGDB,
117          MKCTF, MKCVS, MKCXX, MKDEBUG, MKDEBUGKERNEL, MKDEBUGLIB,
118          MKDEBUGTOOLS, MKDEPINCLUDES, MKDOC, MKDTB, MKDTC, MKDTRACE,
119          MKDYNAMICROOT, MKFIRMWARE, MKGCC, MKGCCCMDS, MKGDB, MKGROFF,
120          MKGROFFHTMLDOC, MKHESIOD, MKHOSTOBJ, MKHTML, MKIEEEFP, MKINET6,
121          MKINFO, MKIPFILTER, MKISCSI, MKKERBEROS, MKKMOD, MKKYUA, MKLDAP,
122          MKLIBCSANITIZER, MKLIBCXX, MKLIBSTDCXX, MKLINKLIB, MKLINT, MKLLVM,
123          MKLLVMRT, MKLVM, MKMAKEMANDB, MKMAN, MKMANDOC, MKMANZ, MKMDNS,
124          MKNLS, MKNOUVEAUFIRMWARE, MKNPF, MKNSD, MKOBJ, MKOBJDIRS, MKPAM,
125          MKPCC, MKPF, MKPIC, MKPICINSTALL, MKPICLIB, MKPIE, MKPIGZGZIP,
126          MKPOSTFIX, MKPROFILE, MKRADEONFIRMWARE, MKRELRO, MKREPRO,
127          MKREPRO_TIMESTAMP, MKRUMP, MKSANITIZER, MKSHARE, MKSKEY, MKSLJIT,
128          MKSOFTFLOAT, MKSTATICLIB, MKSTATICPIE, MKSTRIPIDENT, MKSTRIPSYM,
129          MKTEGRAFIRMWARE, MKTPM, MKUNBOUND, MKUNPRIVED, MKUPDATE, MKX11,
130          MKX11FONTS, MKX11MOTIF, MKXORG_SERVER, MKYP, MKZFS, NETBSDSRCDIR,
131          NETBSD_OFFICIAL_RELEASE, NOCLEANDIR, NODISTRIBDIRS, NOINCLUDES,
132          OBJMACHINE, RELEASEDIR, RUMPUSER_THREADS, RUMP_CURLWP, RUMP_DEBUG,
133          RUMP_DIAGNOSTIC, RUMP_KTRACE, RUMP_LOCKDEBUG, RUMP_LOCKS_UP,
134          RUMP_NBCOMPAT, RUMP_VIRTIF, RUMP_VNODE_LOCKDEBUG,
135          TOOLCHAIN_MISSING, TOOLDIR, USETOOLS, USE_FORT, USE_HESIOD,
136          USE_INET6, USE_JEMALLOC, USE_KERBEROS, USE_LDAP, USE_LIBCSANITIZER,
137          USE_PAM, USE_PIGZGZIP, USE_SANITIZER, USE_SKEY, USE_SSP,
138          USE_XZ_SETS, USE_YP, X11MOTIFPATH, X11SRCDIR.
139
140The obsolete mk.conf(5) make variables are:
141
142          EXTSRCSRCDIR, MKBFD, MKCRYPTO, MKEXTSRC, MKKDEBUG, MKKERBEROS4,
143          MKLLD, MKLLDB, MKMCLINKER, MKPERFUSE, MKTOOLSDEBUG, NBUILDJOBS,
144          SHAREDSTRINGS, USE_COMBINE, USE_NEW_TOOLCHAIN.
145
146Notable variables documented in mk.conf(5) and duplicated here:
147
148DESTDIR             Directory to contain the built NetBSD system.  If set,
149                    special options are passed to the compilation tools to
150                    prevent their default use of the host system's
151                    /usr/include, /usr/lib, and so forth.  This pathname must
152                    be an absolute path, and should not end with a slash (/)
153                    character.  (For installation into the system's root
154                    directory, set DESTDIR to an empty string, not to "/").
155                    The directory must reside on a file system which supports
156                    long file names and hard links.
157
158                    Note: build.sh will provide a default of
159                    "destdir.MACHINE" (in the top-level .OBJDIR) unless run
160                    in `expert' mode with the -E option.
161
162                    Default: Empty string if USETOOLS=yes; otherwise unset.
163
164RELEASEDIR          If set, specifies the directory to which a release(7)
165                    layout will be written at the end of a "make release".
166                    If specified, must be an absolute path.
167
168                    Note: build.sh will provide a default of "releasedir" (in
169                    the top-level .OBJDIR) unless run in `expert' mode with
170                    the -E option.
171
172                    Default: Unset.
173
174COPTS.lib<lib>
175OBJCOPTS.lib<lib>
176LDADD.lib<lib>
177CPPFLAGS.lib<lib>
178CXXFLAGS.lib<lib>
179COPTS.<prog>
180OBJCOPTS.<prog>
181LDADD.<prog>
182CPPFLAGS.<prog>
183CXXFLAGS.<prog> These provide a way to specify additions to the associated
184                    variables in a way that applies only to a particular library
185                    or program.  <lib> corresponds to the LIB variable set in
186                    the library's makefile.  <prog> corresponds to either PROG
187                    or PROG_CXX (if set).  For example, if COPTS.libcrypto is
188                    set to "-g", "-g" will be added to COPTS only when compiling
189                    the crypto library.
190                    See bsd.prog.mk below for more details about these variables.
191
192The active compiler is selected using the following variables:
193AVAILABLE_COMPILER
194                    List of available compiler suites.  Processed in order
195                    for selecting the active compiler for each frontend.
196HAVE_PCC  If defined, PCC is present and enabled.
197HAVE_LLVM If defined, LLVM/Clang is present and enabled.
198UNSUPPORTED_COMPILER.<comp>
199                    If defined, the support for compiler <comp> is disabled.
200
201For the frontends (CC, CPP, CXX, FC and OBJC) the following variables exist:
202ACTIVE_CC Active compile suite for the CC frontend.
203SUPPORTED_CC        Compile suite with support for the CC frontend.
204TOOL_CC.<comp>      Path to the CC frontend for compiler <comp>.
205
206
207=-=-=-=-=   Variables for a Makefile   =-=-=-=-=
208
209If the following varialbes are defined in the Makefile before
210any make(1) .include directives, they force the specific behavior.
211
212NOCOMPAT  Force MKCOMPAT=no.
213NOCTF               Force MKCTF=no.
214NODEBUG             Force MKDEBUG=no.
215NODEBUGLIB          Force MKDEBUGLIB=no.
216NODOC               Force MKDOC=no.
217NOFORT              Force USE_FORT=no.
218NOHTML              Force MKHTML=no.
219NOINFO              Force MKINFO=no.
220NOLIBCSANITIZER Force MKLIBCSANITIZER=no (and USE_LIBCSANITIZER=no)
221NOLINKLIB Force MKLINKLIB=no.
222NOLINT              Force MKLINT=no.
223NOMAN               Force MKMAN=no.
224NOMANDOC  Force MKMANDOC=no.
225NONLS               Force MKNLS=no.
226NOOBJ               Force MKOBJ=no.
227NOPIC               Force MKPIC=no.
228NOPICINSTALL        Force MKPICINSTALL=no.
229NOPIE               Force MKPIE=no.
230NOPROFILE Force MKPROFILE=no.
231NORELRO             Force MKREPRO=no.
232NOSANITIZER         Force MKSANITIZER=no (and USE_SANITIZER=no)
233NOSHARE             Force MKSHARE=no.
234NOSSP               Force USE_SSP=no.
235NOSTATICLIB         Force MKSTATICLIB=no.
236
237Special variations:
238
239NOFULLRELRO!=no Force MKRELRO=no if MKRELRO=full
240
241TODO: NOFULLRELRO should just be a defined test for consistency.
242
243
244=-=-=-=-=   sys.mk   =-=-=-=-=
245
246The include file <sys.mk> has the default rules for all makes, in the BSD
247environment or otherwise.  You probably don't want to touch this file.
248
249=-=-=-=-=   bsd.own.mk   =-=-=-=-=
250
251The include file <bsd.own.mk> contains source tree configuration parameters,
252such as the owners, groups, etc. for both manual pages and binaries, and
253a few global "feature configuration" parameters.
254
255It has no targets.
256
257To get system-specific configuration parameters, <bsd.own.mk> will try to
258include the mk.conf(5) file specified by the MAKECONF variable, which may
259be either set in the environment or provided on the make(1) command line.
260MAKECONF defaults to /etc/mk.conf.  mk.conf(5) may define any of the
261variables described below.
262
263<bsd.own.mk> sets the following variables, if they are not already defined
264(defaults are in brackets):
265
266NETBSDSRCDIR        The path to the top level of the NetBSD sources.
267                    If _SRC_TOP_ != "", that will be used as the default,
268                    otherwise BSDSRCDIR will be used as the default.
269                    Various makefiles within the NetBSD source tree will
270                    use this to reference the top level of the source tree.
271                    Default: Top level of the NetBSD source tree (as
272                    determined by the presence of build.sh and tools/) if
273                    make(1) is run from within that tree; otherwise BSDSRCDIR
274                    will be used.
275
276_SRC_TOP_ Top of the system source tree, as determined by <bsd.own.mk>
277                    based on the presence of tools/ and build.sh.  This variable
278                    is "internal" to <bsd.own.mk>, although its value is only
279                    determined once and then propagated to all sub-makes.
280
281_NETBSD_VERSION_DEPENDS
282                    A list of files which contain information about
283                    the version of the NetBSD being built.  This is
284                    defined only if the current directory appears
285                    to be inside a NetBSD source tree.  The list of
286                    files includes ${NETBSDSRCDIR}/sys/sys/param.h
287                    (which contains the kernel version number),
288                    ${NETBSDSRCDIR}/sys/conf/newvers.sh and
289                    ${NETBSDSRCDIR}/sys/conf/osrelease.sh (which
290                    interpret the information in sys/sys/param.h), and
291                    ${_SRC_TOP_OBJ_}/params (which is an optional file,
292                    created by "make build" in ${_SRC_TOP_}/Makefile,
293                    containing all the variables that may influence the
294                    build).
295
296                    Targets that depend on the NetBSD version, or on
297                    variables defined at build time, can declare a
298                    dependency on ${_NETBSD_VERSION_DEPENDS}, like this:
299
300                              version.c: ${_NETBSD_VERSION_DEPENDS}
301                                        commands to create version.c
302
303BSDSRCDIR The real path to the NetBSD source tree, if NETBSDSRCDIR
304                    isn't defined.
305                    Default: "/usr/src".
306
307BSDOBJDIR The real path to the object directory tree for the NetBSD
308                    source tree.
309                    Default: "/usr/obj".
310
311BINGRP              Binary group.  [wheel]
312
313BINOWN              Binary owner.  [root]
314
315BINMODE             Binary mode.  [555]
316
317NONBINMODE          Mode for non-executable files.  [444]
318
319MANDIR              Base path for manual installation.  [/usr/share/man/cat]
320
321MANGRP              Manual group.  [wheel]
322
323MANOWN              Manual owner.  [root]
324
325MANMODE             Manual mode.  [${NONBINMODE}]
326
327MANINSTALL          Manual installation type.  Space separated list:
328                              catinstall, htmlinstall, maninstall
329                    Default value derived from MKCATPAGES and MKHTML.
330
331MAKELINKLIB         Defaults to ${MKLINKLIB} but can be overriden by Makefiles
332
333MAKESTATICLIB       Defaults to ${MKSTATICLIB} but can be overriden by Makefiles
334
335LDSTATIC  Control program linking; if set blank, link everything
336                    dynamically.  If set to "-static", link everything statically.
337                    If not set, programs link according to their makefile.
338
339LIBDIR              Base path for library installation.  [/usr/lib]
340
341LINTLIBDIR          Base path for lint(1) library installation.  [/usr/libdata/lint]
342
343LIBGRP              Library group.  [${BINGRP}]
344
345LIBOWN              Library owner.  [${BINOWN}]
346
347LIBMODE             Library mode.  [${NONBINMODE}]
348
349LINKINSTALL         Install libraries used by users to link against (.a/.so)
350                    defaults to ${MAKELINKLIB}
351
352DOCDIR              Base path for system documentation (e.g. PSD, USD, etc.)
353                    installation.  [/usr/share/doc]
354
355DOCGRP              Documentation group.  [wheel]
356
357DOCOWN              Documentation owner.  [root]
358
359DOCMODE             Documentation mode.  [${NONBINMODE}]
360
361GZIP_N_FLAG         Options to pass to TOOL_GZIP to prevent it from inserting
362                    file names or timestamps in the compressed output.
363                    [-n, or -nT when TOOL_GZIP is really TOOL_PIGZ]
364
365NLSDIR              Base path for Native Language Support files installation.
366                    [/usr/share/nls]
367
368NLSGRP              Native Language Support files group.  [wheel]
369
370NLSOWN              Native Language Support files owner.  [root]
371
372NLSMODE             Native Language Support files mode.  [${NONBINMODE}]
373
374X11SRCDIR Directory containing the modular Xorg source.  If
375                    specified, must be an absolute path.  The main modular
376                    Xorg source is found in ${X11SRCDIR}/external/mit.
377
378                    Default: ${NETBSDSRCDIR}/../xsrc, if that exists; otherwise
379                    "/usr/xsrc".
380
381X11SRCDIR.local The path to the local X11 src tree.  [${X11SRCDIR}/local]
382
383X11SRCDIR.lib<package>
384X11SRCDIR.<package>
385                    The path to the xorg src tree for the specified package>.
386                    [${X11SRCDIR}/external/mit/xorg/<package>/dist]
387
388X11ROOTDIR          Root directory of the X11 installation.  [/usr/X11R7]
389
390X11BINDIR X11 bin directory.  [${X11ROOTDIR}/bin]
391
392X11FONTDIR          X11 font directory.  [${X11ROOTDIR}/lib/X11/fonts]
393
394X11INCDIR X11 include directory.  [${X11ROOTDIR}/include]
395
396X11LIBDIR X11 lib/x11 (config) directory.  [${X11ROOTDIR}/lib/X11]
397
398X11MANDIR X11 manual directory.  [${X11ROOTDIR}/man]
399
400X11USRLIBDIR        X11 library directory.  [${X11ROOTDIR}/lib]
401
402STRIPFLAG The option passed to the install program to cause the binary
403                    to be stripped.  This is to be used when building your
404                    own install script so that the entire system can be made
405                    stripped/not-stripped using a single knob.  []
406
407COPY                The option passed to the install program to cause the binary
408                    to be copied rather than moved.  This is to be used when
409                    building our own install script so that the entire system
410                    can either be installed with copies, or with moves using
411                    a single knob.  [-c]
412
413MAKEDIRTARGETENV
414                    Environment variables passed to the child make process
415                    invoked by MAKEDIRTARGET.
416
417MAKEDIRTARGET dir target [params]
418                    Runs "cd $${dir} && ${MAKE} [params] $${target}",
419                    displaying a "pretty" message whilst doing so.
420
421RELEASEMACHINEDIR
422                    Subdirectory used below RELEASEDIR when building
423                    a release.  [${MACHINE},
424                    or ${MACHINE}-${MACHINE_ARCH} for evb{arm,mips,sh3}*]
425
426RELEASEMACHINE      Subdirectory or path component used for the following
427                    paths:
428                              distrib/${RELEASEMACHINE}
429                              distrib/notes/${RELEASEMACHINE}
430                              etc/etc.${RELEASEMACHINE}
431                    Used when building a release.  [${MACHINE}]
432
433Additionally, the following variables may be set by <bsd.own.mk> or in a
434make configuration file to modify the behavior of the system build
435process (default values are in brackets along with comments, if set by
436<bsd.own.mk>):
437
438USETOOLS  Can be set to "yes" or "no".  Indicates whether the tools
439                    specified by ${TOOLDIR} should be used as part of a build in
440                    progress. Must be set to "yes" if cross-compiling.
441                    Supported values:
442
443                    yes       Use the tools from TOOLDIR.
444
445                    no        Do not use the tools from TOOLDIR, but refuse to
446                              build native compilation tool components that are
447                              version-specific for that tool.
448
449                    never     Do not use the tools from TOOLDIR, even when
450                              building native tool components.  This is similar to
451                              the traditional NetBSD build method, but does not
452                              verify that the compilation tools in use are
453                              up-to-date enough in order to build the tree
454                              successfully.  This may cause build or runtime
455                              problems when building the whole NetBSD source tree.
456
457                    Default: "no" when using <bsd.*.mk> outside the NetBSD
458                    source tree (detected automatically) or if
459                    TOOLCHAIN_MISSING=yes; otherwise "yes".
460
461OBJECT_FMT          Object file format.  [set to "ELF" on architectures that
462                    use ELF -- currently all architectures].
463
464TOOLCHAIN_MISSING
465                    Can be set to "yes" or "no".  If not "no", this
466                    indicates that the platform "MACHINE_ARCH" being built
467                    does not have a working in-tree toolchain.
468                    If the ${MACHINE_ARCH} in question falls into this category,
469                    TOOLCHAIN_MISSING is conditionally assigned the value "yes".
470                    Otherwise, the variable is unconditionally assigned the
471                    value "no".
472
473                    If not "no", acts as MKBINUTILS=no MKGCC=no MKGDB=no.
474
475                    Default: "no".
476
477EXTERNAL_TOOLCHAIN
478                    This variable is not directly set by <bsd.own.mk>, but
479                    including <bsd.own.mk> is the canonical way to gain
480                    access to this variable.  The variable should be defined
481                    either in the user's environment or in the user's mk.conf(5)
482                    file.
483
484                    If defined, this variable indicates the root directory of
485                    an external toolchain which will be used to build the
486                    tree.  For example, if a platform is a ${TOOLCHAIN_MISSING}
487                    platform, EXTERNAL_TOOLCHAIN can be used to re-enable the
488                    cross-compile framework.
489
490                    If EXTERNAL_TOOLCHAIN is defined, act as MKGCC=no, since
491                    the external version of the compiler may not be able to build
492                    the library components of the in-tree compiler.
493
494                    This variable should be used in conjunction with an
495                    appropriate HAVE_GCC or HAVE_LLVM setting to control the
496                    compiler options.
497
498                    Note: This variable is not yet used in as many places as
499                    it should be.  Expect the exact semantics of this variable
500                    to change in the short term as parts of the cross-compile
501                    framework continue to be cleaned up.
502
503The following variables are defined to commands to perform the
504appropriate operation, with the default in [brackets].  Note that
505the defaults change if USETOOLS == "yes":
506
507TOOL_AMIGAAOUT2BB   aout to Amiga bootblock converter.  [amiga-aout2bb]
508
509TOOL_AMIGAELF2BB    ELF to Amiga bootblock converter.  [amiga-elf2bb]
510
511TOOL_AMIGATXLT                Amiga assembly language format translator.  [amiga-txlt]
512
513TOOL_ARMELF2AOUT    ELF to a.out executable converter [arm-elf2aout}
514
515TOOL_ASN1_COMPILE   ASN1 compiler.  [asn1_compile]
516
517TOOL_AWK            Pattern-directed scanning/processing language.  [awk]
518
519TOOL_CAP_MKDB                 Create capability database.  [cap_mkdb]
520
521TOOL_CAT            Concatenate and print files.  [cat]
522
523TOOL_CKSUM                    Display file checksums.  [cksum]
524
525TOOL_COMPILE_ET               Error table compiler.  [compile_et]
526
527TOOL_CONFIG                   Build kernel compilation directories.  [config]
528
529TOOL_CRUNCHGEN                Generate crunched binary build environment.  [crunchgen]
530
531TOOL_CTAGS                    Create a tags file.  [ctags]
532
533TOOL_DB                       Manipulate db(3) databases.  [db]
534
535TOOL_DISKLABEL                Read and write disk pack label.  [disklabel]
536
537TOOL_EQN            Format equations for groff.  [eqn]
538
539TOOL_FDISK                    MS-DOS partition maintenance program.  [fdisk]
540
541TOOL_FGEN           IEEE 1275 Open Firmware FCode Tokenizer.  [fgen]
542
543TOOL_GENASSYM                 Generate constants for assembly files.  [genassym]
544
545TOOL_GENCAT                   Generate NLS message catalogs.  [gencat]
546
547TOOL_GMAKE                    GNU make utility.  [gmake]
548
549TOOL_GREP           Print lines matching a pattern.  [grep]
550
551TOOL_GROFF                    Front end for groff document formatting system.  [groff]
552
553TOOL_GZIP           Compression/decompression tool.  [gzip]
554
555TOOL_GZIP_N                   Same as TOOL_GZIP, plus a command line option to
556                              prevent it from inserting file names or timestamps
557                              into the compressed output.
558                              [${TOOL_GZIP} ${GZIP_N_FLAG}]
559
560TOOL_HEXDUMP                  Ascii, decimal, hexadecimal, octal dump.  [hexdump]
561
562TOOL_HP300MKBOOT    Make bootable image for hp300.  [hp300-mkboot]
563
564TOOL_HPPAMKBOOT               Make bootable image for hppa.  [hppa-mkboot]
565
566TOOL_INDXBIB                  Make bibliographic database's inverted index.  [indxbib]
567
568TOOL_INSTALLBOOT    Install disk bootstrap software.  [installboot]
569
570TOOL_INSTALL_INFO   Update info/dir entries.  [install-info]
571
572TOOL_JOIN           Relational database operator.  [join]
573
574TOOL_M4                       M4 macro language processor.  [m4]
575
576TOOL_M68KELF2AOUT   ELF to a.out executable converter [m68k-elf2aout}
577
578TOOL_MACPPCFIXCOFF  Fix up xcoff headers for macppc.  [macppc-fixcoff]
579
580TOOL_MAKEFS                   Create file system image from directory tree.  [makefs]
581
582TOOL_MAKEINFO                 Translate Texinfo documents.  [makeinfo]
583
584TOOL_MAKEWHATIS               Create a whatis.db database.  [makewhatis]
585
586TOOL_MDSETIMAGE               Set kernel RAM disk image.  [mdsetimage]
587
588TOOL_MENUC                    Menu compiler.  [menuc]
589
590TOOL_MIPSELF2ECOFF  Convert ELF-format executable to ECOFF for mips.
591                              [mips-elf2ecoff]
592
593TOOL_MKCSMAPPER               Make charset mapping table.  [mkcsmapper]
594
595TOOL_MKESDB                   Make encoding scheme database.  [mkesdb]
596
597TOOL_MKLOCALE                 Make LC_CTYPE locale files.  [mklocale]
598
599TOOL_MKMAGIC                  Create database for file(1).  [file]
600
601TOOL_MKNOD                    Make device special file.  [mknod]
602
603TOOL_MKTEMP                   Make (unique) temporary file name.  [mktemp]
604
605TOOL_MSGC           Simple message list compiler.  [msgc]
606
607TOOL_MTREE                    Map a directory hierarchy.  [mtree]
608
609TOOL_NCDCS                    Turn ELF kernel into a NCD firmware image. [ncdcs]
610
611TOOL_PAX            Manipulate file archives and copy directories.  [pax]
612
613TOOL_PIC            Compile pictures for groff.  [pic]
614
615TOOL_PIGZ           Parallel compressor.  [pigz]
616
617TOOL_POWERPCMKBOOTIMAGE Make bootable image for powerpc.  [powerpc-mkbootimage]
618
619TOOL_PWD_MKDB                 Generate the password databases.  [pwd_mkdb]
620
621TOOL_REFER                    Preprocess bibliographic references for groff.  [refer]
622
623TOOL_ROFF_ASCII               Generate ASCII groff output.  [nroff]
624
625TOOL_ROFF_DVI                 Generate DVI groff output.  [${TOOL_GROFF} -Tdvi]
626
627TOOL_ROFF_HTML                Generate HTML groff output.
628                              [${TOOL_GROFF} -Tlatin1 -mdoc2html]
629
630TOOL_ROFF_PS                  Generate PS groff output.  [${TOOL_GROFF} -Tps]
631
632TOOL_ROFF_RAW                 Generate "raw" groff output.  [${TOOL_GROFF} -Z]
633
634TOOL_RPCGEN                   Remote Procedure Call (RPC) protocol compiler.  [rpcgen]
635
636TOOL_SED            Stream editor.  [sed]
637
638TOOL_SOELIM                   Eliminate .so's from groff input.  [soelim]
639
640TOOL_SPARKCRC                 Generate a crc suitable for use in a sparkive file.
641                              [sparkcrc]
642
643TOOL_STAT           Display file status.  [stat]
644
645TOOL_STRFILE                  Create a random access file for storing strings.
646                              [strfile]
647
648TOOL_SUNLABEL                 Read or modify a SunOS disk label.  [sunlabel]
649
650TOOL_TBL            Format tables for groff.  [tbl]
651
652TOOL_UUDECODE                 Uudecode a binary file.  [uudecode]
653
654TOOL_VAXMOPCOPY               Creates a MOP image from another executable format.
655                              [vax-mopcopy]
656
657TOOL_VGRIND                   Grind nice listings of programs.  [vgrind -f]
658
659TOOL_ZIC            Time zone compiler.  [zic]
660
661For each possible value of MACHINE_CPU, MACHINES.${MACHINE_CPU} contain a
662list of what ports can be built for it.  This keeps those definitions in
663centralized place.
664
665<bsd.own.mk> is generally useful when building your own Makefiles so that
666they use the same default owners etc. as the rest of the tree.
667
668
669=-=-=-=-=   bsd.clean.mk   =-=-=-=-=
670
671The include file <bsd.clean.mk> defines the clean and cleandir
672targets.  It uses the following variables:
673
674CLEANFILES          Files to remove for both the clean and cleandir targets.
675
676CLEANDIRFILES       Files to remove for the cleandir target, but not for
677                    the clean target.
678
679MKCLEANSRC          Controls whether or not the clean and cleandir targets
680                    will delete files from both the object directory,
681                    ${.OBJDIR}, and the source directory, ${.CURDIR}.
682
683                    If MKCLEANSRC is set to "no", then the file names in
684                    CLEANFILES or CLEANDIRFILES are interpreted relative
685                    to the object directory, ${.OBJDIR}.  This is the
686                    traditional behaviour.
687
688                    If MKCLEANSRC is set to "yes", then the file deletion
689                    is performed relative to both the object directory,
690                    ${.OBJDIR}, and the source directory, ${.CURDIR}.  (This
691                    has no effect if ${.OBJDIR} is the same as ${.CURDIR}.)
692                    Deleting files from ${.CURDIR} is intended to remove
693                    stray output files that had been left in the source
694                    directory by an earlier build that did not use object
695                    directories.
696
697                    The default is MKCLEANSRC=yes.  If you always build with
698                    separate object directories, and you are sure that there
699                    are no stray files in the source directories, then you
700                    may set MKCLEANSRC=no to save some time.
701
702MKCLEANVERIFY       Controls whether or not the clean and cleandir targets
703                    will verify that files have been deleted.
704
705                    If MKCLEANVERIFY is set to "no", then the files will
706                    be deleted using a "rm -f" command, and its success or
707                    failure will be ignored.
708
709                    If MKCLEANVERIFY is set to "yes", then the success of
710                    the "rm -f" command will be verified using an "ls"
711                    command.
712
713                    The default is MKCLEANVERIFY=yes.  If you are sure that
714                    there will be no problems caused by file permissions,
715                    read-only file systems, or the like, then you may set
716                    MKCLEANVERIFY=no to save some time.
717
718To use the clean and cleandir targets defined in <bsd.clean.mk>, other
719Makefiles or bsd.*.mk files should append file names to the CLEANFILES
720or CLEANDIRFILES variables.  For example:
721
722              CLEANFILES+= a.out
723              CLEANDIRFILES+= .depend
724
725              .include <bsd.clean.mk>
726
727The files listed in CLEANFILES and CLEANDIRFILES must not be
728directories, because the potential risk from running "rm -rf" commands
729in bsd.clean.mk is considered too great.  If you want to recursively
730delete a directory as part of "make clean" or "make cleandir" then you
731need to provide your own target.
732
733=-=-=-=-=   bsd.dep.mk   =-=-=-=-=
734
735The include file <bsd.dep.mk> contains the default targets for building
736.depend files.  It creates .d files from entries in SRCS and DPSRCS
737that are C, C++, or Objective C source files, and builds .depend from the
738.d files.  All other files in SRCS and all of DPSRCS will be used as
739dependencies for the .d files.  In order for this to function correctly,
740it should be .included after all other .mk files and directives that may
741modify SRCS or DPSRCS.  It uses the following variables:
742
743SRCS                List of source files to build the program.
744
745DPSRCS              List of source files which are needed for generating
746                    dependencies, but are not needed in ${SRCS}.
747
748NODPSRCS  TODO
749
750=-=-=-=-=   bsd.files.mk   =-=-=-=-=
751
752The include file <bsd.files.mk> handles the FILES variables and is included
753from <bsd.lib.mk> and <bsd.prog.mk>, and uses the following variables:
754
755FILES               The list of files to install.
756
757CONFIGFILES         Similar semantics to FILES, except that the files
758                    are installed by the `configinstall' target,
759                    not the `install' target.
760                    The FILES* variables documented below also apply.
761
762FILESOWN  File owner.  [${BINOWN}]
763
764FILESGRP  File group.  [${BINGRP}]
765
766FILESMODE File mode.  [${NONBINMODE}]
767
768FILESDIR  The location to install the files.
769
770FILESNAME Optional name to install each file as.
771
772FILESOWN_<fn>       File owner of the specific file <fn>.
773
774FILESGRP_<fn>       File group of the specific file <fn>.
775
776FILESMODE_<fn>      File mode of the specific file <fn>.
777
778FILESDIR_<fn>       The location to install the specific file <fn>.
779
780FILESNAME_<fn>      Optional name to install <fn> as.
781
782FILESBUILD          If this variable is defined, then its value will be
783                    used as the default for all FILESBUILD_<fn> variables.
784                    Otherwise, the default will be "no".
785
786FILESBUILD_<fn> A value different from "no" will add the file to the list of
787                    targets to be built by `realall'.  Users of that variable
788                    should provide a target to build the file.
789
790
791BUILDSYMLINKS       List of two word items:
792                              lnsrc lntgt
793                    For each lnsrc item, create a symlink named lntgt.
794                    The lntgt symlinks are removed by the cleandir target.
795
796UUDECODE_FILES      List of files which are stored as <file>.uue in the source
797                    tree. Each one will be decoded with ${TOOL_UUDECODE}.
798                    The source files have a `.uue' suffix, the generated files do
799                    not.
800
801UUDECODE_FILES_RENAME_<fn>
802                    Rename the output from the decode to the provided name.
803
804                    Note: These files are simply decoded, with no install or other
805                    rule applying implicitly except being added to the clean
806                    target.
807
808=-=-=-=-=   bsd.gcc.mk   =-=-=-=-=
809
810The include file <bsd.gcc.mk> computes various parameters related to GCC
811support libraries.  It defines no targets.  <bsd.own.mk> MUST be included
812before <bsd.gcc.mk>.
813
814The primary users of <bsd.gcc.mk> are <bsd.prog.mk> and <bsd.lib.mk>, each
815of which need to know where to find certain GCC support libraries.
816
817The behavior of <bsd.gcc.mk> is influenced by the EXTERNAL_TOOLCHAIN variable,
818which is generally set by the user.  If EXTERNAL_TOOLCHAIN it set, then
819the compiler is asked where to find the support libraries, otherwise the
820support libraries are found in ${DESTDIR}/usr/lib.
821
822<bsd.gcc.mk> sets the following variables:
823
824_GCC_CRTBEGIN       The full path name to crtbegin.o.
825
826_GCC_CRTBEGINS      The full path name to crtbeginS.o.
827
828_GCC_CRTEND         The full path name to crtend.o.
829
830_GCC_CRTENDS        The full path name to crtendS.o.
831
832_GCC_LIBGCCDIR      The directory where libgcc.a is located.
833
834
835=-=-=-=-=   bsd.inc.mk   =-=-=-=-=
836
837The include file <bsd.inc.mk> defines the includes target and uses the
838variables:
839
840INCS                The list of include files.
841
842INCSDIR             The location to install the include files.
843
844INCSNAME  Target name of the include file, if only one; same as
845                    FILESNAME, but for include files.
846
847INCSYMLINKS         Similar to SYMLINKS in <bsd.links.mk>, except that these
848                    are installed in the 'includes' target and not the
849                    (much later) 'install' target.
850
851INCSNAME_<file> The name file <file> should be installed as, if not <file>,
852                    same as FILESNAME_<file>, but for include files.
853
854
855=-=-=-=-=   bsd.info.mk   =-=-=-=-=
856
857The include file <bsd.info.mk> is used to generate and install GNU Info
858documentation from respective Texinfo source files.  It defines three
859implicit targets (.txi.info, .texi.info, and .texinfo.info), and uses the
860following variables:
861
862TEXINFO             List of Texinfo source files.  Info documentation will
863                    consist of single files with the extension replaced by
864                    .info.
865
866INFOFLAGS Options to pass to makeinfo.  []
867
868
869=-=-=-=-=   bsd.kernobj.mk   =-=-=-=-=
870
871The include file <bsd.kernobj.mk> defines variables related to the
872location of kernel sources and object directories.
873
874KERNSRCDIR          Directory at the top of the kernel source..
875                    [${NETBSDSRCDIR}/sys]
876
877KERNARCHDIR         Directory under KERNSRCDIR containing the machine
878                    dependent kernel sources.
879                    [arch/${MACHINE}]
880
881KERNCONFDIR         Directory containing the kernel configuration files.
882                    [${KERNSRCDIR}/${KERNARCHDIR}/conf]
883
884KERNOBJDIR          Directory for kernel builds.  For example, the kernel
885                    GENERIC will be compiled in KERNOBJDIR/GENERIC.
886                    Default:
887                    ${MAKEOBJDIRPREFIX}${KERNSRCDIR}/${KERNARCHDIR}/compile
888                    if it exists or the make(1) target 'obj' is being made;
889                    otherwise ${KERNSRCDIR}/${KERNARCHDIR}/compile.
890
891It is important that Makefiles (such as those under src/distrib) that
892wish to find compiled kernels use <bsd.kernobj.mk> and ${KERNOBJDIR}
893rather than make assumptions about the location of the compiled kernel.
894
895
896=-=-=-=-=   bsd.kinc.mk   =-=-=-=-=
897
898The include file <bsd.kinc.mk> defines the many targets (includes,
899subdirectories, etc.), and is used by kernel makefiles to handle
900include file installation.  It is intended to be included alone, by
901kernel Makefiles.  It uses similar variables to <bsd.inc.mk>.
902Please see <bsd.kinc.mk> for more details, and keep the documentation
903in that file up to date.
904
905=-=-=-=-=   bsd.syscall.mk =-=-=-=-=
906
907The include file <bsd.syscall.mk> contains the logic to create syscall
908files for various emulations. It includes <bsd.kinc.mk> to handle the
909rest of the targets.
910
911=-=-=-=-=   bsd.lib.mk   =-=-=-=-=
912
913The include file <bsd.lib.mk> has support for building libraries.  It has
914the same eight targets as <bsd.prog.mk>: all, clean, cleandir, depend,
915includes, install, lint, and tags.  Additionally, it has a checkver target
916which checks for installed shared object libraries whose version is greater
917that the version of the source. It has a limited number of suffixes,
918consistent with the current needs of the BSD tree.  <bsd.lib.mk> includes
919<bsd.shlib.mk> to get shared library parameters.
920
921It sets/uses the following variables:
922
923LIB                 The name of the library to build.
924
925LIBDIR              Target directory for libraries.
926
927SHLIBINSTALLDIR Target directory for shared libraries if ${USE_SHLIBDIR}
928                    is not "no".
929
930SHLIB_MAJOR
931SHLIB_MINOR
932SHLIB_TEENY         Major, minor, and teeny version numbers of shared library
933
934USE_SHLIBDIR        If not "no", use ${SHLIBINSTALLDIR} instead of ${LIBDIR}
935                    as the path to install shared libraries to.
936                    USE_SHLIBDIR must be defined before <bsd.own.mk> is included.
937                    Default: no
938
939LIBISMODULE         If not "no", install as ${LIB}.so (without the "lib" prefix),
940                    and act as "MKDEBUGLIB=no MKPICINSTALL=no MKPROFILE=no
941                    MKSTATICLIB=no". Also do not install the lint library.
942                    Default: no
943
944LIBISPRIVATE        If not "no", act as "MKDEBUGLIB=no MKPIC=no MKPROFILE=no",
945                    and don't install the (.a) library or the lint library.
946                    This is useful for "build only" helper libraries.
947                    If set to "pic", then a _pic.a library is also produced,
948                    so that it can be incorporated into other shared objects.
949                    Default: no
950
951LIBISCXX  If not "no", Use ${CXX} instead of ${CC} to link
952                    shared libraries.
953                    This is useful for C++ libraries.
954                    Default: no
955
956LINTLIBDIR          Target directory for lint libraries.
957
958LIBGRP              Library group.
959
960LIBOWN              Library owner.
961
962LIBMODE             Library mode.
963
964LDADD               Additional loader objects.
965
966MAN                 The manual pages to be installed (use a .1 - .9 suffix).
967
968NOCHECKVER_<library>
969NOCHECKVER          If set, disables checking for installed shared object
970                    libraries with versions greater than the source.  A
971                    particular library name, without the "lib" prefix, may
972                    be appended to the variable name to disable the check for
973                    only that library.
974
975SRCS                List of source files to build the library.  Suffix types
976                    .s, .c, and .f are supported.  Note, .s files are preferred
977                    to .c files of the same name.  (This is not the default for
978                    versions of make.)
979
980LIBDPLIBS/
981PROGDPLIBS          A list of the tuples:
982                              libname    path-to-srcdir-of-libname
983
984                    Instead of depending on installed versions of the libraries,
985                    one can depend on their built version in the source directory.
986                    This is useful for finding private libraries (LIBISPRIVATE).
987
988                    For each tuple;
989                         *    LIBDO.libname contains the .OBJDIR of the library
990                              `libname', and if it is not set it is determined
991                              from the srcdir and added to MAKEOVERRIDES (the
992                              latter is to allow for build time optimization).
993                         *    LDADD gets  -L${LIBDO.libname} -llibname    added.
994                         *    DPADD gets  ${LIBDO.libname}/liblibname.so  or
995                                            ${LIBDO.libname}/liblibname.a   added.
996
997                    The special value "_external" for LIBDO.lib makes the
998                    build system to assume the library comes from outside
999                    of the NetBSD source tree and only causes -llibname
1000                    to be added to LDADD.
1001
1002                    This variable may be used for individual libraries/programs,
1003                    as well as in parent directories to cache common libraries
1004                    as a build-time optimization.
1005
1006LIB_EXPSYM          File listing all symbols expected to be defined by the
1007                    library.  Each line has a single symbol.  If the symbol
1008                    is versioned, it is followed by `@@', if it is the
1009                    default version, or `@', if not, and the symbol
1010                    version.  The lines must be sorted in LANG=C.
1011
1012                    bsd.lib.mk checks to make sure exactly the set of
1013                    symbols in this file is defined when the library is
1014                    built; if not, the build will fail and print a diff
1015                    from the expected symbols to the actual symbols.
1016                    During development, you can update the expected symbols
1017                    from the actual ones with `make update-symbols'.
1018
1019VERSION_MAP         Path to an ld version script to use when linking the
1020                    library.  Resolved from .PATH like a target
1021                    prerequisite.
1022
1023
1024The include file <bsd.lib.mk> includes the file named "../Makefile.inc"
1025if it exists, as well as the include file <bsd.man.mk>.
1026
1027It has rules for building profiled objects; profiled libraries are
1028built by default.
1029
1030Libraries are ranlib'd when made.
1031
1032
1033=-=-=-=-=   bsd.links.mk   =-=-=-=-=
1034
1035The include file <bsd.links.mk> handles the LINKS and SYMLINKS variables
1036and is included from <bsd.lib.mk> and <bsd.prog.mk>.
1037
1038LINKSOWN, LINKSGRP, and LINKSMODE, are relevant only if a metadata log
1039is used. The defaults may be modified by other bsd.*.mk files which
1040include bsd.links.mk.  In the future, these variables may be replaced
1041by a method for explicitly recording hard links in a metadata log.
1042
1043LINKS               The list of hard links, consisting of pairs of paths:
1044                              source-file target-file
1045                    ${DESTDIR} is prepended to both paths before linking.
1046                    For example, to link /bin/test and /bin/[, use:
1047                              LINKS=/bin/test /bin/[
1048
1049CONFIGLINKS         Similar semantics to LINKS, except that the links
1050                    are installed by the `configinstall' target,
1051                    not the `install' target.
1052
1053SYMLINKS  The list of symbolic links, consisting of pairs of paths:
1054                              source-file target-file
1055                    ${DESTDIR} is only prepended to target-file before linking.
1056                    For example, to symlink /usr/bin/tar to /bin/tar resulting
1057                    in ${DESTDIR}/usr/bin/tar -> /bin/tar:
1058                              SYMLINKS=/bin/tar /usr/bin/tar
1059
1060CONFIGSYMLINKS      Similar semantics to SYMLINKS, except that the symbolic links
1061                    are installed by the `configinstall' target,
1062                    not the `install' target.
1063
1064LINKSOWN  Link owner.  [${BINOWN}]
1065
1066LINKSGRP  Link group.  [${BINGRP}]
1067
1068LINKSMODE Link mode.  [${NONBINMODE}]
1069
1070LINKSOWN_<fn>       Link owner of the specific file <fn>.
1071
1072LINKSGRP_<fn>       Link group of the specific file <fn>.
1073
1074LINKSMODE_<fn>      Link mode of the specific file <fn>.
1075
1076
1077=-=-=-=-=   bsd.man.mk   =-=-=-=-=
1078
1079The include file <bsd.man.mk> handles installing manual pages and their
1080links.
1081
1082It has a three targets:
1083
1084          catinstall:
1085                    Install the preformatted manual pages and their links.
1086          htmlinstall:
1087                    Install the HTML manual pages and their links.
1088          maninstall:
1089                    Install the manual page sources and their links.
1090
1091It sets/uses the following variables:
1092
1093MANDIR              Base path for manual installation.
1094
1095MANGRP              Manual group.
1096
1097MANOWN              Manual owner.
1098
1099MANMODE             Manual mode.
1100
1101MANSUBDIR Subdirectory under the manual page section, i.e. "/vax"
1102                    or "/tahoe" for machine specific manual pages.
1103
1104MAN                 The manual pages to be installed (use a .1 - .9 suffix).
1105
1106MLINKS              List of manual page links (using a .1 - .9 suffix).  The
1107                    linked-to file must come first, the linked file second,
1108                    and there may be multiple pairs.
1109
1110The include file <bsd.man.mk> includes a file named "../Makefile.inc" if
1111it exists.
1112
1113
1114=-=-=-=-=   bsd.obj.mk   =-=-=-=-=
1115
1116The include file <bsd.obj.mk> defines targets related to the creation
1117and use of separated object and source directories.
1118
1119If an environment variable named MAKEOBJDIRPREFIX is set, make(1) uses
1120${MAKEOBJDIRPREFIX}${.CURDIR} as the name of the object directory if
1121it exists.  Otherwise make(1) looks for the existence of a
1122subdirectory (or a symlink to a directory) of the source directory
1123into which built targets should be placed.  If an environment variable
1124named MAKEOBJDIR is set, make(1) uses its value as the name of the
1125object directory; failing that, make first looks for a subdirectory
1126named "obj.${MACHINE}", and if that doesn't exist, it looks for "obj".
1127
1128Object directories are not created automatically by make(1) if they
1129don't exist; you need to run a separate "make obj".  (This will happen
1130during a top-level build if "MKOBJDIRS" is set to a value other than
1131"no").  When the source directory is a subdirectory of ${BSDSRCDIR} --
1132and this is determined by a simple string prefix comparison -- object
1133directories are created in a separate object directory tree, and a
1134symlink to the object directory in that tree is created in the source
1135directory; otherwise, "make obj" assumes that you're not in the main
1136source tree and that it's not safe to use a separate object tree.
1137
1138Several variables used by <bsd.obj.mk> control exactly what
1139directories and links get created during a "make obj":
1140
1141MAKEOBJDIR          If set, this is the component name of the object
1142                    directory.
1143
1144OBJMACHINE          If this is set but MAKEOBJDIR is not set, creates
1145                    object directories or links named "obj.${MACHINE}";
1146                    otherwise, just creates ones named "obj".
1147
1148OBJMACHINE_ARCH If set with OBJMACHINE, creates object directories or
1149                    links named "obj.${MACHINE}-${MACHINE_ARCH}".
1150
1151USR_OBJMACHINE      If set, and the current directory is a subdirectory of
1152                    ${BSDSRCDIR}, create object directory in the
1153                    corresponding subdirectory of ${BSDOBJDIR}.${MACHINE};
1154                    otherwise, create it in the corresponding subdirectory
1155                    of ${BSDOBJDIR}
1156
1157BUILDID             Identifier for the build.  If set, this should be a short
1158                    string that is suitable for use as part of a file or
1159                    directory name.  The identifier will be appended to
1160                    object directory names; if OBJMACHINE is also set, then
1161                    .BUILDID is appended after .MACHINE.  The identifier will
1162                    also be used as part of the kernel version string, which
1163                    can be shown by “uname -v”.
1164
1165                    Default: Unset.
1166
1167
1168=-=-=-=-=   bsd.prog.mk   =-=-=-=-=
1169
1170The include file <bsd.prog.mk> handles building programs from one or
1171more source files, along with their manual pages.  It has a limited number
1172of suffixes, consistent with the current needs of the BSD tree.
1173<bsd.prog.mk> includes <bsd.shlib.mk> to get shared library parameters.
1174
1175It has eight targets:
1176
1177          all:
1178                    build the program and its manual page.  This also
1179                    creates a GDB initialization file (.gdbinit) in
1180                    the objdir.  The .gdbinit file sets the shared library
1181                    prefix to ${DESTDIR} to facilitate cross-debugging.
1182          clean:
1183                    remove the program, any object files and the files a.out,
1184                    Errs, errs, mklog, and ${PROG}.core.
1185          cleandir:
1186                    remove all of the files removed by the target clean, as
1187                    well as .depend, tags, and any manual pages.
1188                    `distclean' is a synonym for `cleandir'.
1189          depend:
1190                    make the dependencies for the source files, and store
1191                    them in the file .depend.
1192          includes:
1193                    install any header files.
1194          install:
1195                    install the program and its manual pages; if the Makefile
1196                    does not itself define the target install, the targets
1197                    beforeinstall and afterinstall may also be used to cause
1198                    actions immediately before and after the install target
1199                    is executed.
1200          lint:
1201                    run lint on the source files
1202          tags:
1203                    create a tags file for the source files.
1204
1205It sets/uses the following variables:
1206
1207BINGRP              Binary group.
1208
1209BINOWN              Binary owner.
1210
1211BINMODE             Binary mode.
1212
1213CLEANDIRFILES       Additional files to remove for the cleandir target.
1214
1215CLEANFILES          Additional files to remove for the clean and cleandir targets.
1216
1217CONFIGOPTS          Additional options to config(1) when building kernels.
1218
1219                    Default: Unset.
1220
1221COPTS               Extra options for the C compiler.  Should be appended to
1222                    (e.g., COPTS+=-g), rather than explicitly set.
1223
1224                    Note: CPUFLAGS, not COPTS, should be used for compiler
1225                    options that select CPU-related options.
1226
1227COPTS.<fn>          Extra options for the C compiler when creating the
1228                    C objects for <fn>.
1229                    For <fn>.[ly], "<fn>.c" must be used.
1230
1231CPUFLAGS  Additional options passed to the compiler/assembler to
1232                    select CPU instruction set options, CPU tuning options,
1233                    etc.
1234
1235                    Note: Such options should not be specified in COPTS,
1236                    because some parts of the build process need to override
1237                    CPU-related compiler options.
1238
1239                    Default: Unset.
1240
1241CPUFLAGS.<fn>       Additional options to the compiler/assembler for <fn>.
1242                    For <fn>.[ly], "<fn>.c" must be used.
1243
1244CPPFLAGS  Additional options to the C pre-processor.
1245
1246CPPFLAGS.<fn>       Additional options to the C pre-processor for <fn>.
1247                    For <fn>.[ly], "<fn>.c" must be used.
1248
1249GDBINIT             List of GDB initialization files to add to "source"
1250                    directives in the .gdbinit file that is created in the
1251                    objdir.
1252
1253LDADD               Additional loader objects.  Usually used for libraries.
1254                    For example, to load with the compatibility and utility
1255                    libraries, use:
1256
1257                              LDADD+=-lutil -lcompat
1258
1259LDFLAGS             Additional linker options (passed to ${CC} during link).
1260
1261LINKS               See <bsd.links.mk>
1262
1263OBJCOPTS  Additional options to the compiler when creating ObjC objects.
1264
1265OBJCOPTS.<fn>       Additional options to the compiler when creating the
1266                    ObjC objects for <fn>.
1267                    For <fn>.[ly], "<fn>.c" must be used.
1268
1269SYMLINKS  See <bsd.links.mk>
1270
1271MAN                 Manual pages (should end in .1 - .9).  If no MAN variable is
1272                    defined, "MAN=${PROG}.1" is assumed.
1273
1274PAXCTL_FLAGS        If defined, run paxctl(1) on the program binary after link
1275                    time, with the value of this variable as options to paxctl(1).
1276
1277PAXCTL_FLAGS.${PROG} Custom override for PAXCTL_FLAGS.
1278
1279PROG                The name of the program to build.  If not supplied, nothing
1280                    is built.
1281
1282PROG_CXX  If defined, the name of the program to build.  Also
1283                    causes <bsd.prog.mk> to link the program with the C++
1284                    compiler rather than the C compiler.  PROG_CXX overrides
1285                    the value of PROG if PROG is also set.
1286
1287PROGNAME  The name that the above program will be installed as, if
1288                    different from ${PROG}.
1289
1290PROGS               Multiple programs to build from a single directory.
1291                    Defaults to PROG. For each program ${_P} in ${PROGS},
1292                    uses SRCS.${_P}, defaulting to ${_P}.c.
1293
1294PROGS_CXX Multiple C++ programs to build from a single directory.
1295                    Defaults to PROG_CXX. For each program ${_P} in ${PROGS_CXX},
1296                    uses SRCS.${_P}, defaulting to ${_P}.cc.
1297
1298SRCS                List of source files to build the program.  If SRCS is not
1299                    defined, it's assumed to be ${PROG}.c or ${PROG_CXX}.cc.
1300
1301DPSRCS              List of source files which are needed for generating
1302                    dependencies, but are not needed in ${SRCS}.
1303
1304DPADD               Additional dependencies for the program.  Usually used for
1305                    libraries.  For example, to depend on the compatibility and
1306                    utility libraries use:
1307
1308                              DPADD+=${LIBCOMPAT} ${LIBUTIL}
1309
1310                    The following system libraries are predefined for DPADD:
1311
1312                    LIBARCHIVE?=                  ${DESTDIR}/usr/lib/libarchive.a
1313                    LIBASN1?=           ${DESTDIR}/usr/lib/libasn1.a
1314                    LIBATF_C?=                    ${DESTDIR}/usr/lib/libatf-c.a
1315                    LIBATF_CXX?=                  ${DESTDIR}/usr/lib/libatf-c++.a
1316                    LIBBLOCKLIST?=                ${DESTDIR}/usr/lib/libblocklist.a
1317                    LIBBLUETOOTH?=                ${DESTDIR}/usr/lib/libbluetooth.a
1318                    LIBBSDMALLOC?=                ${DESTDIR}/usr/lib/libbsdmalloc.a
1319                    LIBBZ2?=            ${DESTDIR}/usr/lib/libbz2.a
1320                    LIBC?=                        ${DESTDIR}/usr/lib/libc.a
1321                    LIBC_PIC?=                    ${DESTDIR}/usr/lib/libc_pic.a
1322                    LIBCBOR?=           ${DESTDIR}/usr/lib/libcbor.a
1323                    LIBCOMPAT?=                   ${DESTDIR}/usr/lib/libcompat.a
1324                    LIBCOM_ERR?=                  ${DESTDIR}/usr/lib/libcom_err.a
1325                    LIBCRYPT?=                    ${DESTDIR}/usr/lib/libcrypt.a
1326                    LIBCRYPTO?=                   ${DESTDIR}/usr/lib/libcrypto.a
1327                    LIBCURSES?=                   ${DESTDIR}/usr/lib/libcurses.a
1328                    LIBCXX?=            ${DESTDIR}/usr/lib/libc++.a
1329                    LIBDES?=            ${DESTDIR}/usr/lib/libdes.a
1330                    LIBDNS?=            ${DESTDIR}/usr/lib/libdns.a
1331                    LIBEDIT?=           ${DESTDIR}/usr/lib/libedit.a
1332                    LIBEVENT?=                    ${DESTDIR}/usr/lib/libevent.a
1333                    LIBEVENT_OPENSSL?=  ${DESTDIR}/usr/lib/libevent_openssl.a
1334                    LIBEVENT_PTHREADS?= ${DESTDIR}/usr/lib/libevent_pthreads.a
1335                    LIBEXECINFO?=                 ${DESTDIR}/usr/lib/libexecinfo.a
1336                    LIBEXPAT?=                    ${DESTDIR}/usr/lib/libexpat.a
1337                    LIBFETCH?=                    ${DESTDIR}/usr/lib/libfetch.a
1338                    LIBFIDO2?=                    ${DESTDIR}/usr/lib/libfido2.a
1339                    LIBFL?=                       ${DESTDIR}/usr/lib/libfl.a
1340                    LIBFORM?=           ${DESTDIR}/usr/lib/libform.a
1341                    LIBGCC?=            ${DESTDIR}/usr/lib/libgcc.a
1342                    LIBGNUCTF?=                   ${DESTDIR}/usr/lib/libgnuctf.a
1343                    LIBGNUMALLOC?=                ${DESTDIR}/usr/lib/libgnumalloc.a
1344                    LIBGSSAPI?=                   ${DESTDIR}/usr/lib/libgssapi.a
1345                    LIBHDB?=            ${DESTDIR}/usr/lib/libhdb.a
1346                    LIBHEIMBASE?=                 ${DESTDIR}/usr/lib/libheimbase.a
1347                    LIBHEIMNTLM?=                 ${DESTDIR}/usr/lib/libheimntlm.a
1348                    LIBHX500?=                    ${DESTDIR}/usr/lib/libhx500.a
1349                    LIBINTL?=           ${DESTDIR}/usr/lib/libintl.a
1350                    LIBIPSEC?=                    ${DESTDIR}/usr/lib/libipsec.a
1351                    LIBISC?=            ${DESTDIR}/usr/lib/libisc.a
1352                    LIBISCCC?=                    ${DESTDIR}/usr/lib/libisccc.a
1353                    LIBISCFG?=                    ${DESTDIR}/usr/lib/libiscfg.a
1354                    LIBKADM5CLNT?=                ${DESTDIR}/usr/lib/libkadm5clnt.a
1355                    LIBKADM5SRV?=                 ${DESTDIR}/usr/lib/libkadm5srv.a
1356                    LIBKAFS?=           ${DESTDIR}/usr/lib/libkafs.a
1357                    LIBKRB5?=           ${DESTDIR}/usr/lib/libkrb5.a
1358                    LIBKVM?=            ${DESTDIR}/usr/lib/libkvm.a
1359                    LIBL?=                        ${DESTDIR}/usr/lib/libl.a
1360                    LIBLBER?=           ${DESTDIR}/usr/lib/liblber.a
1361                    LIBLDAP?=           ${DESTDIR}/usr/lib/libldap.a
1362                    LIBLDAP_R?=                   ${DESTDIR}/usr/lib/libldap_r.a
1363                    LIBLUA?=            ${DESTDIR}/usr/lib/liblua.a
1364                    LIBM?=                        ${DESTDIR}/usr/lib/libm.a
1365                    LIBMAGIC?=                    ${DESTDIR}/usr/lib/libmagic.a
1366                    LIBMENU?=           ${DESTDIR}/usr/lib/libmenu.a
1367                    LIBNETPGPVERIFY?=   ${DESTDIR}/usr/lib/libnetpgpverify.a
1368                    LIBNS?=                       ${DESTDIR}/usr/lib/libns.a
1369                    LIBOBJC?=           ${DESTDIR}/usr/lib/libobjc.a
1370                    LIBOSSAUDIO?=                 ${DESTDIR}/usr/lib/libossaudio.a
1371                    LIBPAM?=            ${DESTDIR}/usr/lib/libpam.a
1372                    LIBPANEL?=                    ${DESTDIR}/usr/lib/libpanel.a
1373                    LIBPCAP?=           ${DESTDIR}/usr/lib/libpcap.a
1374                    LIBPCI?=            ${DESTDIR}/usr/lib/libpci.a
1375                    LIBPOSIX?=                    ${DESTDIR}/usr/lib/libposix.a
1376                    LIBPTHREAD?=                  ${DESTDIR}/usr/lib/libpthread.a
1377                    LIBPUFFS?=                    ${DESTDIR}/usr/lib/libpuffs.a
1378                    LIBQUOTA?=                    ${DESTDIR}/usr/lib/libquota.a
1379                    LIBRADIUS?=                   ${DESTDIR}/usr/lib/libradius.a
1380                    LIBREFUSE?=                   ${DESTDIR}/usr/lib/librefuse.a
1381                    LIBRESOLV?=                   ${DESTDIR}/usr/lib/libresolv.a
1382                    LIBRMT?=            ${DESTDIR}/usr/lib/librmt.a
1383                    LIBROKEN?=                    ${DESTDIR}/usr/lib/libroken.a
1384                    LIBRPCSVC?=                   ${DESTDIR}/usr/lib/librpcsvc.a
1385                    LIBRT?=                       ${DESTDIR}/usr/lib/librt.a
1386                    LIBRUMP?=           ${DESTDIR}/usr/lib/librump.a
1387                    LIBRUMPFS_CD9660?=  ${DESTDIR}/usr/lib/librumpfs_cd9660.a
1388                    LIBRUMPFS_EFS?=               ${DESTDIR}/usr/lib/librumpfs_efs.a
1389                    LIBRUMPFS_EXT2FS?=  ${DESTDIR}/usr/lib/librumpfs_ext2fs.a
1390                    LIBRUMPFS_FFS?=               ${DESTDIR}/usr/lib/librumpfs_ffs.a
1391                    LIBRUMPFS_HFS?=               ${DESTDIR}/usr/lib/librumpfs_hfs.a
1392                    LIBRUMPFS_LFS?=               ${DESTDIR}/usr/lib/librumpfs_lfs.a
1393                    LIBRUMPFS_MSDOS?=   ${DESTDIR}/usr/lib/librumpfs_msdos.a
1394                    LIBRUMPFS_NFS?=               ${DESTDIR}/usr/lib/librumpfs_nfs.a
1395                    LIBRUMPFS_NTFS?=    ${DESTDIR}/usr/lib/librumpfs_ntfs.a
1396                    LIBRUMPFS_SYSPUFFS?=          ${DESTDIR}/usr/lib/librumpfs_syspuffs.a
1397                    LIBRUMPFS_TMPFS?=   ${DESTDIR}/usr/lib/librumpfs_tmpfs.a
1398                    LIBRUMPFS_UDF?=               ${DESTDIR}/usr/lib/librumpfs_udf.a
1399                    LIBRUMPUSER?=                 ${DESTDIR}/usr/lib/librumpuser.a
1400                    LIBSASLC?=                    ${DESTDIR}/usr/lib/libsaslc.a
1401                    LIBSKEY?=           ${DESTDIR}/usr/lib/libskey.a
1402                    LIBSL?=                       ${DESTDIR}/usr/lib/libsl.a
1403                    LIBSQLITE3?=                  ${DESTDIR}/usr/lib/libsqlite3.a
1404                    LIBSSH?=            ${DESTDIR}/usr/lib/libssh.a
1405                    LIBSSL?=            ${DESTDIR}/usr/lib/libssl.a
1406                    LIBSTDCXX?=                   ${DESTDIR}/usr/lib/libstdc++.a
1407                    LIBSUPCXX?=                   ${DESTDIR}/usr/lib/libsupc++.a
1408                    LIBTERMINFO?=                 ${DESTDIR}/usr/lib/libterminfo.a
1409                    LIBTRE?=            ${DESTDIR}/usr/lib/libtre.a
1410                    LIBUNBOUND?=                  ${DESTDIR}/usr/lib/libunbound.a
1411                    LIBUSBHID?=                   ${DESTDIR}/usr/lib/libusbhid.a
1412                    LIBUTIL?=           ${DESTDIR}/usr/lib/libutil.a
1413                    LIBWIND?=           ${DESTDIR}/usr/lib/libwind.a
1414                    LIBWRAP?=           ${DESTDIR}/usr/lib/libwrap.a
1415                    LIBY?=                        ${DESTDIR}/usr/lib/liby.a
1416                    LIBZ?=                        ${DESTDIR}/usr/lib/libz.a
1417
1418                    The following c startup files.
1419
1420                    LIBCRT0?=           ${DESTDIR}/usr/lib/crt0.o
1421                    LIBCRTI?=           ${DESTDIR}/usr/lib/crti.o
1422                    LIBCRTBEGIN?=                 ${DESTDIR}/usr/lib/crti.o
1423                    LIBCRTEND?=                   ${DESTDIR}/usr/lib/crtn.o
1424
1425                    The following X-Windows libraries are predefined for DPADD:
1426
1427                    LIBDPS?=            ${DESTDIR}/usr/X11R7/lib/libdps.a
1428                    LIBEGL?=            ${DESTDIR}/usr/X11R7/lib/libEGL.a
1429                    LIBFNTSTUBS?=                 ${DESTDIR}/usr/X11R7/lib/libfntstubs.a
1430                    LIBFONTCACHE?=                ${DESTDIR}/usr/X11R7/lib/libfontcache.a
1431                    LIBFONTCONFIG?=               ${DESTDIR}/usr/X11R7/lib/libfontconfig.a
1432                    LIBFONTENC?=                  ${DESTDIR}/usr/X11R7/lib/libfontenc.a
1433                    LIBFREETYPE?=                 ${DESTDIR}/usr/X11R7/lib/libfreetype.a
1434                    LIBFS?=                       ${DESTDIR}/usr/X11R7/lib/libFS.a
1435                    LIBGL?=                       ${DESTDIR}/usr/X11R7/lib/libGL.a
1436                    LIBGLU?=            ${DESTDIR}/usr/X11R7/lib/libGLU.a
1437                    LIBGLW?=            ${DESTDIR}/usr/X11R7/lib/libGLw.a
1438                    LIBI810XVMC                   4{DESTDIR}/usr/X11R7/lib/libI810XvMC.a
1439                    LIBICE?=            ${DESTDIR}/usr/X11R7/lib/libICE.a
1440                    LIBINTELXVMC                  ${DESTDIR}/usr/X11R7/lib/libIntelXvMC.a
1441                    LIBLBXUTIL?=                  ${DESTDIR}/usr/X11R7/lib/liblbxutil.a
1442                    LIBSM?=                       ${DESTDIR}/usr/X11R7/lib/libSM.a
1443                    LIBX11_XCB?=                  ${DESTDIR}/usr/X11R7/lib/libX11-xcb.a
1444                    LIBX11?=            ${DESTDIR}/usr/X11R7/lib/libX11.a
1445                    LIBXRES?=           ${DESTDIR}/usr/X11R7/lib/libXres.a
1446                    LIBXAU?=            ${DESTDIR}/usr/X11R7/lib/libXau.a
1447                    LIBXAU7?=           ${DESTDIR}/usr/X11R7/lib/libXau7.a
1448                    LIBXAW?=            ${DESTDIR}/usr/X11R7/lib/libXaw.a
1449                    LIBXCB?=            ${DESTDIR}/usr/X11R7/lib/libxcb.a
1450                    LIBXCOMPOSITE?=               ${DESTDIR}/usr/X11R7/lib/libXcomposite.a
1451                    LIBXCURSOR?=                  ${DESTDIR}/usr/X11R7/lib/libXcursor.a
1452                    LIBXCVT?=           ${DESTDIR}/usr/X11R7/lib/libxcvt.a
1453                    LIBXDAMAGE?=                  ${DESTDIR}/usr/X11R7/lib/libXdamage.a
1454                    LIBXDMCP?=                    ${DESTDIR}/usr/X11R7/lib/libXdmcp.a
1455                    LIBXEXT?=           ${DESTDIR}/usr/X11R7/lib/libXext.a
1456                    LIBXFIXES?=                   ${DESTDIR}/usr/X11R7/lib/libXfixes.a
1457                    LIBXFONT2?=                   ${DESTDIR}/usr/X11R7/lib/libXfont2.a
1458                    LIBXFONT?=                    ${DESTDIR}/usr/X11R7/lib/libXfont.a
1459                    LIBXFT?=            ${DESTDIR}/usr/X11R7/lib/libXft.a
1460                    LIBXI?=                       ${DESTDIR}/usr/X11R7/lib/libXi.a
1461                    LIBXINERAMA?=                 ${DESTDIR}/usr/X11R7/lib/libXinerama.a
1462                    LIBXKBFILE?=                  ${DESTDIR}/usr/X11R7/lib/libxkbfile.a
1463                    LIBXMU?=            ${DESTDIR}/usr/X11R7/lib/libXmu.a
1464                    LIBXMUU?=           ${DESTDIR}/usr/X11R7/lib/libXmuu.a
1465                    LIBXPM?=            ${DESTDIR}/usr/X11R7/lib/libXpm.a
1466                    LIBXRANDR?=                   ${DESTDIR}/usr/X11R7/lib/libXrandr.a
1467                    LIBXRENDER?=                  ${DESTDIR}/usr/X11R7/lib/libXrender.a
1468                    LIBXSS?=            ${DESTDIR}/usr/X11R7/lib/libXss.a
1469                    LIBXT?=                       ${DESTDIR}/usr/X11R7/lib/libXt.a
1470                    LIBXTRAP?=                    ${DESTDIR}/usr/X11R7/lib/libXTrap.a
1471                    LIBXTST?=           ${DESTDIR}/usr/X11R7/lib/libXtst.a
1472                    LIBXV?=                       ${DESTDIR}/usr/X11R7/lib/libXv.a
1473                    LIBXXF86DGA?=                 ${DESTDIR}/usr/X11R7/lib/libXxf86dga.a
1474                    LIBXXF86MISC?=                ${DESTDIR}/usr/X11R7/lib/libXxf86misc.a
1475                    LIBXXF86VM?=                  ${DESTDIR}/usr/X11R7/lib/libXxf86vm.a
1476
1477STRIPFLAG The option passed to the install program to cause the binary
1478                    to be stripped.
1479
1480SUBDIR              A list of subdirectories that should be built as well.
1481                    Each of the targets will execute the same target in the
1482                    subdirectories.
1483
1484SCRIPTS             A list of interpreter scripts [file.{sh,csh,pl,awk,...}].
1485                    These are installed exactly like programs.
1486
1487SCRIPTSDIR          The location to install the scripts.  Each script can be
1488                    installed to a separate path by setting SCRIPTSDIR_<script>.
1489
1490SCRIPTSNAME         The name that the above program will be installed as, if
1491                    different from ${SCRIPTS}. These can be further specialized
1492                    by setting SCRIPTSNAME_<script>.
1493
1494FILES               See description of <bsd.files.mk>.
1495
1496SHLINKDIR Target directory for shared linker.  See description of
1497                    <bsd.own.mk> for additional information about this variable.
1498
1499The include file <bsd.prog.mk> includes the file named "../Makefile.inc"
1500if it exists, as well as the include file <bsd.man.mk>.
1501
1502Some simple examples:
1503
1504To build foo from foo.c with a manual page foo.1, use:
1505
1506          PROG=     foo
1507
1508          .include <bsd.prog.mk>
1509
1510To build foo from foo.c with a manual page foo.2, add the line:
1511
1512          MAN=      foo.2
1513
1514If foo does not have a manual page at all, add the line
1515before any make(1) .include directives:
1516
1517          NOMAN=
1518
1519If foo has multiple source files, add the line:
1520
1521          SRCS=     a.c b.c c.c d.c
1522
1523
1524=-=-=-=-=   bsd.rpc.mk   =-=-=-=-=
1525
1526The include file <bsd.rpc.mk> contains a makefile fragment used to
1527construct source files built by rpcgen.
1528
1529The following macros may be defined in makefiles which include
1530<bsd.rpc.mk> in order to control which files get built and how they
1531are to be built:
1532
1533RPC_INCS  construct .h file from .x file
1534RPC_XDRFILES        construct _xdr.c from .x file
1535                    (for marshalling/unmarshalling data types)
1536RPC_SVCFILES        construct _svc.c from .x file
1537                    (server-side stubs)
1538RPC_SVCFLAGS        Additional options passed to builds of RPC_SVCFILES.
1539
1540RPC_XDIR  Directory containing .x/.h files
1541
1542
1543=-=-=-=-=   bsd.shlib.mk   =-=-=-=-=
1544
1545The include file <bsd.shlib.mk> computes parameters for shared library
1546installation and use.  It defines no targets.  <bsd.own.mk> MUST be
1547included before <bsd.shlib.mk>.
1548
1549<bsd.own.mk> sets the following variables, if they are not already defined
1550(defaults are in brackets):
1551
1552SHLIBINSTALLDIR If ${USE_SHLIBDIR} is not "no", use ${SHLIBINSTALLDIR}
1553                    instead of ${LIBDIR} as the base path for shared library
1554                    installation.  [/lib]
1555
1556SHLIBDIR  The path to USE_SHLIBDIR shared libraries to use when building
1557                    a program.  [/lib for programs in /bin and /sbin, /usr/lib
1558                    for all others.]
1559
1560_LIBSODIR Set to ${SHLIBINSTALLDIR} if ${USE_SHLIBDIR} is not "no",
1561                    otherwise set to ${LIBDIR}
1562
1563SHLINKINSTALLDIR Base path for shared linker.  [/libexec]
1564
1565SHLINKDIR Path to use for shared linker when building a program.
1566                    [/libexec for programs in /bin and /sbin, /usr/libexec for
1567                    all others.]
1568
1569
1570=-=-=-=-=   bsd.subdir.mk   =-=-=-=-=
1571
1572The include file <bsd.subdir.mk> contains the default targets for building
1573subdirectories.  It has the same eight targets as <bsd.prog.mk>: all,
1574clean, cleandir, depend, includes, install, lint, and tags.  It uses the
1575following variables:
1576
1577NOSUBDIR  If this variable is defined, then the SUBDIR variable
1578                    will be ignored and subdirectories will not be processed.
1579
1580SUBDIR              For all of the directories listed in ${SUBDIR}, the
1581                    specified directory will be visited and the target made.
1582
1583                    As a special case, the use of a token .WAIT as an
1584                    entry in SUBDIR acts as a synchronization barrier
1585                    when multiple make jobs are run; subdirs before the
1586                    .WAIT must complete before any subdirs after .WAIT are
1587                    started.  See make(1) for some caveats on use of .WAIT
1588                    and other special sources.
1589
1590
1591=-=-=-=-=   bsd.x11.mk   =-=-=-=-=
1592
1593The include file <bsd.x11.mk> contains parameters and targets for
1594cross-building X11 from ${X11SRCDIR.<package>}.  It should be included
1595after the general Makefile contents but before the include files such as
1596<bsd.prog.mk> and <bsd.lib.mk>.
1597
1598It provides the following targets:
1599          .man.1 .man.3 .man.4 .man.5 .man.7:
1600                    If ${MAN} or ${PROG} is set and ${MKMAN} != "no",
1601                    these rules convert from X11's manual page source
1602                    into an mdoc.old source file.
1603
1604It sets the following variables:
1605
1606BINDIR                        Set to ${X11BINDIR}.
1607                              To override, define after including <bsd.x11.mk>
1608
1609LIBDIR                        Set to ${X11USRLIBDIR}.
1610                              To override, define after including <bsd.x11.mk>
1611
1612MANDIR                        Set to ${X11MANDIR}.
1613                              To override, define after including <bsd.x11.mk>
1614
1615CPPFLAGS            Appended with definitions to include from
1616                              ${DESTDIR}${X11INCDIR}
1617
1618LDFLAGS                       Appended with definitions to link from
1619                              ${DESTDIR}${X11USRLIBDIR}
1620
1621X11FLAGS.CONNECTION Equivalent to X11's CONNECTION_FLAGS.
1622
1623X11FLAGS.EXTENSION  Equivalent to X11's EXT_DEFINES.
1624
1625X11FLAGS.LOADABLE   Equivalent to X11's LOADABLE.
1626
1627X11FLAGS.OS_DEFINES Equivalent to X11's OS_DEFINES.
1628
1629X11FLAGS.SERVER               Equivalent to X11's ServerDefines.
1630
1631X11FLAGS.THREADLIB  Equivalent to X11's THREADS_DEFINES for libraries.
1632
1633X11FLAGS.THREADS    Equivalent to X11's THREADS_DEFINES.
1634
1635X11FLAGS.VERSION    cpp(1) definitions of OSMAJORVERSION and OSMINORVERSION.
1636
1637X11FLAGS.DIX                  Equivalent to X11's DIX_DEFINES.
1638
1639X11TOOL_UNXCOMM               Commandline to convert `XCOMM' comments to `#'
1640
1641It uses the following variables:
1642
1643APPDEFS                       List of app-default files to install.
1644
1645CPPSCRIPTS                    List of files/scripts to run through cpp(1)
1646                              and then ${X11TOOL_UNXCOMM}.  The source files
1647                              have a `.cpp' suffix, the generated files do not.
1648
1649CPPSCRIPTFLAGS                Additional options to cpp(1) when building CPPSCRIPTS.
1650
1651CPPSCRIPTFLAGS_<fn> Additional options to cpp(1) when building CPPSCRIPT <fn>.
1652
1653
1654=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1655
1656The following files are described here for completion, but they are not
1657supposed to be included directly from other Makefiles; they are used
1658internally by other system files.
1659
1660=-=-=-=-=   bsd.sys.mk   =-=-=-=-=
1661
1662The include file <bsd.sys.mk> is used by other system mk files and
1663it is not intended to be included standalone. It contains rules and
1664system build variables. It requires bsd.own.mk to be included first.
1665It contains overrides that are used when building the NetBSD source tree.
1666
1667The following variables control how various files are compiled/built.
1668(Note that these may be overridden in <bsd.own.mk> if USETOOLS == "yes"):
1669
1670AR                  Create, modify, and extract from archives.  [ar]
1671
1672ARFLAGS             Options to ${AR}.  [rl]
1673
1674ARM_ELF2AOUT        Convert ELF-format executable to a.out.  [elf2aout]
1675
1676AS                  Assembler.  [as]
1677
1678AFLAGS              Options to ${CC} when compiling or linking .s or .S
1679                    assembly source files.  []
1680
1681BUILDSEED g++(1) uses random numbers when compiling C++ code.  This
1682                    variable seeds the g++(1) random number generator using
1683                    -frandom-seed with this value.  By default, it is set to
1684                    "NetBSD-(majorversion)".  Using a fixed value causes C++
1685                    binaries to be the same when built from the same sources,
1686                    resulting in identical (reproducible) builds.  Additional
1687                    information is available in the g++(1) documentation of
1688                    -frandom-seed.
1689
1690                    Default: Unset.
1691
1692CC                  C compiler.  [cc]
1693
1694CFLAGS              Options to ${CC}.  [Usually -O or -O2]
1695                    Note: CFLAGS should never be set in mk.conf(5).
1696
1697CPP                 C Pre-Processor.  [cpp]
1698
1699CPPFLAGS  Options to ${CPP}.  []
1700
1701CPUFLAGS  Optimization options for ${CC}.  []
1702
1703CXX                 C++ compiler.  [c++]
1704
1705CXXFLAGS  Options to ${CXX}.  [${CFLAGS}]
1706
1707M68K_ELF2AOUT       Convert ELF-format executable to a.out.  [elf2aout]
1708
1709MIPS_ELF2ECOFF      Convert ELF-format executable to ECOFF.  [elf2ecoff]
1710
1711FC                  Fortran compiler.  [f77]
1712
1713FFLAGS              Options to {$FC}.  [-O]
1714
1715HOST_SH             Shell.  This must be an absolute path, because it may be
1716                    substituted into "#!" lines in scripts.  [/bin/sh]
1717
1718INSTALL             install(1) command.  [install]
1719
1720LEX                 Lexical analyzer.  [lex]
1721
1722LFLAGS              Options to ${LEX}.  []
1723
1724LPREFIX             Symbol prefix for ${LEX} (see -P option in lex(1)) [yy]
1725
1726LD                  Linker.  [ld]
1727
1728LDFLAGS             Options to ${CC} during the link process.  []
1729
1730LINT                C program verifier.  [lint]
1731
1732LINTFLAGS Options to ${LINT}.  [-chapbrxzgFS]
1733
1734LORDER              List dependencies for object files.  [lorder]
1735
1736MAKE                make(1).  [make]
1737
1738MKDEP               Construct Makefile dependency list.  [mkdep]
1739
1740MKDEPCXX  Construct Makefile dependency list for C++ files.  [mkdep]
1741
1742NM                  List symbols from object files.  [nm]
1743
1744PC                  Pascal compiler.  [pc]        (Not present)
1745
1746PFLAGS              Options to ${PC}.  []
1747
1748OBJC                Objective C compiler.  [${CC}]
1749
1750OBJCFLAGS Options to ${OBJC}.  [${CFLAGS}]
1751
1752OBJCOPY             Copy and translate object files.  [objcopy]
1753
1754OBJCOPYLIBFLAGS Options to pass to objcopy when library objects are
1755                    being built. [${.TARGET} =~ "*.po" ? -X : -x]
1756
1757OBJDUMP             Display information from object files.  [objdump]
1758
1759RANLIB              Generate index to archive.  [ranlib]
1760
1761READELF             Display information from ELF object files.  [readelf]
1762
1763SIZE                List section sizes and total size.  [size]
1764
1765STRINGS             Display printable character sequences in files.  [strings]
1766
1767STRIP               Discard symbols from object files.  [strip]
1768
1769TSORT               Topological sort of a directed graph.  [tsort -q]
1770
1771YACC                LALR(1) parser generator.  [yacc]
1772
1773YFLAGS              Options to ${YACC}.  []
1774
1775YHEADER             If defined, add "-d" to YFLAGS, and add dependencies
1776                    from <file>.y to <file>.h and <file>.c, and add
1777                    <foo>.h to CLEANFILES.
1778
1779YPREFIX             If defined, add "-p ${YPREFIX}" to YFLAGS.
1780
1781
1782Other variables of note (incomplete list):
1783
1784NOCLANGERROR        If defined and clang is used as C compiler, -Werror is not
1785                    passed to it.
1786
1787NOGCCERROR          If defined, prevents passing certain ${CFLAGS} to GCC
1788                    that cause warnings to be fatal, such as:
1789                              -Werror -Wa,--fatal-warnings
1790                    (The latter being for as(1).)
1791
1792WARNS               Crank up compiler warning options; the distinct levels are:
1793                              WARNS=1
1794                              WARNS=2
1795                              WARNS=3
1796                              WARNS=4
1797                              WARNS=5
1798                              WARNS=6
1799
1800=-=-=-=-=   bsd.host.mk   =-=-=-=-=
1801
1802This file is automatically included from bsd.own.mk. It contains settings
1803for all the HOST_* variables that are used in host programs and libraries.
1804
1805HOST_AR                       The host archive processing command
1806
1807HOST_CC                       The host c compiler
1808
1809HOST_CFLAGS                   The host c compiler options
1810
1811HOST_COMPILE.c                The host c compiler line with options
1812
1813HOST_COMPILE.cc               The host c++ compiler line with options
1814
1815HOST_CPP            The host c pre-processor
1816
1817HOST_CPPFLAGS                 The host c pre-processor options
1818
1819HOST_CXX            The host c++ compiler
1820
1821HOST_CXXFLAGS                 The host c++ compiler options
1822
1823HOST_INSTALL_DIR    The host command to install a directory
1824
1825HOST_INSTALL_FILE   The host command to install a file
1826
1827HOST_INSTALL_SYMLINK          The host command to install a symlink
1828
1829HOST_LD                       The host linker command
1830
1831HOST_LDFLAGS                  The host linker options
1832
1833HOST_LINK.c                   The host c linker line with options
1834
1835HOST_LINK.cc                  The host c++ linker line with options
1836
1837HOST_LN                       The host command to link two files
1838
1839HOST_MKDEP                    The host command to create dependencies for c programs
1840
1841HOST_MKDEPCXX                 The host command to create dependencies for c++ programs
1842
1843HOST_OSTYPE                   The host OSNAME-RELEASE-ARCH tupple
1844
1845HOST_RANLIB                   The host command to create random access archives
1846
1847HOST_SH                       The host Bourne shell interpreter name (absolute path)
1848
1849=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1850