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