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