bsd.README revision 1.450
1#	$NetBSD: bsd.README,v 1.450 2024/09/24 14:25:43 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_VGRIND		Grind nice listings of programs.  [vgrind -f]
655
656TOOL_ZIC		Time zone compiler.  [zic]
657
658For each possible value of MACHINE_CPU, MACHINES.${MACHINE_CPU} contain a
659list of what ports can be built for it.  This keeps those definitions in
660centralized place.
661
662<bsd.own.mk> is generally useful when building your own Makefiles so that
663they use the same default owners etc. as the rest of the tree.
664
665
666=-=-=-=-=   bsd.clean.mk   =-=-=-=-=
667
668The include file <bsd.clean.mk> defines the clean and cleandir
669targets.  It uses the following variables:
670
671CLEANFILES	Files to remove for both the clean and cleandir targets.
672
673CLEANDIRFILES	Files to remove for the cleandir target, but not for
674		the clean target.
675
676MKCLEANSRC	Controls whether or not the clean and cleandir targets
677		will delete files from both the object directory,
678		${.OBJDIR}, and the source directory, ${.CURDIR}.
679
680		If MKCLEANSRC is set to "no", then the file names in
681		CLEANFILES or CLEANDIRFILES are interpreted relative
682		to the object directory, ${.OBJDIR}.  This is the
683		traditional behaviour.
684
685		If MKCLEANSRC is set to "yes", then the file deletion
686		is performed relative to both the object directory,
687		${.OBJDIR}, and the source directory, ${.CURDIR}.  (This
688		has no effect if ${.OBJDIR} is the same as ${.CURDIR}.)
689		Deleting files from ${.CURDIR} is intended to remove
690		stray output files that had been left in the source
691		directory by an earlier build that did not use object
692		directories.
693
694		The default is MKCLEANSRC=yes.  If you always build with
695		separate object directories, and you are sure that there
696		are no stray files in the source directories, then you
697		may set MKCLEANSRC=no to save some time.
698
699MKCLEANVERIFY	Controls whether or not the clean and cleandir targets
700		will verify that files have been deleted.
701
702		If MKCLEANVERIFY is set to "no", then the files will
703		be deleted using a "rm -f" command, and its success or
704		failure will be ignored.
705
706		If MKCLEANVERIFY is set to "yes", then the success of
707		the "rm -f" command will be verified using an "ls"
708		command.
709
710		The default is MKCLEANVERIFY=yes.  If you are sure that
711		there will be no problems caused by file permissions,
712		read-only file systems, or the like, then you may set
713		MKCLEANVERIFY=no to save some time.
714
715To use the clean and cleandir targets defined in <bsd.clean.mk>, other
716Makefiles or bsd.*.mk files should append file names to the CLEANFILES
717or CLEANDIRFILES variables.  For example:
718
719	    CLEANFILES+= a.out
720	    CLEANDIRFILES+= .depend
721
722	    .include <bsd.clean.mk>
723
724The files listed in CLEANFILES and CLEANDIRFILES must not be
725directories, because the potential risk from running "rm -rf" commands
726in bsd.clean.mk is considered too great.  If you want to recursively
727delete a directory as part of "make clean" or "make cleandir" then you
728need to provide your own target.
729
730=-=-=-=-=   bsd.dep.mk   =-=-=-=-=
731
732The include file <bsd.dep.mk> contains the default targets for building
733.depend files.  It creates .d files from entries in SRCS and DPSRCS
734that are C, C++, or Objective C source files, and builds .depend from the
735.d files.  All other files in SRCS and all of DPSRCS will be used as
736dependencies for the .d files.  In order for this to function correctly,
737it should be .included after all other .mk files and directives that may
738modify SRCS or DPSRCS.  It uses the following variables:
739
740SRCS		List of source files to build the program.
741
742DPSRCS		List of source files which are needed for generating
743		dependencies, but are not needed in ${SRCS}.
744
745NODPSRCS	TODO
746
747=-=-=-=-=   bsd.files.mk   =-=-=-=-=
748
749The include file <bsd.files.mk> handles the FILES variables and is included
750from <bsd.lib.mk> and <bsd.prog.mk>, and uses the following variables:
751
752FILES		The list of files to install.
753
754CONFIGFILES	Similar semantics to FILES, except that the files
755		are installed by the `configinstall' target,
756		not the `install' target.
757		The FILES* variables documented below also apply.
758
759FILESOWN	File owner.  [${BINOWN}]
760
761FILESGRP	File group.  [${BINGRP}]
762
763FILESMODE	File mode.  [${NONBINMODE}]
764
765FILESDIR	The location to install the files.
766
767FILESNAME	Optional name to install each file as.
768
769FILESOWN_<fn>	File owner of the specific file <fn>.
770
771FILESGRP_<fn>	File group of the specific file <fn>.
772
773FILESMODE_<fn>	File mode of the specific file <fn>.
774
775FILESDIR_<fn>	The location to install the specific file <fn>.
776
777FILESNAME_<fn>	Optional name to install <fn> as.
778
779FILESBUILD	If this variable is defined, then its value will be
780		used as the default for all FILESBUILD_<fn> variables.
781		Otherwise, the default will be "no".
782
783FILESBUILD_<fn> A value different from "no" will add the file to the list of
784		targets to be built by `realall'.  Users of that variable
785		should provide a target to build the file.
786
787
788BUILDSYMLINKS	List of two word items:
789			lnsrc lntgt
790		For each lnsrc item, create a symlink named lntgt.
791		The lntgt symlinks are removed by the cleandir target.
792
793UUDECODE_FILES	List of files which are stored as <file>.uue in the source
794		tree. Each one will be decoded with ${TOOL_UUDECODE}.
795		The source files have a `.uue' suffix, the generated files do
796		not.
797
798UUDECODE_FILES_RENAME_<fn>
799		Rename the output from the decode to the provided name.
800
801		Note: These files are simply decoded, with no install or other
802		rule applying implicitly except being added to the clean
803		target.
804
805=-=-=-=-=   bsd.gcc.mk   =-=-=-=-=
806
807The include file <bsd.gcc.mk> computes various parameters related to GCC
808support libraries.  It defines no targets.  <bsd.own.mk> MUST be included
809before <bsd.gcc.mk>.
810
811The primary users of <bsd.gcc.mk> are <bsd.prog.mk> and <bsd.lib.mk>, each
812of which need to know where to find certain GCC support libraries.
813
814The behavior of <bsd.gcc.mk> is influenced by the EXTERNAL_TOOLCHAIN variable,
815which is generally set by the user.  If EXTERNAL_TOOLCHAIN it set, then
816the compiler is asked where to find the support libraries, otherwise the
817support libraries are found in ${DESTDIR}/usr/lib.
818
819<bsd.gcc.mk> sets the following variables:
820
821_GCC_CRTBEGIN	The full path name to crtbegin.o.
822
823_GCC_CRTBEGINS	The full path name to crtbeginS.o.
824
825_GCC_CRTEND	The full path name to crtend.o.
826
827_GCC_CRTENDS	The full path name to crtendS.o.
828
829_GCC_LIBGCCDIR	The directory where libgcc.a is located.
830
831
832=-=-=-=-=   bsd.inc.mk   =-=-=-=-=
833
834The include file <bsd.inc.mk> defines the includes target and uses the
835variables:
836
837INCS		The list of include files.
838
839INCSDIR		The location to install the include files.
840
841INCSNAME	Target name of the include file, if only one; same as
842		FILESNAME, but for include files.
843
844INCSYMLINKS	Similar to SYMLINKS in <bsd.links.mk>, except that these
845		are installed in the 'includes' target and not the
846		(much later) 'install' target.
847
848INCSNAME_<file> The name file <file> should be installed as, if not <file>,
849		same as FILESNAME_<file>, but for include files.
850
851
852=-=-=-=-=   bsd.info.mk   =-=-=-=-=
853
854The include file <bsd.info.mk> is used to generate and install GNU Info
855documentation from respective Texinfo source files.  It defines three
856implicit targets (.txi.info, .texi.info, and .texinfo.info), and uses the
857following variables:
858
859TEXINFO		List of Texinfo source files.  Info documentation will
860		consist of single files with the extension replaced by
861		.info.
862
863INFOFLAGS	Options to pass to makeinfo.  []
864
865
866=-=-=-=-=   bsd.kernobj.mk   =-=-=-=-=
867
868The include file <bsd.kernobj.mk> defines variables related to the
869location of kernel sources and object directories.
870
871KERNSRCDIR	Directory at the top of the kernel source..
872		[${NETBSDSRCDIR}/sys]
873
874KERNARCHDIR	Directory under KERNSRCDIR containing the machine
875		dependent kernel sources.
876		[arch/${MACHINE}]
877
878KERNCONFDIR	Directory containing the kernel configuration files.
879		[${KERNSRCDIR}/${KERNARCHDIR}/conf]
880
881KERNOBJDIR	Directory for kernel builds.  For example, the kernel
882		GENERIC will be compiled in KERNOBJDIR/GENERIC.
883		Default:
884		${MAKEOBJDIRPREFIX}${KERNSRCDIR}/${KERNARCHDIR}/compile
885		if it exists or the make(1) target 'obj' is being made;
886		otherwise ${KERNSRCDIR}/${KERNARCHDIR}/compile.
887
888It is important that Makefiles (such as those under src/distrib) that
889wish to find compiled kernels use <bsd.kernobj.mk> and ${KERNOBJDIR}
890rather than make assumptions about the location of the compiled kernel.
891
892
893=-=-=-=-=   bsd.kinc.mk   =-=-=-=-=
894
895The include file <bsd.kinc.mk> defines the many targets (includes,
896subdirectories, etc.), and is used by kernel makefiles to handle
897include file installation.  It is intended to be included alone, by
898kernel Makefiles.  It uses similar variables to <bsd.inc.mk>.
899Please see <bsd.kinc.mk> for more details, and keep the documentation
900in that file up to date.
901
902=-=-=-=-=   bsd.syscall.mk =-=-=-=-=
903
904The include file <bsd.syscall.mk> contains the logic to create syscall
905files for various emulations. It includes <bsd.kinc.mk> to handle the
906rest of the targets.
907
908=-=-=-=-=   bsd.lib.mk   =-=-=-=-=
909
910The include file <bsd.lib.mk> has support for building libraries.  It has
911the same eight targets as <bsd.prog.mk>: all, clean, cleandir, depend,
912includes, install, lint, and tags.  Additionally, it has a checkver target
913which checks for installed shared object libraries whose version is greater
914that the version of the source. It has a limited number of suffixes,
915consistent with the current needs of the BSD tree.  <bsd.lib.mk> includes
916<bsd.shlib.mk> to get shared library parameters.
917
918It sets/uses the following variables:
919
920LIB		The name of the library to build.
921
922LIBDIR		Target directory for libraries.
923
924SHLIBINSTALLDIR Target directory for shared libraries if ${USE_SHLIBDIR}
925		is not "no".
926
927SHLIB_MAJOR
928SHLIB_MINOR
929SHLIB_TEENY	Major, minor, and teeny version numbers of shared library
930
931USE_SHLIBDIR	If not "no", use ${SHLIBINSTALLDIR} instead of ${LIBDIR}
932		as the path to install shared libraries to.
933		USE_SHLIBDIR must be defined before <bsd.own.mk> is included.
934		Default: no
935
936LIBISMODULE	If not "no", install as ${LIB}.so (without the "lib" prefix),
937		and act as "MKDEBUGLIB=no MKPICINSTALL=no MKPROFILE=no
938		MKSTATICLIB=no". Also do not install the lint library.
939		Default: no
940
941LIBISPRIVATE	If not "no", act as "MKDEBUGLIB=no MKPIC=no MKPROFILE=no",
942		and don't install the (.a) library or the lint library.
943		This is useful for "build only" helper libraries.
944		If set to "pic", then a _pic.a library is also produced,
945		so that it can be incorporated into other shared objects.
946		Default: no
947
948LIBISCXX	If not "no", Use ${CXX} instead of ${CC} to link
949		shared libraries.
950		This is useful for C++ libraries.
951		Default: no
952
953LINTLIBDIR	Target directory for lint libraries.
954
955LIBGRP		Library group.
956
957LIBOWN		Library owner.
958
959LIBMODE		Library mode.
960
961LDADD		Additional loader objects.
962
963MAN		The manual pages to be installed (use a .1 - .9 suffix).
964
965NOCHECKVER_<library>
966NOCHECKVER	If set, disables checking for installed shared object
967		libraries with versions greater than the source.  A
968		particular library name, without the "lib" prefix, may
969		be appended to the variable name to disable the check for
970		only that library.
971
972SRCS		List of source files to build the library.  Suffix types
973		.s, .c, and .f are supported.  Note, .s files are preferred
974		to .c files of the same name.  (This is not the default for
975		versions of make.)
976
977LIBDPLIBS/
978PROGDPLIBS	A list of the tuples:
979			libname	 path-to-srcdir-of-libname
980
981		Instead of depending on installed versions of the libraries,
982		one can depend on their built version in the source directory.
983		This is useful for finding private libraries (LIBISPRIVATE).
984
985		For each tuple;
986		     *	LIBDO.libname contains the .OBJDIR of the library
987			`libname', and if it is not set it is determined
988			from the srcdir and added to MAKEOVERRIDES (the
989			latter is to allow for build time optimization).
990		     *	LDADD gets  -L${LIBDO.libname} -llibname    added.
991		     *	DPADD gets  ${LIBDO.libname}/liblibname.so  or
992				    ${LIBDO.libname}/liblibname.a   added.
993
994		The special value "_external" for LIBDO.lib makes the
995		build system to assume the library comes from outside
996		of the NetBSD source tree and only causes -llibname
997		to be added to LDADD.
998
999		This variable may be used for individual libraries/programs,
1000		as well as in parent directories to cache common libraries
1001		as a build-time optimization.
1002
1003LIB_EXPSYM	File listing all symbols expected to be defined by the
1004		library.  Each line has a single symbol.  If the symbol
1005		is versioned, it is followed by `@@', if it is the
1006		default version, or `@', if not, and the symbol
1007		version.  The lines must be sorted in LANG=C.
1008
1009		bsd.lib.mk checks to make sure exactly the set of
1010		symbols in this file is defined when the library is
1011		built; if not, the build will fail and print a diff
1012		from the expected symbols to the actual symbols.
1013		During development, you can update the expected symbols
1014		from the actual ones with `make update-symbols'.
1015
1016VERSION_MAP	Path to an ld version script to use when linking the
1017		library.  Resolved from .PATH like a target
1018		prerequisite.
1019
1020
1021The include file <bsd.lib.mk> includes the file named "../Makefile.inc"
1022if it exists, as well as the include file <bsd.man.mk>.
1023
1024It has rules for building profiled objects; profiled libraries are
1025built by default.
1026
1027Libraries are ranlib'd when made.
1028
1029
1030=-=-=-=-=   bsd.links.mk   =-=-=-=-=
1031
1032The include file <bsd.links.mk> handles the LINKS and SYMLINKS variables
1033and is included from <bsd.lib.mk> and <bsd.prog.mk>.
1034
1035LINKSOWN, LINKSGRP, and LINKSMODE, are relevant only if a metadata log
1036is used. The defaults may be modified by other bsd.*.mk files which
1037include bsd.links.mk.  In the future, these variables may be replaced
1038by a method for explicitly recording hard links in a metadata log.
1039
1040LINKS		The list of hard links, consisting of pairs of paths:
1041			source-file target-file
1042		${DESTDIR} is prepended to both paths before linking.
1043		For example, to link /bin/test and /bin/[, use:
1044			LINKS=/bin/test /bin/[
1045
1046CONFIGLINKS	Similar semantics to LINKS, except that the links
1047		are installed by the `configinstall' target,
1048		not the `install' target.
1049
1050SYMLINKS	The list of symbolic links, consisting of pairs of paths:
1051			source-file target-file
1052		${DESTDIR} is only prepended to target-file before linking.
1053		For example, to symlink /usr/bin/tar to /bin/tar resulting
1054		in ${DESTDIR}/usr/bin/tar -> /bin/tar:
1055			SYMLINKS=/bin/tar /usr/bin/tar
1056
1057CONFIGSYMLINKS	Similar semantics to SYMLINKS, except that the symbolic links
1058		are installed by the `configinstall' target,
1059		not the `install' target.
1060
1061LINKSOWN	Link owner.  [${BINOWN}]
1062
1063LINKSGRP	Link group.  [${BINGRP}]
1064
1065LINKSMODE	Link mode.  [${NONBINMODE}]
1066
1067LINKSOWN_<fn>	Link owner of the specific file <fn>.
1068
1069LINKSGRP_<fn>	Link group of the specific file <fn>.
1070
1071LINKSMODE_<fn>	Link mode of the specific file <fn>.
1072
1073
1074=-=-=-=-=   bsd.man.mk   =-=-=-=-=
1075
1076The include file <bsd.man.mk> handles installing manual pages and their
1077links.
1078
1079It has a three targets:
1080
1081	catinstall:
1082		Install the preformatted manual pages and their links.
1083	htmlinstall:
1084		Install the HTML manual pages and their links.
1085	maninstall:
1086		Install the manual page sources and their links.
1087
1088It sets/uses the following variables:
1089
1090MANDIR		Base path for manual installation.
1091
1092MANGRP		Manual group.
1093
1094MANOWN		Manual owner.
1095
1096MANMODE		Manual mode.
1097
1098MANSUBDIR	Subdirectory under the manual page section, i.e. "/vax"
1099		or "/tahoe" for machine specific manual pages.
1100
1101MAN		The manual pages to be installed (use a .1 - .9 suffix).
1102
1103MLINKS		List of manual page links (using a .1 - .9 suffix).  The
1104		linked-to file must come first, the linked file second,
1105		and there may be multiple pairs.
1106
1107The include file <bsd.man.mk> includes a file named "../Makefile.inc" if
1108it exists.
1109
1110
1111=-=-=-=-=   bsd.obj.mk   =-=-=-=-=
1112
1113The include file <bsd.obj.mk> defines targets related to the creation
1114and use of separated object and source directories.
1115
1116If an environment variable named MAKEOBJDIRPREFIX is set, make(1) uses
1117${MAKEOBJDIRPREFIX}${.CURDIR} as the name of the object directory if
1118it exists.  Otherwise make(1) looks for the existence of a
1119subdirectory (or a symlink to a directory) of the source directory
1120into which built targets should be placed.  If an environment variable
1121named MAKEOBJDIR is set, make(1) uses its value as the name of the
1122object directory; failing that, make first looks for a subdirectory
1123named "obj.${MACHINE}", and if that doesn't exist, it looks for "obj".
1124
1125Object directories are not created automatically by make(1) if they
1126don't exist; you need to run a separate "make obj".  (This will happen
1127during a top-level build if "MKOBJDIRS" is set to a value other than
1128"no").  When the source directory is a subdirectory of ${BSDSRCDIR} --
1129and this is determined by a simple string prefix comparison -- object
1130directories are created in a separate object directory tree, and a
1131symlink to the object directory in that tree is created in the source
1132directory; otherwise, "make obj" assumes that you're not in the main
1133source tree and that it's not safe to use a separate object tree.
1134
1135Several variables used by <bsd.obj.mk> control exactly what
1136directories and links get created during a "make obj":
1137
1138MAKEOBJDIR	If set, this is the component name of the object
1139		directory.
1140
1141OBJMACHINE	If this is set but MAKEOBJDIR is not set, creates
1142		object directories or links named "obj.${MACHINE}";
1143		otherwise, just creates ones named "obj".
1144
1145OBJMACHINE_ARCH If set with OBJMACHINE, creates object directories or
1146		links named "obj.${MACHINE}-${MACHINE_ARCH}".
1147
1148USR_OBJMACHINE	If set, and the current directory is a subdirectory of
1149		${BSDSRCDIR}, create object directory in the
1150		corresponding subdirectory of ${BSDOBJDIR}.${MACHINE};
1151		otherwise, create it in the corresponding subdirectory
1152		of ${BSDOBJDIR}
1153
1154BUILDID		Identifier for the build.  If set, this should be a short
1155		string that is suitable for use as part of a file or
1156		directory name.  The identifier will be appended to
1157		object directory names; if OBJMACHINE is also set, then
1158		.BUILDID is appended after .MACHINE.  The identifier will
1159		also be used as part of the kernel version string, which
1160		can be shown by “uname -v”.
1161
1162		Default: Unset.
1163
1164
1165=-=-=-=-=   bsd.prog.mk   =-=-=-=-=
1166
1167The include file <bsd.prog.mk> handles building programs from one or
1168more source files, along with their manual pages.  It has a limited number
1169of suffixes, consistent with the current needs of the BSD tree.
1170<bsd.prog.mk> includes <bsd.shlib.mk> to get shared library parameters.
1171
1172It has eight targets:
1173
1174	all:
1175		build the program and its manual page.  This also
1176		creates a GDB initialization file (.gdbinit) in
1177		the objdir.  The .gdbinit file sets the shared library
1178		prefix to ${DESTDIR} to facilitate cross-debugging.
1179	clean:
1180		remove the program, any object files and the files a.out,
1181		Errs, errs, mklog, and ${PROG}.core.
1182	cleandir:
1183		remove all of the files removed by the target clean, as
1184		well as .depend, tags, and any manual pages.
1185		`distclean' is a synonym for `cleandir'.
1186	depend:
1187		make the dependencies for the source files, and store
1188		them in the file .depend.
1189	includes:
1190		install any header files.
1191	install:
1192		install the program and its manual pages; if the Makefile
1193		does not itself define the target install, the targets
1194		beforeinstall and afterinstall may also be used to cause
1195		actions immediately before and after the install target
1196		is executed.
1197	lint:
1198		run lint on the source files
1199	tags:
1200		create a tags file for the source files.
1201
1202It sets/uses the following variables:
1203
1204BINGRP		Binary group.
1205
1206BINOWN		Binary owner.
1207
1208BINMODE		Binary mode.
1209
1210CLEANDIRFILES	Additional files to remove for the cleandir target.
1211
1212CLEANFILES	Additional files to remove for the clean and cleandir targets.
1213
1214CONFIGOPTS	Additional options to config(1) when building kernels.
1215
1216		Default: Unset.
1217
1218COPTS		Extra options for the C compiler.  Should be appended to
1219		(e.g., COPTS+=-g), rather than explicitly set.
1220
1221		Note: CPUFLAGS, not COPTS, should be used for compiler
1222		options that select CPU-related options.
1223
1224COPTS.<fn>	Extra options for the C compiler when creating the
1225		C objects for <fn>.
1226		For <fn>.[ly], "<fn>.c" must be used.
1227
1228CPUFLAGS	Additional options passed to the compiler/assembler to
1229		select CPU instruction set options, CPU tuning options,
1230		etc.
1231
1232		Note: Such options should not be specified in COPTS,
1233		because some parts of the build process need to override
1234		CPU-related compiler options.
1235
1236		Default: Unset.
1237
1238CPUFLAGS.<fn>	Additional options to the compiler/assembler for <fn>.
1239		For <fn>.[ly], "<fn>.c" must be used.
1240
1241CPPFLAGS	Additional options to the C pre-processor.
1242
1243CPPFLAGS.<fn>	Additional options to the C pre-processor for <fn>.
1244		For <fn>.[ly], "<fn>.c" must be used.
1245
1246GDBINIT		List of GDB initialization files to add to "source"
1247		directives in the .gdbinit file that is created in the
1248		objdir.
1249
1250LDADD		Additional loader objects.  Usually used for libraries.
1251		For example, to load with the compatibility and utility
1252		libraries, use:
1253
1254			LDADD+=-lutil -lcompat
1255
1256LDFLAGS		Additional linker options (passed to ${CC} during link).
1257
1258LINKS		See <bsd.links.mk>
1259
1260OBJCOPTS	Additional options to the compiler when creating ObjC objects.
1261
1262OBJCOPTS.<fn>	Additional options to the compiler when creating the
1263		ObjC objects for <fn>.
1264		For <fn>.[ly], "<fn>.c" must be used.
1265
1266SYMLINKS	See <bsd.links.mk>
1267
1268MAN		Manual pages (should end in .1 - .9).  If no MAN variable is
1269		defined, "MAN=${PROG}.1" is assumed.
1270
1271PAXCTL_FLAGS	If defined, run paxctl(1) on the program binary after link
1272		time, with the value of this variable as options to paxctl(1).
1273
1274PAXCTL_FLAGS.${PROG} Custom override for PAXCTL_FLAGS.
1275
1276PROG		The name of the program to build.  If not supplied, nothing
1277		is built.
1278
1279PROG_CXX	If defined, the name of the program to build.  Also
1280		causes <bsd.prog.mk> to link the program with the C++
1281		compiler rather than the C compiler.  PROG_CXX overrides
1282		the value of PROG if PROG is also set.
1283
1284PROGNAME	The name that the above program will be installed as, if
1285		different from ${PROG}.
1286
1287PROGS		Multiple programs to build from a single directory.
1288		Defaults to PROG. For each program ${_P} in ${PROGS},
1289		uses SRCS.${_P}, defaulting to ${_P}.c.
1290
1291PROGS_CXX	Multiple C++ programs to build from a single directory.
1292		Defaults to PROG_CXX. For each program ${_P} in ${PROGS_CXX},
1293		uses SRCS.${_P}, defaulting to ${_P}.cc.
1294
1295SRCS		List of source files to build the program.  If SRCS is not
1296		defined, it's assumed to be ${PROG}.c or ${PROG_CXX}.cc.
1297
1298DPSRCS		List of source files which are needed for generating
1299		dependencies, but are not needed in ${SRCS}.
1300
1301DPADD		Additional dependencies for the program.  Usually used for
1302		libraries.  For example, to depend on the compatibility and
1303		utility libraries use:
1304
1305			DPADD+=${LIBCOMPAT} ${LIBUTIL}
1306
1307		The following system libraries are predefined for DPADD:
1308
1309		LIBARCHIVE?=		${DESTDIR}/usr/lib/libarchive.a
1310		LIBASN1?=		${DESTDIR}/usr/lib/libasn1.a
1311		LIBATF_C?=		${DESTDIR}/usr/lib/libatf-c.a
1312		LIBATF_CXX?=		${DESTDIR}/usr/lib/libatf-c++.a
1313		LIBBIND9?=		${DESTDIR}/usr/lib/libbind9.a
1314		LIBBLOCKLIST?=		${DESTDIR}/usr/lib/libblocklist.a
1315		LIBBLUETOOTH?=		${DESTDIR}/usr/lib/libbluetooth.a
1316		LIBBSDMALLOC?=		${DESTDIR}/usr/lib/libbsdmalloc.a
1317		LIBBZ2?=		${DESTDIR}/usr/lib/libbz2.a
1318		LIBC?=			${DESTDIR}/usr/lib/libc.a
1319		LIBC_PIC?=		${DESTDIR}/usr/lib/libc_pic.a
1320		LIBCBOR?=		${DESTDIR}/usr/lib/libcbor.a
1321		LIBCOMPAT?=		${DESTDIR}/usr/lib/libcompat.a
1322		LIBCOM_ERR?=		${DESTDIR}/usr/lib/libcom_err.a
1323		LIBCRYPT?=		${DESTDIR}/usr/lib/libcrypt.a
1324		LIBCRYPTO?=		${DESTDIR}/usr/lib/libcrypto.a
1325		LIBCURSES?=		${DESTDIR}/usr/lib/libcurses.a
1326		LIBCXX?=		${DESTDIR}/usr/lib/libc++.a
1327		LIBDES?=		${DESTDIR}/usr/lib/libdes.a
1328		LIBDNS?=		${DESTDIR}/usr/lib/libdns.a
1329		LIBEDIT?=		${DESTDIR}/usr/lib/libedit.a
1330		LIBEVENT?=		${DESTDIR}/usr/lib/libevent.a
1331		LIBEVENT_OPENSSL?=	${DESTDIR}/usr/lib/libevent_openssl.a
1332		LIBEVENT_PTHREADS?=	${DESTDIR}/usr/lib/libevent_pthreads.a
1333		LIBEXECINFO?=		${DESTDIR}/usr/lib/libexecinfo.a
1334		LIBEXPAT?=		${DESTDIR}/usr/lib/libexpat.a
1335		LIBFETCH?=		${DESTDIR}/usr/lib/libfetch.a
1336		LIBFIDO2?=		${DESTDIR}/usr/lib/libfido2.a
1337		LIBFL?=			${DESTDIR}/usr/lib/libfl.a
1338		LIBFORM?=		${DESTDIR}/usr/lib/libform.a
1339		LIBGCC?=		${DESTDIR}/usr/lib/libgcc.a
1340		LIBGNUCTF?=		${DESTDIR}/usr/lib/libgnuctf.a
1341		LIBGNUMALLOC?=		${DESTDIR}/usr/lib/libgnumalloc.a
1342		LIBGSSAPI?=		${DESTDIR}/usr/lib/libgssapi.a
1343		LIBHDB?=		${DESTDIR}/usr/lib/libhdb.a
1344		LIBHEIMBASE?=		${DESTDIR}/usr/lib/libheimbase.a
1345		LIBHEIMNTLM?=		${DESTDIR}/usr/lib/libheimntlm.a
1346		LIBHX500?=		${DESTDIR}/usr/lib/libhx500.a
1347		LIBINTL?=		${DESTDIR}/usr/lib/libintl.a
1348		LIBIPSEC?=		${DESTDIR}/usr/lib/libipsec.a
1349		LIBISC?=		${DESTDIR}/usr/lib/libisc.a
1350		LIBISCCC?=		${DESTDIR}/usr/lib/libisccc.a
1351		LIBISCFG?=		${DESTDIR}/usr/lib/libiscfg.a
1352		LIBKADM5CLNT?=		${DESTDIR}/usr/lib/libkadm5clnt.a
1353		LIBKADM5SRV?=		${DESTDIR}/usr/lib/libkadm5srv.a
1354		LIBKAFS?=		${DESTDIR}/usr/lib/libkafs.a
1355		LIBKRB5?=		${DESTDIR}/usr/lib/libkrb5.a
1356		LIBKVM?=		${DESTDIR}/usr/lib/libkvm.a
1357		LIBL?=			${DESTDIR}/usr/lib/libl.a
1358		LIBLBER?=		${DESTDIR}/usr/lib/liblber.a
1359		LIBLDAP?=		${DESTDIR}/usr/lib/libldap.a
1360		LIBLDAP_R?=		${DESTDIR}/usr/lib/libldap_r.a
1361		LIBLUA?=		${DESTDIR}/usr/lib/liblua.a
1362		LIBM?=			${DESTDIR}/usr/lib/libm.a
1363		LIBMAGIC?=		${DESTDIR}/usr/lib/libmagic.a
1364		LIBMENU?=		${DESTDIR}/usr/lib/libmenu.a
1365		LIBNETPGPVERIFY?=	${DESTDIR}/usr/lib/libnetpgpverify.a
1366		LIBNS?=			${DESTDIR}/usr/lib/libns.a
1367		LIBOBJC?=		${DESTDIR}/usr/lib/libobjc.a
1368		LIBOSSAUDIO?=		${DESTDIR}/usr/lib/libossaudio.a
1369		LIBPAM?=		${DESTDIR}/usr/lib/libpam.a
1370		LIBPANEL?=		${DESTDIR}/usr/lib/libpanel.a
1371		LIBPCAP?=		${DESTDIR}/usr/lib/libpcap.a
1372		LIBPCI?=		${DESTDIR}/usr/lib/libpci.a
1373		LIBPOSIX?=		${DESTDIR}/usr/lib/libposix.a
1374		LIBPTHREAD?=		${DESTDIR}/usr/lib/libpthread.a
1375		LIBPUFFS?=		${DESTDIR}/usr/lib/libpuffs.a
1376		LIBQUOTA?=		${DESTDIR}/usr/lib/libquota.a
1377		LIBRADIUS?=		${DESTDIR}/usr/lib/libradius.a
1378		LIBREFUSE?=		${DESTDIR}/usr/lib/librefuse.a
1379		LIBRESOLV?=		${DESTDIR}/usr/lib/libresolv.a
1380		LIBRMT?=		${DESTDIR}/usr/lib/librmt.a
1381		LIBROKEN?=		${DESTDIR}/usr/lib/libroken.a
1382		LIBRPCSVC?=		${DESTDIR}/usr/lib/librpcsvc.a
1383		LIBRT?=			${DESTDIR}/usr/lib/librt.a
1384		LIBRUMP?=		${DESTDIR}/usr/lib/librump.a
1385		LIBRUMPFS_CD9660?=	${DESTDIR}/usr/lib/librumpfs_cd9660.a
1386		LIBRUMPFS_EFS?=		${DESTDIR}/usr/lib/librumpfs_efs.a
1387		LIBRUMPFS_EXT2FS?=	${DESTDIR}/usr/lib/librumpfs_ext2fs.a
1388		LIBRUMPFS_FFS?=		${DESTDIR}/usr/lib/librumpfs_ffs.a
1389		LIBRUMPFS_HFS?=		${DESTDIR}/usr/lib/librumpfs_hfs.a
1390		LIBRUMPFS_LFS?=		${DESTDIR}/usr/lib/librumpfs_lfs.a
1391		LIBRUMPFS_MSDOS?=	${DESTDIR}/usr/lib/librumpfs_msdos.a
1392		LIBRUMPFS_NFS?=		${DESTDIR}/usr/lib/librumpfs_nfs.a
1393		LIBRUMPFS_NTFS?=	${DESTDIR}/usr/lib/librumpfs_ntfs.a
1394		LIBRUMPFS_SYSPUFFS?=	${DESTDIR}/usr/lib/librumpfs_syspuffs.a
1395		LIBRUMPFS_TMPFS?=	${DESTDIR}/usr/lib/librumpfs_tmpfs.a
1396		LIBRUMPFS_UDF?=		${DESTDIR}/usr/lib/librumpfs_udf.a
1397		LIBRUMPUSER?=		${DESTDIR}/usr/lib/librumpuser.a
1398		LIBSASLC?=		${DESTDIR}/usr/lib/libsaslc.a
1399		LIBSKEY?=		${DESTDIR}/usr/lib/libskey.a
1400		LIBSL?=			${DESTDIR}/usr/lib/libsl.a
1401		LIBSQLITE3?=		${DESTDIR}/usr/lib/libsqlite3.a
1402		LIBSSH?=		${DESTDIR}/usr/lib/libssh.a
1403		LIBSSL?=		${DESTDIR}/usr/lib/libssl.a
1404		LIBSTDCXX?=		${DESTDIR}/usr/lib/libstdc++.a
1405		LIBSUPCXX?=		${DESTDIR}/usr/lib/libsupc++.a
1406		LIBTERMINFO?=		${DESTDIR}/usr/lib/libterminfo.a
1407		LIBTRE?=		${DESTDIR}/usr/lib/libtre.a
1408		LIBUNBOUND?=		${DESTDIR}/usr/lib/libunbound.a
1409		LIBUSBHID?=		${DESTDIR}/usr/lib/libusbhid.a
1410		LIBUTIL?=		${DESTDIR}/usr/lib/libutil.a
1411		LIBWIND?=		${DESTDIR}/usr/lib/libwind.a
1412		LIBWRAP?=		${DESTDIR}/usr/lib/libwrap.a
1413		LIBY?=			${DESTDIR}/usr/lib/liby.a
1414		LIBZ?=			${DESTDIR}/usr/lib/libz.a
1415
1416		The following c startup files.
1417
1418		LIBCRT0?=		${DESTDIR}/usr/lib/crt0.o
1419		LIBCRTI?=		${DESTDIR}/usr/lib/crti.o
1420		LIBCRTBEGIN?=		${DESTDIR}/usr/lib/crti.o
1421		LIBCRTEND?=		${DESTDIR}/usr/lib/crtn.o
1422
1423		The following X-Windows libraries are predefined for DPADD:
1424
1425		LIBDPS?=		${DESTDIR}/usr/X11R7/lib/libdps.a
1426		LIBEGL?=		${DESTDIR}/usr/X11R7/lib/libEGL.a
1427		LIBFNTSTUBS?=		${DESTDIR}/usr/X11R7/lib/libfntstubs.a
1428		LIBFONTCACHE?=		${DESTDIR}/usr/X11R7/lib/libfontcache.a
1429		LIBFONTCONFIG?=		${DESTDIR}/usr/X11R7/lib/libfontconfig.a
1430		LIBFONTENC?=		${DESTDIR}/usr/X11R7/lib/libfontenc.a
1431		LIBFREETYPE?=		${DESTDIR}/usr/X11R7/lib/libfreetype.a
1432		LIBFS?=			${DESTDIR}/usr/X11R7/lib/libFS.a
1433		LIBGL?=			${DESTDIR}/usr/X11R7/lib/libGL.a
1434		LIBGLU?=		${DESTDIR}/usr/X11R7/lib/libGLU.a
1435		LIBGLW?=		${DESTDIR}/usr/X11R7/lib/libGLw.a
1436		LIBI810XVMC		4{DESTDIR}/usr/X11R7/lib/libI810XvMC.a
1437		LIBICE?=		${DESTDIR}/usr/X11R7/lib/libICE.a
1438		LIBINTELXVMC		${DESTDIR}/usr/X11R7/lib/libIntelXvMC.a
1439		LIBLBXUTIL?=		${DESTDIR}/usr/X11R7/lib/liblbxutil.a
1440		LIBSM?=			${DESTDIR}/usr/X11R7/lib/libSM.a
1441		LIBX11_XCB?=		${DESTDIR}/usr/X11R7/lib/libX11-xcb.a
1442		LIBX11?=		${DESTDIR}/usr/X11R7/lib/libX11.a
1443		LIBXRES?=		${DESTDIR}/usr/X11R7/lib/libXres.a
1444		LIBXAU?=		${DESTDIR}/usr/X11R7/lib/libXau.a
1445		LIBXAU7?=		${DESTDIR}/usr/X11R7/lib/libXau7.a
1446		LIBXAW?=		${DESTDIR}/usr/X11R7/lib/libXaw.a
1447		LIBXCB?=		${DESTDIR}/usr/X11R7/lib/libxcb.a
1448		LIBXCOMPOSITE?=		${DESTDIR}/usr/X11R7/lib/libXcomposite.a
1449		LIBXCURSOR?=		${DESTDIR}/usr/X11R7/lib/libXcursor.a
1450		LIBXCVT?=		${DESTDIR}/usr/X11R7/lib/libxcvt.a
1451		LIBXDAMAGE?=		${DESTDIR}/usr/X11R7/lib/libXdamage.a
1452		LIBXDMCP?=		${DESTDIR}/usr/X11R7/lib/libXdmcp.a
1453		LIBXEXT?=		${DESTDIR}/usr/X11R7/lib/libXext.a
1454		LIBXFIXES?=		${DESTDIR}/usr/X11R7/lib/libXfixes.a
1455		LIBXFONT2?=		${DESTDIR}/usr/X11R7/lib/libXfont2.a
1456		LIBXFONT?=		${DESTDIR}/usr/X11R7/lib/libXfont.a
1457		LIBXFT?=		${DESTDIR}/usr/X11R7/lib/libXft.a
1458		LIBXI?=			${DESTDIR}/usr/X11R7/lib/libXi.a
1459		LIBXINERAMA?=		${DESTDIR}/usr/X11R7/lib/libXinerama.a
1460		LIBXKBFILE?=		${DESTDIR}/usr/X11R7/lib/libxkbfile.a
1461		LIBXMU?=		${DESTDIR}/usr/X11R7/lib/libXmu.a
1462		LIBXMUU?=		${DESTDIR}/usr/X11R7/lib/libXmuu.a
1463		LIBXPM?=		${DESTDIR}/usr/X11R7/lib/libXpm.a
1464		LIBXRANDR?=		${DESTDIR}/usr/X11R7/lib/libXrandr.a
1465		LIBXRENDER?=		${DESTDIR}/usr/X11R7/lib/libXrender.a
1466		LIBXSS?=		${DESTDIR}/usr/X11R7/lib/libXss.a
1467		LIBXT?=			${DESTDIR}/usr/X11R7/lib/libXt.a
1468		LIBXTRAP?=		${DESTDIR}/usr/X11R7/lib/libXTrap.a
1469		LIBXTST?=		${DESTDIR}/usr/X11R7/lib/libXtst.a
1470		LIBXV?=			${DESTDIR}/usr/X11R7/lib/libXv.a
1471		LIBXXF86DGA?=		${DESTDIR}/usr/X11R7/lib/libXxf86dga.a
1472		LIBXXF86MISC?=		${DESTDIR}/usr/X11R7/lib/libXxf86misc.a
1473		LIBXXF86VM?=		${DESTDIR}/usr/X11R7/lib/libXxf86vm.a
1474
1475STRIPFLAG	The option passed to the install program to cause the binary
1476		to be stripped.
1477
1478SUBDIR		A list of subdirectories that should be built as well.
1479		Each of the targets will execute the same target in the
1480		subdirectories.
1481
1482SCRIPTS		A list of interpreter scripts [file.{sh,csh,pl,awk,...}].
1483		These are installed exactly like programs.
1484
1485SCRIPTSDIR	The location to install the scripts.  Each script can be
1486		installed to a separate path by setting SCRIPTSDIR_<script>.
1487
1488SCRIPTSNAME	The name that the above program will be installed as, if
1489		different from ${SCRIPTS}. These can be further specialized
1490		by setting SCRIPTSNAME_<script>.
1491
1492FILES		See description of <bsd.files.mk>.
1493
1494SHLINKDIR	Target directory for shared linker.  See description of
1495		<bsd.own.mk> for additional information about this variable.
1496
1497The include file <bsd.prog.mk> includes the file named "../Makefile.inc"
1498if it exists, as well as the include file <bsd.man.mk>.
1499
1500Some simple examples:
1501
1502To build foo from foo.c with a manual page foo.1, use:
1503
1504	PROG=	foo
1505
1506	.include <bsd.prog.mk>
1507
1508To build foo from foo.c with a manual page foo.2, add the line:
1509
1510	MAN=	foo.2
1511
1512If foo does not have a manual page at all, add the line
1513before any make(1) .include directives:
1514
1515	NOMAN=
1516
1517If foo has multiple source files, add the line:
1518
1519	SRCS=	a.c b.c c.c d.c
1520
1521
1522=-=-=-=-=   bsd.rpc.mk   =-=-=-=-=
1523
1524The include file <bsd.rpc.mk> contains a makefile fragment used to
1525construct source files built by rpcgen.
1526
1527The following macros may be defined in makefiles which include
1528<bsd.rpc.mk> in order to control which files get built and how they
1529are to be built:
1530
1531RPC_INCS	construct .h file from .x file
1532RPC_XDRFILES	construct _xdr.c from .x file
1533		(for marshalling/unmarshalling data types)
1534RPC_SVCFILES	construct _svc.c from .x file
1535		(server-side stubs)
1536RPC_SVCFLAGS	Additional options passed to builds of RPC_SVCFILES.
1537
1538RPC_XDIR	Directory containing .x/.h files
1539
1540
1541=-=-=-=-=   bsd.shlib.mk   =-=-=-=-=
1542
1543The include file <bsd.shlib.mk> computes parameters for shared library
1544installation and use.  It defines no targets.  <bsd.own.mk> MUST be
1545included before <bsd.shlib.mk>.
1546
1547<bsd.own.mk> sets the following variables, if they are not already defined
1548(defaults are in brackets):
1549
1550SHLIBINSTALLDIR If ${USE_SHLIBDIR} is not "no", use ${SHLIBINSTALLDIR}
1551		instead of ${LIBDIR} as the base path for shared library
1552		installation.  [/lib]
1553
1554SHLIBDIR	The path to USE_SHLIBDIR shared libraries to use when building
1555		a program.  [/lib for programs in /bin and /sbin, /usr/lib
1556		for all others.]
1557
1558_LIBSODIR	Set to ${SHLIBINSTALLDIR} if ${USE_SHLIBDIR} is not "no",
1559		otherwise set to ${LIBDIR}
1560
1561SHLINKINSTALLDIR Base path for shared linker.  [/libexec]
1562
1563SHLINKDIR	Path to use for shared linker when building a program.
1564		[/libexec for programs in /bin and /sbin, /usr/libexec for
1565		all others.]
1566
1567
1568=-=-=-=-=   bsd.subdir.mk   =-=-=-=-=
1569
1570The include file <bsd.subdir.mk> contains the default targets for building
1571subdirectories.  It has the same eight targets as <bsd.prog.mk>: all,
1572clean, cleandir, depend, includes, install, lint, and tags.  It uses the
1573following variables:
1574
1575NOSUBDIR	If this variable is defined, then the SUBDIR variable
1576		will be ignored and subdirectories will not be processed.
1577
1578SUBDIR		For all of the directories listed in ${SUBDIR}, the
1579		specified directory will be visited and the target made.
1580
1581		As a special case, the use of a token .WAIT as an
1582		entry in SUBDIR acts as a synchronization barrier
1583		when multiple make jobs are run; subdirs before the
1584		.WAIT must complete before any subdirs after .WAIT are
1585		started.  See make(1) for some caveats on use of .WAIT
1586		and other special sources.
1587
1588
1589=-=-=-=-=   bsd.x11.mk   =-=-=-=-=
1590
1591The include file <bsd.x11.mk> contains parameters and targets for
1592cross-building X11 from ${X11SRCDIR.<package>}.  It should be included
1593after the general Makefile contents but before the include files such as
1594<bsd.prog.mk> and <bsd.lib.mk>.
1595
1596It provides the following targets:
1597	.man.1 .man.3 .man.4 .man.5 .man.7:
1598		If ${MAN} or ${PROG} is set and ${MKMAN} != "no",
1599		these rules convert from X11's manual page source
1600		into an mdoc.old source file.
1601
1602It sets the following variables:
1603
1604BINDIR			Set to ${X11BINDIR}.
1605			To override, define after including <bsd.x11.mk>
1606
1607LIBDIR			Set to ${X11USRLIBDIR}.
1608			To override, define after including <bsd.x11.mk>
1609
1610MANDIR			Set to ${X11MANDIR}.
1611			To override, define after including <bsd.x11.mk>
1612
1613CPPFLAGS		Appended with definitions to include from
1614			${DESTDIR}${X11INCDIR}
1615
1616LDFLAGS			Appended with definitions to link from
1617			${DESTDIR}${X11USRLIBDIR}
1618
1619X11FLAGS.CONNECTION	Equivalent to X11's CONNECTION_FLAGS.
1620
1621X11FLAGS.EXTENSION	Equivalent to X11's EXT_DEFINES.
1622
1623X11FLAGS.LOADABLE	Equivalent to X11's LOADABLE.
1624
1625X11FLAGS.OS_DEFINES	Equivalent to X11's OS_DEFINES.
1626
1627X11FLAGS.SERVER		Equivalent to X11's ServerDefines.
1628
1629X11FLAGS.THREADLIB	Equivalent to X11's THREADS_DEFINES for libraries.
1630
1631X11FLAGS.THREADS	Equivalent to X11's THREADS_DEFINES.
1632
1633X11FLAGS.VERSION	cpp(1) definitions of OSMAJORVERSION and OSMINORVERSION.
1634
1635X11FLAGS.DIX		Equivalent to X11's DIX_DEFINES.
1636
1637X11TOOL_UNXCOMM		Commandline to convert `XCOMM' comments to `#'
1638
1639It uses the following variables:
1640
1641APPDEFS			List of app-default files to install.
1642
1643CPPSCRIPTS		List of files/scripts to run through cpp(1)
1644			and then ${X11TOOL_UNXCOMM}.  The source files
1645			have a `.cpp' suffix, the generated files do not.
1646
1647CPPSCRIPTFLAGS		Additional options to cpp(1) when building CPPSCRIPTS.
1648
1649CPPSCRIPTFLAGS_<fn>	Additional options to cpp(1) when building CPPSCRIPT <fn>.
1650
1651
1652=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1653
1654The following files are described here for completion, but they are not
1655supposed to be included directly from other Makefiles; they are used
1656internally by other system files.
1657
1658=-=-=-=-=   bsd.sys.mk   =-=-=-=-=
1659
1660The include file <bsd.sys.mk> is used by other system mk files and
1661it is not intended to be included standalone. It contains rules and
1662system build variables. It requires bsd.own.mk to be included first.
1663It contains overrides that are used when building the NetBSD source tree.
1664
1665The following variables control how various files are compiled/built.
1666(Note that these may be overridden in <bsd.own.mk> if USETOOLS == "yes"):
1667
1668AR		Create, modify, and extract from archives.  [ar]
1669
1670ARFLAGS		Options to ${AR}.  [rl]
1671
1672ARM_ELF2AOUT	Convert ELF-format executable to a.out.  [elf2aout]
1673
1674AS		Assembler.  [as]
1675
1676AFLAGS		Options to ${CC} when compiling or linking .s or .S
1677		assembly source files.  []
1678
1679BUILDSEED	g++(1) uses random numbers when compiling C++ code.  This
1680		variable seeds the g++(1) random number generator using
1681		-frandom-seed with this value.  By default, it is set to
1682		"NetBSD-(majorversion)".  Using a fixed value causes C++
1683		binaries to be the same when built from the same sources,
1684		resulting in identical (reproducible) builds.  Additional
1685		information is available in the g++(1) documentation of
1686		-frandom-seed.
1687
1688		Default: Unset.
1689
1690CC		C compiler.  [cc]
1691
1692CFLAGS		Options to ${CC}.  [Usually -O or -O2]
1693		Note: CFLAGS should never be set in mk.conf(5).
1694
1695CPP		C Pre-Processor.  [cpp]
1696
1697CPPFLAGS	Options to ${CPP}.  []
1698
1699CPUFLAGS	Optimization options for ${CC}.  []
1700
1701CXX		C++ compiler.  [c++]
1702
1703CXXFLAGS	Options to ${CXX}.  [${CFLAGS}]
1704
1705M68K_ELF2AOUT	Convert ELF-format executable to a.out.  [elf2aout]
1706
1707MIPS_ELF2ECOFF	Convert ELF-format executable to ECOFF.  [elf2ecoff]
1708
1709FC		Fortran compiler.  [f77]
1710
1711FFLAGS		Options to {$FC}.  [-O]
1712
1713HOST_SH		Shell.  This must be an absolute path, because it may be
1714		substituted into "#!" lines in scripts.  [/bin/sh]
1715
1716INSTALL		install(1) command.  [install]
1717
1718LEX		Lexical analyzer.  [lex]
1719
1720LFLAGS		Options to ${LEX}.  []
1721
1722LPREFIX		Symbol prefix for ${LEX} (see -P option in lex(1)) [yy]
1723
1724LD		Linker.  [ld]
1725
1726LDFLAGS		Options to ${CC} during the link process.  []
1727
1728LINT		C program verifier.  [lint]
1729
1730LINTFLAGS	Options to ${LINT}.  [-chapbrxzgFS]
1731
1732LORDER		List dependencies for object files.  [lorder]
1733
1734MAKE		make(1).  [make]
1735
1736MKDEP		Construct Makefile dependency list.  [mkdep]
1737
1738MKDEPCXX	Construct Makefile dependency list for C++ files.  [mkdep]
1739
1740NM		List symbols from object files.  [nm]
1741
1742PC		Pascal compiler.  [pc]	(Not present)
1743
1744PFLAGS		Options to ${PC}.  []
1745
1746OBJC		Objective C compiler.  [${CC}]
1747
1748OBJCFLAGS	Options to ${OBJC}.  [${CFLAGS}]
1749
1750OBJCOPY		Copy and translate object files.  [objcopy]
1751
1752OBJCOPYLIBFLAGS Options to pass to objcopy when library objects are
1753		being built. [${.TARGET} =~ "*.po" ? -X : -x]
1754
1755OBJDUMP		Display information from object files.  [objdump]
1756
1757RANLIB		Generate index to archive.  [ranlib]
1758
1759READELF		Display information from ELF object files.  [readelf]
1760
1761SIZE		List section sizes and total size.  [size]
1762
1763STRINGS		Display printable character sequences in files.  [strings]
1764
1765STRIP		Discard symbols from object files.  [strip]
1766
1767TSORT		Topological sort of a directed graph.  [tsort -q]
1768
1769YACC		LALR(1) parser generator.  [yacc]
1770
1771YFLAGS		Options to ${YACC}.  []
1772
1773YHEADER		If defined, add "-d" to YFLAGS, and add dependencies
1774		from <file>.y to <file>.h and <file>.c, and add
1775		<foo>.h to CLEANFILES.
1776
1777YPREFIX		If defined, add "-p ${YPREFIX}" to YFLAGS.
1778
1779
1780Other variables of note (incomplete list):
1781
1782NOCLANGERROR	If defined and clang is used as C compiler, -Werror is not
1783		passed to it.
1784
1785NOGCCERROR	If defined, prevents passing certain ${CFLAGS} to GCC
1786		that cause warnings to be fatal, such as:
1787			-Werror -Wa,--fatal-warnings
1788		(The latter being for as(1).)
1789
1790WARNS		Crank up compiler warning options; the distinct levels are:
1791			WARNS=1
1792			WARNS=2
1793			WARNS=3
1794			WARNS=4
1795			WARNS=5
1796			WARNS=6
1797
1798=-=-=-=-=   bsd.host.mk   =-=-=-=-=
1799
1800This file is automatically included from bsd.own.mk. It contains settings
1801for all the HOST_* variables that are used in host programs and libraries.
1802
1803HOST_AR			The host archive processing command
1804
1805HOST_CC			The host c compiler
1806
1807HOST_CFLAGS		The host c compiler options
1808
1809HOST_COMPILE.c		The host c compiler line with options
1810
1811HOST_COMPILE.cc		The host c++ compiler line with options
1812
1813HOST_CPP		The host c pre-processor
1814
1815HOST_CPPFLAGS		The host c pre-processor options
1816
1817HOST_CXX		The host c++ compiler
1818
1819HOST_CXXFLAGS		The host c++ compiler options
1820
1821HOST_INSTALL_DIR	The host command to install a directory
1822
1823HOST_INSTALL_FILE	The host command to install a file
1824
1825HOST_INSTALL_SYMLINK	The host command to install a symlink
1826
1827HOST_LD			The host linker command
1828
1829HOST_LDFLAGS		The host linker options
1830
1831HOST_LINK.c		The host c linker line with options
1832
1833HOST_LINK.cc		The host c++ linker line with options
1834
1835HOST_LN			The host command to link two files
1836
1837HOST_MKDEP		The host command to create dependencies for c programs
1838
1839HOST_MKDEPCXX		The host command to create dependencies for c++ programs
1840
1841HOST_OSTYPE		The host OSNAME-RELEASE-ARCH tupple
1842
1843HOST_RANLIB		The host command to create random access archives
1844
1845HOST_SH			The host Bourne shell interpreter name (absolute path)
1846
1847=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1848