bsd.README revision 1.401
1#	$NetBSD: bsd.README,v 1.401 2020/04/04 23:54:06 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
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
852KERNEL_DIR	Install the kernel as /netbsd/kernel and the modules
853		in /netbsd/modules, defaults to "no".
854
855TOOLCHAIN_MISSING
856		If not "no", this indicates that the platform being built
857		does not have a working in-tree toolchain.  If the
858		${MACHINE_ARCH} in question falls into this category,
859		TOOLCHAIN_MISSING is conditionally assigned the value "yes".
860		Otherwise, the variable is unconditionally assigned the
861		value "no".
862		If not "no", ${MKBINUTILS}, ${MKGCC}, and ${MKGDB} are
863		unconditionally assigned the value "no".
864
865EXTERNAL_TOOLCHAIN
866		This variable is not directly set by <bsd.own.mk>, but
867		including <bsd.own.mk> is the canonical way to gain
868		access to this variable.  The variable should be defined
869		either in the user's environment or in the user's mk.conf
870		file.  If defined, this variable indicates the root of
871		an external toolchain which will be used to build the
872		tree.  For example, if a platform is a ${TOOLCHAIN_MISSING}
873		platform, EXTERNAL_TOOLCHAIN can be used to re-enable the
874		cross-compile framework.
875
876		If EXTERNAL_TOOLCHAIN is defined, ${MKGCC} is unconditionally
877		assigned the value "no", since the external version of the
878		compiler may not be able to build the library components of
879		the in-tree compiler.
880
881		This variable should be used in conjunction with an appropiate
882		HAVE_GCC or HAVE_LLVM setting to control the compiler flags.
883
884		NOTE: This variable is not yet used in as many places as
885		it should be.  Expect the exact semantics of this variable
886		to change in the short term as parts of the cross-compile
887		framework continue to be cleaned up.
888
889The following variables are defined to commands to perform the
890appropriate operation, with the default in [brackets].  Note that
891the defaults change if USETOOLS == "yes":
892
893TOOL_AMIGAAOUT2BB	aout to Amiga bootblock converter.  [amiga-aout2bb]
894
895TOOL_AMIGAELF2BB	ELF to Amiga bootblock converter.  [amiga-elf2bb]
896
897TOOL_AMIGATXLT		Amiga assembly language format translator.  [amiga-txlt]
898
899TOOL_ARMELF2AOUT	ELF to a.out executable converter [arm-elf2aout}
900
901TOOL_ASN1_COMPILE	ASN1 compiler.  [asn1_compile]
902
903TOOL_AWK		Pattern-directed scanning/processing language.  [awk]
904
905TOOL_CAP_MKDB		Create capability database.  [cap_mkdb]
906
907TOOL_CAT		Concatenate and print files.  [cat]
908
909TOOL_CKSUM		Display file checksums.  [cksum]
910
911TOOL_COMPILE_ET		Error table compiler.  [compile_et]
912
913TOOL_CONFIG		Build kernel compilation directories.  [config]
914
915TOOL_CRUNCHGEN		Generate crunched binary build environment.  [crunchgen]
916
917TOOL_CTAGS		Create a tags file.  [ctags]
918
919TOOL_DB			Manipulate db(3) databases.  [db]
920
921TOOL_DISKLABEL		Read and write disk pack label.  [disklabel]
922
923TOOL_EQN		Format equations for groff.  [eqn]
924
925TOOL_FDISK		MS-DOS partition maintenance program.  [fdisk]
926
927TOOL_FGEN		IEEE 1275 Open Firmware FCode Tokenizer.  [fgen]
928
929TOOL_GENASSYM		Generate constants for assembly files.  [genassym]
930
931TOOL_GENCAT		Generate NLS message catalogs.  [gencat]
932
933TOOL_GMAKE		GNU make utility.  [gmake]
934
935TOOL_GREP		Print lines matching a pattern.  [grep]
936
937TOOL_GROFF		Front end for groff document formatting system.  [groff]
938
939TOOL_GZIP		Compression/decompression tool.  [gzip]
940
941TOOL_GZIP_N		Same as TOOL_GZIP, plus a command line option to
942			prevent it from inserting file names or timestamps
943			into the compressed output.
944			[${TOOL_GZIP} ${GZIP_N_FLAG}]
945
946TOOL_HEXDUMP		Ascii, decimal, hexadecimal, octal dump.  [hexdump]
947
948TOOL_HP300MKBOOT	Make bootable image for hp300.  [hp300-mkboot]
949
950TOOL_HPPAMKBOOT		Make bootable image for hppa.  [hppa-mkboot]
951
952TOOL_INDXBIB		Make bibliographic database's inverted index.  [indxbib]
953
954TOOL_INSTALLBOOT	Install disk bootstrap software.  [installboot]
955
956TOOL_INSTALL_INFO	Update info/dir entries.  [install-info]
957
958TOOL_JOIN		Relational database operator.  [join]
959
960TOOL_M4			M4 macro language processor.  [m4]
961
962TOOL_M68KELF2AOUT	ELF to a.out executable converter [m68k-elf2aout}
963
964TOOL_MACPPCFIXCOFF	Fix up xcoff headers for macppc.  [macppc-fixcoff]
965
966TOOL_MAKEFS		Create file system image from directory tree.  [makefs]
967
968TOOL_MAKEINFO		Translate Texinfo documents.  [makeinfo]
969
970TOOL_MAKEWHATIS		Create a whatis.db database.  [makewhatis]
971
972TOOL_MDSETIMAGE		Set kernel RAM disk image.  [mdsetimage]
973
974TOOL_MENUC		Menu compiler.  [menuc]
975
976TOOL_MIPSELF2ECOFF	Convert ELF-format executable to ECOFF for mips.
977			[mips-elf2ecoff]
978
979TOOL_MKCSMAPPER		Make charset mapping table.  [mkcsmapper]
980
981TOOL_MKESDB		Make encoding scheme database.  [mkesdb]
982
983TOOL_MKLOCALE		Make LC_CTYPE locale files.  [mklocale]
984
985TOOL_MKMAGIC		Create database for file(1).  [file]
986
987TOOL_MKNOD		Make device special file.  [mknod]
988
989TOOL_MKTEMP		Make (unique) temporary file name.  [mktemp]
990
991TOOL_MSGC		Simple message list compiler.  [msgc]
992
993TOOL_MTREE		Map a directory hierarchy.  [mtree]
994
995TOOL_NCDCS		Turn ELF kernel into a NCD firmware image. [ncdcs]
996
997TOOL_PAX		Manipulate file archives and copy directories.  [pax]
998
999TOOL_PIC		Compile pictures for groff.  [pic]
1000
1001TOOL_PIGZ		Parallel compressor.  [pigz]
1002
1003TOOL_POWERPCMKBOOTIMAGE	Make bootable image for powerpc.  [powerpc-mkbootimage]
1004
1005TOOL_PWD_MKDB		Generate the password databases.  [pwd_mkdb]
1006
1007TOOL_REFER		Preprocess bibliographic references for groff.  [refer]
1008
1009TOOL_ROFF_ASCII		Generate ASCII groff output.  [nroff]
1010
1011TOOL_ROFF_DVI		Generate DVI groff output.  [${TOOL_GROFF} -Tdvi]
1012
1013TOOL_ROFF_HTML		Generate HTML groff output.
1014			[${TOOL_GROFF} -Tlatin1 -mdoc2html]
1015
1016TOOL_ROFF_PS		Generate PS groff output.  [${TOOL_GROFF} -Tps]
1017
1018TOOL_ROFF_RAW		Generate "raw" groff output.  [${TOOL_GROFF} -Z]
1019
1020TOOL_RPCGEN		Remote Procedure Call (RPC) protocol compiler.  [rpcgen]
1021
1022TOOL_SED		Stream editor.  [sed]
1023
1024TOOL_SOELIM		Eliminate .so's from groff input.  [soelim]
1025
1026TOOL_SPARKCRC		Generate a crc suitable for use in a sparkive file.
1027			[sparkcrc]
1028
1029TOOL_STAT		Display file status.  [stat]
1030
1031TOOL_STRFILE		Create a random access file for storing strings.
1032			[strfile]
1033
1034TOOL_SUNLABEL		Read or modify a SunOS disk label.  [sunlabel]
1035
1036TOOL_TBL		Format tables for groff.  [tbl]
1037
1038TOOL_UUDECODE		Uudecode a binary file.  [uudecode]
1039
1040TOOL_VGRIND		Grind nice listings of programs.  [vgrind -f]
1041
1042TOOL_ZIC		Time zone compiler.  [zic]
1043
1044For each possible value of MACHINE_CPU, MACHINES.${MACHINE_CPU} contain a
1045list of what ports can be built for it.  This keeps those definitions in
1046centralized place.
1047
1048<bsd.own.mk> is generally useful when building your own Makefiles so that
1049they use the same default owners etc. as the rest of the tree.
1050
1051
1052=-=-=-=-=   bsd.clean.mk   =-=-=-=-=
1053
1054The include file <bsd.clean.mk> defines the clean and cleandir
1055targets.  It uses the following variables:
1056
1057CLEANFILES	Files to remove for both the clean and cleandir targets.
1058
1059CLEANDIRFILES	Files to remove for the cleandir target, but not for
1060		the clean target.
1061
1062MKCLEANSRC	Controls whether or not the clean and cleandir targets
1063		will delete files from both the object directory,
1064		${.OBJDIR}, and the source directory, ${.CURDIR}.
1065
1066		If MKCLEANSRC is set to "no", then the file names in
1067		CLEANFILES or CLEANDIRFILES are interpreted relative
1068		to the object directory, ${.OBJDIR}.  This is the
1069		traditional behaviour.
1070
1071		If MKCLEANSRC is set to "yes", then the file deletion
1072		is performed relative to both the object directory,
1073		${.OBJDIR}, and the source directory, ${.CURDIR}.  (This
1074		has no effect if ${.OBJDIR} is the same as ${.CURDIR}.)
1075		Deleting files from ${.CURDIR} is intended to remove
1076		stray output files that had been left in the source
1077		directory by an earlier build that did not use object
1078		directories.
1079
1080		The default is MKCLEANSRC=yes.  If you always build with
1081		separate object directories, and you are sure that there
1082		are no stray files in the source directories, then you
1083		may set MKCLEANSRC=no to save some time.
1084
1085MKCLEANVERIFY	Controls whether or not the clean and cleandir targets
1086		will verify that files have been deleted.
1087
1088		If MKCLEANVERIFY is set to "no", then the files will
1089		be deleted using a "rm -f" command, and its success or
1090		failure will be ignored.
1091
1092		If MKCLEANVERIFY is set to "yes", then the success of
1093		the "rm -f" command will be verified using an "ls"
1094		command.
1095
1096		The default is MKCLEANVERIFY=yes.  If you are sure that
1097		there will be no problems caused by file permissions,
1098		read-only file systems, or the like, then you may set
1099		MKCLEANVERIFY=no to save some time.
1100
1101To use the clean and cleandir targets defined in <bsd.clean.mk>, other
1102Makefiles or bsd.*.mk files should append file names to the CLEANFILES
1103or CLEANDIRFILES variables.  For example:
1104
1105	    CLEANFILES+= a.out
1106	    CLEANDIRFILES+= .depend
1107
1108	    .include <bsd.clean.mk>
1109
1110The files listed in CLEANFILES and CLEANDIRFILES must not be
1111directories, because the potential risk from running "rm -rf" commands
1112in bsd.clean.mk is considered too great.  If you want to recursively
1113delete a directory as part of "make clean" or "make cleandir" then you
1114need to provide your own target.
1115
1116=-=-=-=-=   bsd.dep.mk   =-=-=-=-=
1117
1118The include file <bsd.dep.mk> contains the default targets for building
1119.depend files.  It creates .d files from entries in SRCS and DPSRCS
1120that are C, C++, or Objective C source files, and builds .depend from the
1121.d files.  All other files in SRCS and all of DPSRCS will be used as
1122dependencies for the .d files.  In order for this to function correctly,
1123it should be .included after all other .mk files and directives that may
1124modify SRCS or DPSRCS.  It uses the following variables:
1125
1126SRCS		List of source files to build the program.
1127
1128DPSRCS		List of source files which are needed for generating
1129		dependencies, but are not needed in ${SRCS}.
1130
1131
1132=-=-=-=-=   bsd.files.mk   =-=-=-=-=
1133
1134The include file <bsd.files.mk> handles the FILES variables and is included
1135from <bsd.lib.mk> and <bsd.prog.mk>, and uses the following variables:
1136
1137FILES		The list of files to install.
1138
1139CONFIGFILES	Similar semantics to FILES, except that the files
1140		are installed by the `configinstall' target,
1141		not the `install' target.
1142		The FILES* variables documented below also apply.
1143
1144FILESOWN	File owner.  [${BINOWN}]
1145
1146FILESGRP	File group.  [${BINGRP}]
1147
1148FILESMODE	File mode.  [${NONBINMODE}]
1149
1150FILESDIR	The location to install the files.
1151
1152FILESNAME	Optional name to install each file as.
1153
1154FILESOWN_<fn>	File owner of the specific file <fn>.
1155
1156FILESGRP_<fn>	File group of the specific file <fn>.
1157
1158FILESMODE_<fn>	File mode of the specific file <fn>.
1159
1160FILESDIR_<fn>	The location to install the specific file <fn>.
1161
1162FILESNAME_<fn>	Optional name to install <fn> as.
1163
1164FILESBUILD	If this variable is defined, then its value will be
1165		used as the default for all FILESBUILD_<fn> variables.
1166		Otherwise, the default will be "no".
1167
1168FILESBUILD_<fn>	A value different from "no" will add the file to the list of
1169		targets to be built by `realall'.  Users of that variable
1170		should provide a target to build the file.
1171
1172
1173BUILDSYMLINKS	List of two word items:
1174			lnsrc lntgt
1175		For each lnsrc item, create a symlink named lntgt.
1176		The lntgt symlinks are removed by the cleandir target.
1177
1178UUDECODE_FILES	List of files which are stored as <file>.uue in the source
1179		tree. Each one will be decoded with ${TOOL_UUDECODE}.
1180		The source files have a `.uue' suffix, the generated files do
1181		not.
1182
1183UUDECODE_FILES_RENAME_<fn>
1184		Rename the output from the decode to the provided name.
1185
1186		*NOTE: These files are simply decoded, with no install or other
1187		       rule applying implicitly except being added to the clean
1188		       target.
1189
1190=-=-=-=-=   bsd.gcc.mk   =-=-=-=-=
1191
1192The include file <bsd.gcc.mk> computes various parameters related to GCC
1193support libraries.  It defines no targets.  <bsd.own.mk> MUST be included
1194before <bsd.gcc.mk>.
1195
1196The primary users of <bsd.gcc.mk> are <bsd.prog.mk> and <bsd.lib.mk>, each
1197of which need to know where to find certain GCC support libraries.
1198
1199The behavior of <bsd.gcc.mk> is influenced by the EXTERNAL_TOOLCHAIN variable,
1200which is generally set by the user.  If EXTERNAL_TOOLCHAIN it set, then
1201the compiler is asked where to find the support libraries, otherwise the
1202support libraries are found in ${DESTDIR}/usr/lib.
1203
1204<bsd.gcc.mk> sets the following variables:
1205
1206_GCC_CRTBEGIN	The full path name to crtbegin.o.
1207
1208_GCC_CRTBEGINS	The full path name to crtbeginS.o.
1209
1210_GCC_CRTEND	The full path name to crtend.o.
1211
1212_GCC_CRTENDS	The full path name to crtendS.o.
1213
1214_GCC_LIBGCCDIR	The directory where libgcc.a is located.
1215
1216
1217=-=-=-=-=   bsd.inc.mk   =-=-=-=-=
1218
1219The include file <bsd.inc.mk> defines the includes target and uses the
1220variables:
1221
1222INCS		The list of include files.
1223
1224INCSDIR		The location to install the include files.
1225
1226INCSNAME	Target name of the include file, if only one; same as
1227		FILESNAME, but for include files.
1228
1229INCSYMLINKS	Similar to SYMLINKS in <bsd.links.mk>, except that these
1230		are installed in the 'includes' target and not the
1231		(much later) 'install' target.
1232
1233INCSNAME_<file>	The name file <file> should be installed as, if not <file>,
1234		same as FILESNAME_<file>, but for include files.
1235
1236
1237=-=-=-=-=   bsd.info.mk   =-=-=-=-=
1238
1239The include file <bsd.info.mk> is used to generate and install GNU Info
1240documentation from respective Texinfo source files.  It defines three
1241implicit targets (.txi.info, .texi.info, and .texinfo.info), and uses the
1242following variables:
1243
1244TEXINFO		List of Texinfo source files.  Info documentation will
1245		consist of single files with the extension replaced by
1246		.info.
1247
1248INFOFLAGS	Flags to pass to makeinfo.  []
1249
1250
1251=-=-=-=-=   bsd.kernobj.mk   =-=-=-=-=
1252
1253The include file <bsd.kernobj.mk> defines variables related to the
1254location of kernel sources and object directories.
1255
1256KERNSRCDIR	Is the location of the top of the kernel src.
1257		[${_SRC_TOP_}/sys]
1258
1259KERNARCHDIR	Is the location of the machine dependent kernel sources.
1260		[arch/${MACHINE}]
1261
1262KERNCONFDIR	Is where the configuration files for kernels are found.
1263		[${KERNSRCDIR}/${KERNARCHDIR}/conf]
1264
1265KERNOBJDIR	Is the kernel build directory.  The kernel GENERIC for
1266		instance will be compiled in ${KERNOBJDIR}/GENERIC.
1267		The default value is
1268		${MAKEOBJDIRPREFIX}${KERNSRCDIR}/${KERNARCHDIR}/compile
1269		if it exists or the target 'obj' is being made.
1270		Otherwise the default is
1271		${KERNSRCDIR}/${KERNARCHDIR}/compile.
1272
1273It is important that Makefiles (such as those under src/distrib) that
1274wish to find compiled kernels use <bsd.kernobj.mk> and ${KERNOBJDIR}
1275rather than make assumptions about the location of the compiled kernel.
1276
1277
1278=-=-=-=-=   bsd.kinc.mk   =-=-=-=-=
1279
1280The include file <bsd.kinc.mk> defines the many targets (includes,
1281subdirectories, etc.), and is used by kernel makefiles to handle
1282include file installation.  It is intended to be included alone, by
1283kernel Makefiles.  It uses similar variables to <bsd.inc.mk>.
1284Please see <bsd.kinc.mk> for more details, and keep the documentation
1285in that file up to date.
1286
1287=-=-=-=-=   bsd.syscall.mk =-=-=-=-=
1288
1289The include file <bsd.syscall.mk> contains the logic to create syscall
1290files for various emulations. It includes <bsd.kinc.mk> to handle the
1291rest of the targets.
1292
1293=-=-=-=-=   bsd.lib.mk   =-=-=-=-=
1294
1295The include file <bsd.lib.mk> has support for building libraries.  It has
1296the same eight targets as <bsd.prog.mk>: all, clean, cleandir, depend,
1297includes, install, lint, and tags.  Additionally, it has a checkver target
1298which checks for installed shared object libraries whose version is greater
1299that the version of the source. It has a limited number of suffixes,
1300consistent with the current needs of the BSD tree.  <bsd.lib.mk> includes
1301<bsd.shlib.mk> to get shared library parameters.
1302
1303It sets/uses the following variables:
1304
1305LIB		The name of the library to build.
1306
1307LIBDIR		Target directory for libraries.
1308
1309MKARZERO	Normally, ar(1) sets the timestamps, uid, gid and
1310		permissions in files inside its archives to those of
1311		the file it was fed. This leads to non-reproducible
1312		builds. If MKARZERO is set to "yes" (default is the
1313		same as MKREPRO, or "no" if MKREPRO is not defined),
1314		then the "D" flag is passed to ar, causing the
1315		timestamp, uid and gid to be zeroed and the file
1316		permissions to be set to 644. This allows .a files
1317		from different builds to be bit identical.
1318
1319SHLIBINSTALLDIR	Target directory for shared libraries if ${USE_SHLIBDIR}
1320		is not "no".
1321
1322SHLIB_MAJOR
1323SHLIB_MINOR
1324SHLIB_TEENY	Major, minor, and teeny version numbers of shared library
1325
1326USE_SHLIBDIR	If not "no", use ${SHLIBINSTALLDIR} instead of ${LIBDIR}
1327		as the path to install shared libraries to.
1328		USE_SHLIBDIR must be defined before <bsd.own.mk> is included.
1329		Default: no
1330
1331LIBISMODULE	If not "no", install as ${LIB}.so (without the "lib" prefix),
1332		and act as "MKDEBUGLIB=no MKLINT=no MKPICINSTALL=no
1333		MKPROFILE=no MKSTATICLIB=no".
1334		Default: no
1335
1336LIBISPRIVATE	If not "no", act as "MKDEBUGLIB=no MKLINT=no MKPIC=no
1337		MKPROFILE=no", and don't install the (.a) library.
1338		This is useful for "build only" helper libraries.
1339		Default: no
1340
1341LIBISCXX	If not "no", Use ${CXX} instead of ${CC} to link
1342		shared libraries.
1343		This is useful for C++ libraries.
1344		Default: no
1345
1346LINTLIBDIR	Target directory for lint libraries.
1347
1348LIBGRP		Library group.
1349
1350LIBOWN		Library owner.
1351
1352LIBMODE		Library mode.
1353
1354LDADD		Additional loader objects.
1355
1356MAN		The manual pages to be installed (use a .1 - .9 suffix).
1357
1358NOCHECKVER_<library>
1359NOCHECKVER	If set, disables checking for installed shared object
1360		libraries with versions greater than the source.  A
1361		particular library name, without the "lib" prefix, may
1362		be appended to the variable name to disable the check for
1363		only that library.
1364
1365SRCS		List of source files to build the library.  Suffix types
1366		.s, .c, and .f are supported.  Note, .s files are preferred
1367		to .c files of the same name.  (This is not the default for
1368		versions of make.)
1369
1370LIBDPLIBS/
1371PROGDPLIBS	A list of the tuples:
1372			libname  path-to-srcdir-of-libname
1373
1374		Instead of depending on installed versions of the libraries,
1375		one can depend on their built version in the source directory.
1376		This is useful for finding private libraries (LIBISPRIVATE).
1377
1378		For each tuple;
1379		     *	LIBDO.libname contains the .OBJDIR of the library
1380			`libname', and if it is not set it is determined
1381			from the srcdir and added to MAKEOVERRIDES (the
1382			latter is to allow for build time optimization).
1383		     *	LDADD gets  -L${LIBDO.libname} -llibname    added.
1384		     *	DPADD gets  ${LIBDO.libname}/liblibname.so  or
1385				    ${LIBDO.libname}/liblibname.a   added.
1386
1387		The special value "_external" for LIBDO.lib makes the
1388		build system to assume the library comes from outside
1389		of the NetBSD source tree and only causes -llibname
1390		to be added to LDADD.
1391
1392		This variable may be used for individual libraries/programs,
1393		as well as in parent directories to cache common libraries
1394		as a build-time optimization.
1395
1396The include file <bsd.lib.mk> includes the file named "../Makefile.inc"
1397if it exists, as well as the include file <bsd.man.mk>.
1398
1399It has rules for building profiled objects; profiled libraries are
1400built by default.
1401
1402Libraries are ranlib'd when made.
1403
1404
1405=-=-=-=-=   bsd.links.mk   =-=-=-=-=
1406
1407The include file <bsd.links.mk> handles the LINKS and SYMLINKS variables
1408and is included from from <bsd.lib.mk> and <bsd.prog.mk>.
1409
1410LINKSOWN, LINKSGRP, and LINKSMODE, are relevant only if a metadata log
1411is used. The defaults may be modified by other bsd.*.mk files which
1412include bsd.links.mk.  In the future, these variables may be replaced
1413by a method for explicitly recording hard links in a metadata log.
1414
1415LINKS		The list of hard links, consisting of pairs of paths:
1416			source-file target-file
1417		${DESTDIR} is prepended to both paths before linking.
1418		For example, to link /bin/test and /bin/[, use:
1419			LINKS=/bin/test /bin/[
1420
1421CONFIGLINKS	Similar semantics to LINKS, except that the links
1422		are installed by the `configinstall' target,
1423		not the `install' target.
1424
1425SYMLINKS	The list of symbolic links, consisting of pairs of paths:
1426			source-file target-file
1427		${DESTDIR} is only prepended to target-file before linking.
1428		For example, to symlink /usr/bin/tar to /bin/tar resulting
1429		in ${DESTDIR}/usr/bin/tar -> /bin/tar:
1430			SYMLINKS=/bin/tar /usr/bin/tar
1431
1432CONFIGSYMLINKS	Similar semantics to SYMLINKS, except that the symbolic links
1433		are installed by the `configinstall' target,
1434		not the `install' target.
1435
1436LINKSOWN	Link owner.  [${BINOWN}]
1437
1438LINKSGRP	Link group.  [${BINGRP}]
1439
1440LINKSMODE	Link mode.  [${NONBINMODE}]
1441
1442LINKSOWN_<fn>	Link owner of the specific file <fn>.
1443
1444LINKSGRP_<fn>	Link group of the specific file <fn>.
1445
1446LINKSMODE_<fn>	Link mode of the specific file <fn>.
1447
1448
1449=-=-=-=-=   bsd.man.mk   =-=-=-=-=
1450
1451The include file <bsd.man.mk> handles installing manual pages and their
1452links.
1453
1454It has a three targets:
1455
1456	catinstall:
1457		Install the preformatted manual pages and their links.
1458	htmlinstall:
1459		Install the HTML manual pages and their links.
1460	maninstall:
1461		Install the manual page sources and their links.
1462
1463It sets/uses the following variables:
1464
1465MANDIR		Base path for manual installation.
1466
1467MANGRP		Manual group.
1468
1469MANOWN		Manual owner.
1470
1471MANMODE		Manual mode.
1472
1473MANSUBDIR	Subdirectory under the manual page section, i.e. "/vax"
1474		or "/tahoe" for machine specific manual pages.
1475
1476MAN		The manual pages to be installed (use a .1 - .9 suffix).
1477
1478MLINKS		List of manual page links (using a .1 - .9 suffix).  The
1479		linked-to file must come first, the linked file second,
1480		and there may be multiple pairs.
1481
1482The include file <bsd.man.mk> includes a file named "../Makefile.inc" if
1483it exists.
1484
1485
1486=-=-=-=-=   bsd.obj.mk   =-=-=-=-=
1487
1488The include file <bsd.obj.mk> defines targets related to the creation
1489and use of separated object and source directories.
1490
1491If an environment variable named MAKEOBJDIRPREFIX is set, make(1) uses
1492${MAKEOBJDIRPREFIX}${.CURDIR} as the name of the object directory if
1493it exists.  Otherwise make(1) looks for the existence of a
1494subdirectory (or a symlink to a directory) of the source directory
1495into which built targets should be placed.  If an environment variable
1496named MAKEOBJDIR is set, make(1) uses its value as the name of the
1497object directory; failing that, make first looks for a subdirectory
1498named "obj.${MACHINE}", and if that doesn't exist, it looks for "obj".
1499
1500Object directories are not created automatically by make(1) if they
1501don't exist; you need to run a separate "make obj".  (This will happen
1502during a top-level build if "MKOBJDIRS" is set to a value other than
1503"no").  When the source directory is a subdirectory of ${BSDSRCDIR} --
1504and this is determined by a simple string prefix comparison -- object
1505directories are created in a separate object directory tree, and a
1506symlink to the object directory in that tree is created in the source
1507directory; otherwise, "make obj" assumes that you're not in the main
1508source tree and that it's not safe to use a separate object tree.
1509
1510Several variables used by <bsd.obj.mk> control exactly what
1511directories and links get created during a "make obj":
1512
1513MAKEOBJDIR	If set, this is the component name of the object
1514		directory.
1515
1516OBJMACHINE	If this is set but MAKEOBJDIR is not set, creates
1517		object directories or links named "obj.${MACHINE}";
1518		otherwise, just creates ones named "obj".
1519
1520USR_OBJMACHINE  If set, and the current directory is a subdirectory of
1521		${BSDSRCDIR}, create object directory in the
1522		corresponding subdirectory of ${BSDOBJDIR}.${MACHINE};
1523		otherwise, create it in the corresponding subdirectory
1524		of ${BSDOBJDIR}
1525
1526BUILDID		If set, the contents of this variable are appended
1527		to the object directory name.  If OBJMACHINE is also
1528		set, ".${BUILDID}" is added after ".${MACHINE}".
1529
1530
1531=-=-=-=-=   bsd.prog.mk   =-=-=-=-=
1532
1533The include file <bsd.prog.mk> handles building programs from one or
1534more source files, along with their manual pages.  It has a limited number
1535of suffixes, consistent with the current needs of the BSD tree.
1536<bsd.prog.mk> includes <bsd.shlib.mk> to get shared library parameters.
1537
1538It has eight targets:
1539
1540	all:
1541		build the program and its manual page.  This also
1542		creates a GDB initialization file (.gdbinit) in
1543		the objdir.  The .gdbinit file sets the shared library
1544		prefix to ${DESTDIR} to facilitate cross-debugging.
1545	clean:
1546		remove the program, any object files and the files a.out,
1547		Errs, errs, mklog, and ${PROG}.core.
1548	cleandir:
1549		remove all of the files removed by the target clean, as
1550		well as .depend, tags, and any manual pages.
1551		`distclean' is a synonym for `cleandir'.
1552	depend:
1553		make the dependencies for the source files, and store
1554		them in the file .depend.
1555	includes:
1556		install any header files.
1557	install:
1558		install the program and its manual pages; if the Makefile
1559		does not itself define the target install, the targets
1560		beforeinstall and afterinstall may also be used to cause
1561		actions immediately before and after the install target
1562		is executed.
1563	lint:
1564		run lint on the source files
1565	tags:
1566		create a tags file for the source files.
1567
1568It sets/uses the following variables:
1569
1570BINGRP		Binary group.
1571
1572BINOWN		Binary owner.
1573
1574BINMODE		Binary mode.
1575
1576CLEANDIRFILES	Additional files to remove for the cleandir target.
1577
1578CLEANFILES	Additional files to remove for the clean and cleandir targets.
1579
1580CONFIGOPTS	Additional flags to config(1) when building kernels.
1581
1582COPTS		Additional flags to the compiler when creating C objects.
1583
1584COPTS.<fn>	Additional flags to the compiler when creating the
1585		C objects for <fn>.
1586		For <fn>.[ly], "<fn>.c" must be used.
1587
1588CPUFLAGS	Additional flags to the compiler/assembler to select
1589		CPU instruction set options, CPU tuning options, etc.
1590
1591CPUFLAGS.<fn>	Additional flags to the compiler/assembler for <fn>.
1592		For <fn>.[ly], "<fn>.c" must be used.
1593
1594CPPFLAGS	Additional flags to the C pre-processor.
1595
1596CPPFLAGS.<fn>	Additional flags to the C pre-processor for <fn>.
1597		For <fn>.[ly], "<fn>.c" must be used.
1598
1599GDBINIT		List of GDB initialization files to add to "source"
1600		directives in the .gdbinit file that is created in the
1601		objdir.
1602
1603LDADD		Additional loader objects.  Usually used for libraries.
1604		For example, to load with the compatibility and utility
1605		libraries, use:
1606
1607			LDADD+=-lutil -lcompat
1608
1609LDFLAGS		Additional linker flags (passed to ${CC} during link).
1610
1611LINKS		See <bsd.links.mk>
1612
1613OBJCOPTS	Additional flags to the compiler when creating ObjC objects.
1614
1615OBJCOPTS.<fn>	Additional flags to the compiler when creating the
1616		ObjC objects for <fn>.
1617		For <fn>.[ly], "<fn>.c" must be used.
1618
1619SYMLINKS	See <bsd.links.mk>
1620
1621MAN		Manual pages (should end in .1 - .9).  If no MAN variable is
1622		defined, "MAN=${PROG}.1" is assumed.
1623
1624PAXCTL_FLAGS	If defined, run paxctl(1) on the program binary after link
1625		time, with the value of this variable as args to paxctl(1).
1626
1627PAXCTL_FLAGS.${PROG} Custom override for PAXCTL_FLAGS.
1628
1629PROG		The name of the program to build.  If not supplied, nothing
1630		is built.
1631
1632PROG_CXX	If defined, the name of the program to build.  Also
1633		causes <bsd.prog.mk> to link the program with the C++
1634		compiler rather than the C compiler.  PROG_CXX overrides
1635		the value of PROG if PROG is also set.
1636
1637PROGNAME	The name that the above program will be installed as, if
1638		different from ${PROG}.
1639
1640SRCS		List of source files to build the program.  If SRCS is not
1641		defined, it's assumed to be ${PROG}.c.
1642
1643DPSRCS		List of source files which are needed for generating
1644		dependencies, but are not needed in ${SRCS}.
1645
1646DPADD		Additional dependencies for the program.  Usually used for
1647		libraries.  For example, to depend on the compatibility and
1648		utility libraries use:
1649
1650			DPADD+=${LIBCOMPAT} ${LIBUTIL}
1651
1652		The following system libraries are predefined for DPADD:
1653
1654		LIBARCHIVE?=		${DESTDIR}/usr/lib/libarchive.a
1655		LIBASN1?=		${DESTDIR}/usr/lib/libasn1.a
1656		LIBATF_C?=		${DESTDIR}/usr/lib/libatf-c.a
1657		LIBATF_CXX?=		${DESTDIR}/usr/lib/libatf-c++.a
1658		LIBBIND9?=		${DESTDIR}/usr/lib/libbind9.a
1659		LIBBLUETOOTH?=		${DESTDIR}/usr/lib/libbluetooth.a
1660		LIBBSDMALLOC?=		${DESTDIR}/usr/lib/libbsdmalloc.a
1661		LIBBZ2?=		${DESTDIR}/usr/lib/libbz2.a
1662		LIBC?=			${DESTDIR}/usr/lib/libc.a
1663		LIBC_PIC?=		${DESTDIR}/usr/lib/libc_pic.a
1664		LIBCBOR?=		${DESTDIR}/usr/lib/libcbor.a
1665		LIBCOMPAT?=		${DESTDIR}/usr/lib/libcompat.a
1666		LIBCOM_ERR?=		${DESTDIR}/usr/lib/libcom_err.a
1667		LIBCRYPT?=		${DESTDIR}/usr/lib/libcrypt.a
1668		LIBCRYPTO?=		${DESTDIR}/usr/lib/libcrypto.a
1669		LIBCURSES?=		${DESTDIR}/usr/lib/libcurses.a
1670		LIBCXX?=		${DESTDIR}/usr/lib/libc++.a
1671		LIBDES?=		${DESTDIR}/usr/lib/libdes.a
1672		LIBDNS?=		${DESTDIR}/usr/lib/libdns.a
1673		LIBEDIT?=		${DESTDIR}/usr/lib/libedit.a
1674		LIBEVENT?=		${DESTDIR}/usr/lib/libevent.a
1675		LIBEVENT_OPENSSL?=	${DESTDIR}/usr/lib/libevent_openssl.a
1676		LIBEVENT_PTHREADS?=	${DESTDIR}/usr/lib/libevent_pthreads.a
1677		LIBEXECINFO?=		${DESTDIR}/usr/lib/libexecinfo.a
1678		LIBEXPAT?=		${DESTDIR}/usr/lib/libexpat.a
1679		LIBFETCH?=		${DESTDIR}/usr/lib/libfetch.a
1680		LIBFIDO2?=		${DESTDIR}/usr/lib/libfido2.a
1681		LIBFL?=			${DESTDIR}/usr/lib/libfl.a
1682		LIBFORM?=		${DESTDIR}/usr/lib/libform.a
1683		LIBGCC?=		${DESTDIR}/usr/lib/libgcc.a
1684		LIBGNUCTF?=		${DESTDIR}/usr/lib/libgnuctf.a
1685		LIBGNUMALLOC?=		${DESTDIR}/usr/lib/libgnumalloc.a
1686		LIBGSSAPI?=		${DESTDIR}/usr/lib/libgssapi.a
1687		LIBHDB?=		${DESTDIR}/usr/lib/libhdb.a
1688		LIBHEIMBASE?=		${DESTDIR}/usr/lib/libheimbase.a
1689		LIBHEIMNTLM?=		${DESTDIR}/usr/lib/libheimntlm.a
1690		LIBHX500?=		${DESTDIR}/usr/lib/libhx500.a
1691		LIBINTL?=		${DESTDIR}/usr/lib/libintl.a
1692		LIBIPSEC?=		${DESTDIR}/usr/lib/libipsec.a
1693		LIBISC?=		${DESTDIR}/usr/lib/libisc.a
1694		LIBISCCC?=		${DESTDIR}/usr/lib/libisccc.a
1695		LIBISCFG?=		${DESTDIR}/usr/lib/libiscfg.a
1696		LIBKADM5CLNT?=		${DESTDIR}/usr/lib/libkadm5clnt.a
1697		LIBKADM5SRV?=		${DESTDIR}/usr/lib/libkadm5srv.a
1698		LIBKAFS?=		${DESTDIR}/usr/lib/libkafs.a
1699		LIBKRB5?=		${DESTDIR}/usr/lib/libkrb5.a
1700		LIBKVM?=		${DESTDIR}/usr/lib/libkvm.a
1701		LIBL?=			${DESTDIR}/usr/lib/libl.a
1702		LIBLBER?=		${DESTDIR}/usr/lib/liblber.a
1703		LIBLDAP?=		${DESTDIR}/usr/lib/libldap.a
1704		LIBLDAP_R?=		${DESTDIR}/usr/lib/libldap_r.a
1705		LIBLUA?=		${DESTDIR}/usr/lib/liblua.a
1706		LIBM?=			${DESTDIR}/usr/lib/libm.a
1707		LIBMAGIC?=		${DESTDIR}/usr/lib/libmagic.a
1708		LIBMENU?=		${DESTDIR}/usr/lib/libmenu.a
1709		LIBNETPGPVERIFY?=	${DESTDIR}/usr/lib/libnetpgpverify.a
1710		LIBNS?=			${DESTDIR}/usr/lib/libns.a
1711		LIBOBJC?=		${DESTDIR}/usr/lib/libobjc.a
1712		LIBOSSAUDIO?=		${DESTDIR}/usr/lib/libossaudio.a
1713		LIBPAM?=		${DESTDIR}/usr/lib/libpam.a
1714		LIBPANEL?=		${DESTDIR}/usr/lib/libpanel.a
1715		LIBPCAP?=		${DESTDIR}/usr/lib/libpcap.a
1716		LIBPCI?=		${DESTDIR}/usr/lib/libpci.a
1717		LIBPOSIX?=		${DESTDIR}/usr/lib/libposix.a
1718		LIBPTHREAD?=		${DESTDIR}/usr/lib/libpthread.a
1719		LIBPUFFS?=		${DESTDIR}/usr/lib/libpuffs.a
1720		LIBQUOTA?=		${DESTDIR}/usr/lib/libquota.a
1721		LIBRADIUS?=		${DESTDIR}/usr/lib/libradius.a
1722		LIBREFUSE?=		${DESTDIR}/usr/lib/librefuse.a
1723		LIBRESOLV?=		${DESTDIR}/usr/lib/libresolv.a
1724		LIBRMT?=		${DESTDIR}/usr/lib/librmt.a
1725		LIBROKEN?=		${DESTDIR}/usr/lib/libroken.a
1726		LIBRPCSVC?=		${DESTDIR}/usr/lib/librpcsvc.a
1727		LIBRT?=			${DESTDIR}/usr/lib/librt.a
1728		LIBRUMP?=		${DESTDIR}/usr/lib/librump.a
1729		LIBRUMPFS_CD9660?=	${DESTDIR}/usr/lib/librumpfs_cd9660.a
1730		LIBRUMPFS_EFS?=		${DESTDIR}/usr/lib/librumpfs_efs.a
1731		LIBRUMPFS_EXT2FS?=	${DESTDIR}/usr/lib/librumpfs_ext2fs.a
1732		LIBRUMPFS_FFS?=		${DESTDIR}/usr/lib/librumpfs_ffs.a
1733		LIBRUMPFS_HFS?=		${DESTDIR}/usr/lib/librumpfs_hfs.a
1734		LIBRUMPFS_LFS?=		${DESTDIR}/usr/lib/librumpfs_lfs.a
1735		LIBRUMPFS_MSDOS?=	${DESTDIR}/usr/lib/librumpfs_msdos.a
1736		LIBRUMPFS_NFS?=		${DESTDIR}/usr/lib/librumpfs_nfs.a
1737		LIBRUMPFS_NTFS?=	${DESTDIR}/usr/lib/librumpfs_ntfs.a
1738		LIBRUMPFS_SYSPUFFS?=	${DESTDIR}/usr/lib/librumpfs_syspuffs.a
1739		LIBRUMPFS_TMPFS?=	${DESTDIR}/usr/lib/librumpfs_tmpfs.a
1740		LIBRUMPFS_UDF?=		${DESTDIR}/usr/lib/librumpfs_udf.a
1741		LIBRUMPUSER?=		${DESTDIR}/usr/lib/librumpuser.a
1742		LIBSASLC?=		${DESTDIR}/usr/lib/libsaslc.a
1743		LIBSKEY?=		${DESTDIR}/usr/lib/libskey.a
1744		LIBSL?=			${DESTDIR}/usr/lib/libsl.a
1745		LIBSQLITE3?=		${DESTDIR}/usr/lib/libsqlite3.a
1746		LIBSSH?=		${DESTDIR}/usr/lib/libssh.a
1747		LIBSSL?=		${DESTDIR}/usr/lib/libssl.a
1748		LIBSTDCXX?=		${DESTDIR}/usr/lib/libstdc++.a
1749		LIBSUPCXX?=		${DESTDIR}/usr/lib/libsupc++.a
1750		LIBTERMINFO?=		${DESTDIR}/usr/lib/libterminfo.a
1751		LIBTRE?=		${DESTDIR}/usr/lib/libtre.a
1752		LIBUNBOUND?=		${DESTDIR}/usr/lib/libunbound.a
1753		LIBUSBHID?=		${DESTDIR}/usr/lib/libusbhid.a
1754		LIBUTIL?=		${DESTDIR}/usr/lib/libutil.a
1755		LIBWIND?=		${DESTDIR}/usr/lib/libwind.a
1756		LIBWRAP?=		${DESTDIR}/usr/lib/libwrap.a
1757		LIBY?=			${DESTDIR}/usr/lib/liby.a
1758		LIBZ?=			${DESTDIR}/usr/lib/libz.a
1759
1760		The following c startup files.
1761
1762		LIBCRT0?=		${DESTDIR}/usr/lib/crt0.o
1763		LIBCRTI?=		${DESTDIR}/usr/lib/crti.o
1764		LIBCRTBEGIN?=		${DESTDIR}/usr/lib/crti.o
1765		LIBCRTEND?=		${DESTDIR}/usr/lib/crtn.o
1766
1767		The following X-Windows libraries are predefined for DPADD:
1768
1769		LIBDPS?=		${DESTDIR}/usr/X11R7/lib/libdps.a
1770		LIBFNTSTUBS?=		${DESTDIR}/usr/X11R7/lib/libfntstubs.a
1771		LIBFONTCACHE?=		${DESTDIR}/usr/X11R7/lib/libfontcache.a
1772		LIBFONTCONFIG?=		${DESTDIR}/usr/X11R7/lib/libfontconfig.a
1773		LIBFONTENC?=		${DESTDIR}/usr/X11R7/lib/libfontenc.a
1774		LIBFREETYPE?=		${DESTDIR}/usr/X11R7/lib/libfreetype.a
1775		LIBFS?=			${DESTDIR}/usr/X11R7/lib/libFS.a
1776		LIBGL?=			${DESTDIR}/usr/X11R7/lib/libGL.a
1777		LIBGLU?=		${DESTDIR}/usr/X11R7/lib/libGLU.a
1778		LIBICE?=		${DESTDIR}/usr/X11R7/lib/libICE.a
1779		LIBLBXUTIL?=		${DESTDIR}/usr/X11R7/lib/liblbxutil.a
1780		LIBSM?=			${DESTDIR}/usr/X11R7/lib/libSM.a
1781		LIBX11?=		${DESTDIR}/usr/X11R7/lib/libX11.a
1782		LIBX11_XCB?=		${DESTDIR}/usr/X11R7/lib/libX11-xcb.a
1783		LIBXAU?=		${DESTDIR}/usr/X11R7/lib/libXau.a
1784		LIBXAW?=		${DESTDIR}/usr/X11R7/lib/libXaw.a
1785		LIBXCB?=		${DESTDIR}/usr/X11R7/lib/libxcb.a
1786		LIBXDMCP?=		${DESTDIR}/usr/X11R7/lib/libXdmcp.a
1787		LIBXEXT?=		${DESTDIR}/usr/X11R7/lib/libXext.a
1788		LIBXFONT2?=		${DESTDIR}/usr/X11R7/lib/libXfont2.a
1789		LIBXFONT?=		${DESTDIR}/usr/X11R7/lib/libXfont.a
1790		LIBXFT?=		${DESTDIR}/usr/X11R7/lib/libXft.a
1791		LIBXI?=			${DESTDIR}/usr/X11R7/lib/libXi.a
1792		LIBXINERAMA?=		${DESTDIR}/usr/X11R7/lib/libXinerama.a
1793		LIBXKBFILE?=		${DESTDIR}/usr/X11R7/lib/libxkbfile.a
1794		LIBXMU?=		${DESTDIR}/usr/X11R7/lib/libXmu.a
1795		LIBXMUU?=		${DESTDIR}/usr/X11R7/lib/libXmuu.a
1796		LIBXPM?=		${DESTDIR}/usr/X11R7/lib/libXpm.a
1797		LIBXRANDR?=		${DESTDIR}/usr/X11R7/lib/libXrandr.a
1798		LIBXRENDER?=		${DESTDIR}/usr/X11R7/lib/libXrender.a
1799		LIBXSS?=		${DESTDIR}/usr/X11R7/lib/libXss.a
1800		LIBXT?=			${DESTDIR}/usr/X11R7/lib/libXt.a
1801		LIBXTRAP?=		${DESTDIR}/usr/X11R7/lib/libXTrap.a
1802		LIBXTST?=		${DESTDIR}/usr/X11R7/lib/libXtst.a
1803		LIBXV?=			${DESTDIR}/usr/X11R7/lib/libXv.a
1804		LIBXXF86DGA?=		${DESTDIR}/usr/X11R7/lib/libXxf86dga.a
1805		LIBXXF86MISC?=		${DESTDIR}/usr/X11R7/lib/libXxf86misc.a
1806		LIBXXF86VM?=		${DESTDIR}/usr/X11R7/lib/libXxf86vm.a
1807
1808SHAREDSTRINGS	If defined, a new .c.o rule is used that results in shared
1809		strings, using xstr(1). Note that this will not work with
1810		parallel makes.
1811
1812STRIPFLAG	The flag passed to the install program to cause the binary
1813		to be stripped.
1814
1815SUBDIR		A list of subdirectories that should be built as well.
1816		Each of the targets will execute the same target in the
1817		subdirectories.
1818
1819SCRIPTS		A list of interpreter scripts [file.{sh,csh,pl,awk,...}].
1820		These are installed exactly like programs.
1821
1822SCRIPTSDIR	The location to install the scripts.  Each script can be
1823		installed to a separate path by setting SCRIPTSDIR_<script>.
1824
1825SCRIPTSNAME	The name that the above program will be installed as, if
1826		different from ${SCRIPTS}. These can be further specialized
1827		by setting SCRIPTSNAME_<script>.
1828
1829FILES		See description of <bsd.files.mk>.
1830
1831SHLINKDIR	Target directory for shared linker.  See description of
1832		<bsd.own.mk> for additional information about this variable.
1833
1834The include file <bsd.prog.mk> includes the file named "../Makefile.inc"
1835if it exists, as well as the include file <bsd.man.mk>.
1836
1837Some simple examples:
1838
1839To build foo from foo.c with a manual page foo.1, use:
1840
1841	PROG=	foo
1842
1843	.include <bsd.prog.mk>
1844
1845To build foo from foo.c with a manual page foo.2, add the line:
1846
1847	MAN=	foo.2
1848
1849If foo does not have a manual page at all, add the line:
1850
1851	MKMAN=	no
1852
1853If foo has multiple source files, add the line:
1854
1855	SRCS=	a.c b.c c.c d.c
1856
1857
1858=-=-=-=-=   bsd.rpc.mk   =-=-=-=-=
1859
1860The include file <bsd.rpc.mk> contains a makefile fragment used to
1861construct source files built by rpcgen.
1862
1863The following macros may be defined in makefiles which include
1864<bsd.rpc.mk> in order to control which files get built and how they
1865are to be built:
1866
1867RPC_INCS:	construct .h file from .x file
1868RPC_XDRFILES:	construct _xdr.c from .x file
1869		(for marshalling/unmarshalling data types)
1870RPC_SVCFILES:	construct _svc.c from .x file
1871		(server-side stubs)
1872RPC_SVCFLAGS:	Additional flags passed to builds of RPC_SVCFILES.
1873
1874RPC_XDIR:	Directory containing .x/.h files
1875
1876
1877=-=-=-=-=   bsd.shlib.mk   =-=-=-=-=
1878
1879The include file <bsd.shlib.mk> computes parameters for shared library
1880installation and use.  It defines no targets.  <bsd.own.mk> MUST be
1881included before <bsd.shlib.mk>.
1882
1883<bsd.own.mk> sets the following variables, if they are not already defined
1884(defaults are in brackets):
1885
1886SHLIBINSTALLDIR	If ${USE_SHLIBDIR} is not "no", use ${SHLIBINSTALLDIR}
1887		instead of ${LIBDIR} as the base path for shared library
1888		installation.  [/lib]
1889
1890SHLIBDIR	The path to USE_SHLIBDIR shared libraries to use when building
1891		a program.  [/lib for programs in /bin and /sbin, /usr/lib
1892		for all others.]
1893
1894_LIBSODIR	Set to ${SHLIBINSTALLDIR} if ${USE_SHLIBDIR} is not "no",
1895		otherwise set to ${LIBDIR}
1896
1897SHLINKINSTALLDIR Base path for shared linker.  [/libexec]
1898
1899SHLINKDIR	Path to use for shared linker when building a program.
1900		[/libexec for programs in /bin and /sbin, /usr/libexec for
1901		all others.]
1902
1903
1904=-=-=-=-=   bsd.subdir.mk   =-=-=-=-=
1905
1906The include file <bsd.subdir.mk> contains the default targets for building
1907subdirectories.  It has the same eight targets as <bsd.prog.mk>: all,
1908clean, cleandir, depend, includes, install, lint, and tags.  It uses the
1909following variables:
1910
1911NOSUBDIR	If this variable is defined, then the SUBDIR variable
1912		will be ignored and subdirectories will not be processed.
1913
1914SUBDIR		For all of the directories listed in ${SUBDIR}, the
1915		specified directory will be visited and the target made.
1916
1917		As a special case, the use of a token .WAIT as an
1918		entry in SUBDIR acts as a synchronization barrier
1919		when multiple make jobs are run; subdirs before the
1920		.WAIT must complete before any subdirs after .WAIT are
1921		started.  See make(1) for some caveats on use of .WAIT
1922		and other special sources.
1923
1924
1925=-=-=-=-=   bsd.x11.mk   =-=-=-=-=
1926
1927The include file <bsd.x11.mk> contains parameters and targets for
1928cross-building X11 from ${X11SRCDIR.<package>}.  It should be included
1929after the general Makefile contents but before the include files such as
1930<bsd.prog.mk> and <bsd.lib.mk>.
1931
1932It provides the following targets:
1933	.man.1 .man.3 .man.4 .man.5 .man.7:
1934		If ${MAN} or ${PROG} is set and ${MKMAN} != "no",
1935		these rules convert from X11's manual page source
1936		into an mdoc.old source file.
1937
1938It sets the following variables:
1939
1940BINDIR			Set to ${X11BINDIR}.
1941			To override, define after including <bsd.x11.mk>
1942
1943LIBDIR			Set to ${X11USRLIBDIR}.
1944			To override, define after including <bsd.x11.mk>
1945
1946MANDIR			Set to ${X11MANDIR}.
1947			To override, define after including <bsd.x11.mk>
1948
1949CPPFLAGS		Appended with definitions to include from
1950			${DESTDIR}${X11INCDIR}
1951
1952LDFLAGS			Appended with definitions to link from
1953			${DESTDIR}${X11USRLIBDIR}
1954
1955X11FLAGS.CONNECTION	Equivalent to X11's CONNECTION_FLAGS.
1956
1957X11FLAGS.EXTENSION	Equivalent to X11's EXT_DEFINES.
1958
1959X11FLAGS.LOADABLE	Equivalent to X11's LOADABLE.
1960
1961X11FLAGS.OS_DEFINES	Equivalent to X11's OS_DEFINES.
1962
1963X11FLAGS.SERVER		Equivalent to X11's ServerDefines.
1964
1965X11FLAGS.THREADLIB	Equivalent to X11's THREADS_DEFINES for libraries.
1966
1967X11FLAGS.THREADS	Equivalent to X11's THREADS_DEFINES.
1968
1969X11FLAGS.VERSION	cpp(1) definitions of OSMAJORVERSION and OSMINORVERSION.
1970
1971X11FLAGS.DIX		Equivalent to X11's DIX_DEFINES.
1972
1973X11TOOL_UNXCOMM		Commandline to convert `XCOMM' comments to `#'
1974
1975It uses the following variables:
1976
1977APPDEFS			List of app-default files to install.
1978
1979CPPSCRIPTS		List of files/scripts to run through cpp(1)
1980			and then ${X11TOOL_UNXCOMM}.  The source files
1981			have a `.cpp' suffix, the generated files do not.
1982
1983CPPSCRIPTFLAGS		Additional flags to cpp(1) when building CPPSCRIPTS.
1984
1985CPPSCRIPTFLAGS_<fn>	Additional flags to cpp(1) when building CPPSCRIPT <fn>.
1986
1987
1988=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1989
1990The following files are described here for completion, but they are not
1991supposed to be included directly from other Makefiles; they are used
1992internally by other system files.
1993
1994=-=-=-=-=   bsd.sys.mk   =-=-=-=-=
1995
1996The include file <bsd.sys.mk> is used by other system mk files and
1997it is not intended to be included standalone. It contains rules and
1998system build variables. It requires bsd.own.mk to be included first.
1999It contains overrides that are used when building the NetBSD source tree.
2000
2001The following variables control how various files are compiled/built.
2002(Note that these may be overridden in <bsd.own.mk> if USETOOLS == "yes"):
2003
2004AR		Create, modify, and extract from archives.  [ar]
2005
2006ARFLAGS		Options to ${AR}.  [rl]
2007
2008ARM_ELF2AOUT	Convert ELF-format executable to a.out.  [elf2aout]
2009
2010AS		Assembler.  [as]
2011
2012AFLAGS		Options to ${CC} when compiling or linking .s or .S
2013		assembly source files.  []
2014
2015BUILDSEED	GCC uses random numbers when compiling C++ code.
2016		If this option is present, seed the random number
2017		generator based on the value, source file names and
2018		the output file name to make builds more deterministic.
2019		Additional information is available in the GCC
2020		documentation of -frandom-seed.
2021
2022CC		C compiler.  [cc]
2023
2024CFLAGS		Options to ${CC}.  [Usually -O or -O2]
2025
2026CPP		C Pre-Processor.  [cpp]
2027
2028CPPFLAGS	Options to ${CPP}.  []
2029
2030CPUFLAGS	Optimization flags for ${CC}.  []
2031
2032CXX		C++ compiler.  [c++]
2033
2034CXXFLAGS	Options to ${CXX}.  [${CFLAGS}]
2035
2036M68K_ELF2AOUT	Convert ELF-format executable to a.out.  [elf2aout]
2037
2038MIPS_ELF2ECOFF	Convert ELF-format executable to ECOFF.  [elf2ecoff]
2039
2040FC		Fortran compiler.  [f77]
2041
2042FFLAGS		Options to {$FC}.  [-O]
2043
2044HOST_SH		Shell.	This must be an absolute path, because it may be
2045		substituted into "#!" lines in scripts.	 [/bin/sh]
2046
2047INSTALL		install(1) command.  [install]
2048
2049LEX		Lexical analyzer.  [lex]
2050
2051LFLAGS		Options to ${LEX}.  []
2052
2053LPREFIX		Symbol prefix for ${LEX} (see -P option in lex(1)) [yy]
2054
2055LD		Linker.  [ld]
2056
2057LDFLAGS		Options to ${CC} during the link process.  []
2058
2059LINT		C program verifier.  [lint]
2060
2061LINTFLAGS	Options to ${LINT}.  [-chapbrxzgFS]
2062
2063LORDER		List dependencies for object files.  [lorder]
2064
2065MAKE		make(1).  [make]
2066
2067MKDEP		Construct Makefile dependency list.  [mkdep]
2068
2069MKDEPCXX	Construct Makefile dependency list for C++ files.  [mkdep]
2070
2071NM		List symbols from object files.  [nm]
2072
2073PC		Pascal compiler.  [pc]  (Not present)
2074
2075PFLAGS		Options to ${PC}.  []
2076
2077OBJC		Objective C compiler.  [${CC}]
2078
2079OBJCFLAGS	Options to ${OBJC}.  [${CFLAGS}]
2080
2081OBJCOPY		Copy and translate object files.  [objcopy]
2082
2083OBJCOPYLIBFLAGS	Flags to pass to objcopy when library objects are
2084		being built. [${.TARGET} =~ "*.po" ? -X : -x]
2085
2086OBJDUMP		Display information from object files.  [objdump]
2087
2088RANLIB		Generate index to archive.  [ranlib]
2089
2090READELF		Display information from ELF object files.  [readelf]
2091
2092SIZE		List section sizes and total size.  [size]
2093
2094STRINGS		Display printable character sequences in files.  [strings]
2095
2096STRIP		Discard symbols from object files.  [strip]
2097
2098TSORT		Topological sort of a directed graph.  [tsort -q]
2099
2100YACC		LALR(1) parser generator.  [yacc]
2101
2102YFLAGS		Options to ${YACC}.  []
2103
2104YHEADER		If defined, add "-d" to YFLAGS, and add dependencies
2105		from <file>.y to <file>.h and <file>.c, and add
2106		<foo>.h to CLEANFILES.
2107
2108YPREFIX		If defined, add "-p ${YPREFIX}" to YFLAGS.
2109
2110
2111Other variables of note (incomplete list):
2112
2113NOGCCERROR	If defined, prevents passing certain ${CFLAGS} to GCC
2114		that cause warnings to be fatal, such as:
2115			-Werror -Wa,--fatal-warnings
2116		(The latter being for as(1).)
2117
2118NOCLANGERROR	If defined and clang is used as C compiler, -Werror is not
2119		passed to it.
2120
2121WARNS		Crank up compiler warning options; the distinct levels are:
2122			WARNS=1
2123			WARNS=2
2124			WARNS=3
2125			WARNS=4
2126			WARNS=5
2127			WARNS=6
2128
2129=-=-=-=-=   bsd.host.mk  =-=-=-=-=
2130
2131This file is automatically included from bsd.own.mk. It contains settings
2132for all the HOST_* variables that are used in host programs and libraries.
2133
2134HOST_AR			The host archive processing command
2135
2136HOST_CC			The host c compiler
2137
2138HOST_CFLAGS		The host c compiler flags
2139
2140HOST_COMPILE.c		The host c compiler line with flags
2141
2142HOST_COMPILE.cc		The host c++ compiler line with flags
2143
2144HOST_CPP		The host c pre-processor
2145
2146HOST_CPPFLAGS		The host c pre-processor flags
2147
2148HOST_CXX		The host c++ compiler
2149
2150HOST_CXXFLAGS		The host c++ compiler flags
2151
2152HOST_INSTALL_DIR	The host command to install a directory
2153
2154HOST_INSTALL_FILE	The host command to install a file
2155
2156HOST_INSTALL_SYMLINK	The host command to install a symlink
2157
2158HOST_LD			The host linker command
2159
2160HOST_LDFLAGS		The host linker flags
2161
2162HOST_LINK.c		The host c linker line with flags
2163
2164HOST_LINK.cc		The host c++ linker line with flags
2165
2166HOST_LN			The host command to link two files
2167
2168HOST_MKDEP		The host command to create dependencies for c programs
2169
2170HOST_MKDEPCXX		The host command to create dependencies for c++ programs
2171
2172HOST_OSTYPE		The host OSNAME-RELEASE-ARCH tupple
2173
2174HOST_RANLIB		The host command to create random access archives
2175
2176HOST_SH			The host Bourne shell interpreter name (absolute path)
2177
2178=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
2179