bsd.README revision 1.213
1#	$NetBSD: bsd.README,v 1.213 2008/07/21 23:39:55 lukem 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 ".so" 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
69MKxxx		Can be set to "no" to disable functionality, or
70		"yes" to enable it.
71		Usually defaults to "yes", although some variables
72		default to "no".
73		Due to make(1) implementation issues, if a temporary
74		command-line override of a mk.conf or <bsd.own.mk>
75		setting is required whilst still honouring a particular
76		Makefile's setting of MKxxx, use
77			env MKxxx=value make
78		instead of
79			make MKxxx=value
80
81NOxxx		If defined, disables a feature.
82		Not intended for users.
83		This is to allow Makefiles to disable functionality
84		that they don't support (such as missing man pages).
85		NOxxx variables must be defined before <bsd.own.mk>
86		is included.
87
88The following variables that control how things are made/installed that
89are not set by default. These should not be set by Makefiles; they're for
90the user to define in MAKECONF (see <bsd.own.mk>, below) or on the make(1)
91command line:
92
93BUILD 		If defined, 'make install' checks that the targets in the
94		source directories are up-to-date and remakes them if they
95                are out of date, instead of blindly trying to install
96                out of date or non-existent targets.
97
98MAKEVERBOSE	Control how "verbose" the standard make(1) rules are.
99		Default: 2
100		Supported values:
101		    0	Minimal output ("quiet")
102		    1	Describe what is occurring
103		    2	Describe what is occurring and echo the actual command
104
105
106MKATF		If "no", don't build libatf-c, libatf-c++ libraries associated
107		with the Automated Testing Framework (ATF).
108		Default: yes
109
110MKBFD		If "no", don't build libbfd, libiberty, or any of the things
111		that depend on them (binutils/gas/ld, gdb, dbsym, mdsetimage).
112		Default: yes
113
114MKCATPAGES	If "no", don't build or install the catman pages.
115		Default: yes
116
117MKCOMPLEX	If "no", don't build libm support for <complex.h>
118		Default: yes
119
120MKCRYPTO	If "no", no cryptography support will be built into the system,
121		and also acts as "MKKERBEROS=no".
122		Default: yes
123
124MKCRYPTO_IDEA	If not "no", IDEA support will be built into libcrypto_idea.a.
125		Default: no
126
127MKCRYPTO_MDC2	If not "no", MDC2 support will be built into libcrypto_mdc2.a
128		Default: no
129
130MKCRYPTO_RC5	If not "no", RC5 support will be built into libcrypto_rc5.a.
131		Default: no
132
133MKCVS		If "no", don't build or install cvs(1).
134		Default: yes
135
136MKDEBUG		If "no", don't build and install separate debugging symbols
137		into /usr/libdata/debug.
138		Default: no
139
140MKDEBUGLIB	Build debugging libraries.
141		Default: no
142
143MKDOC		If "no", don't build or install the documentation.
144		Default: yes
145
146MKDYNAMICROOT	If "no", build programs in /bin and /sbin statically,
147		don't install certain libraries in /lib, and don't
148		install the shared linker into /libexec.
149		Default: yes
150
151MKGCC		If "no", don't build gcc(1) or any of the GCC-related
152		libraries (libgcc, libobjc, libstdc++).
153		Default: yes
154
155MKGCCCMDS	If "no", don't build gcc(1), but do build the GCC-related
156		libraries (libgcc, libobjc, libstdc++).
157		Default: yes
158
159MKGDB		If "no", don't build gdb(1).
160		Default: yes
161
162MKHESIOD	If "no", disables building of Hesiod infrastructure
163		(libraries and support programs).
164		Default: yes
165
166MKHOSTOBJ	If not "no", for programs intended to be run on the compile
167		host, the name, release, and architecture of the host
168		operating system will be suffixed to the name of the object
169		directory created by "make obj".
170		Default: no
171
172MKHTML		If "no", don't build or install the html man pages.
173		Default: no
174
175MKIEEEFP	If "no", don't add code for IEEE754/IEC60559 conformance.
176		Has no effect on most platforms.
177		Default: yes
178
179MKINET6		If "no", disables building of INET6 (IPv6) infrastructure
180		(libraries and support programs).
181		Default: yes
182
183MKINFO		If "no", don't build or install Info documentation from
184		Texinfo source files.
185		Default: yes
186
187MKIPFILTER	If "no", don't build or install the IP Filter programs and LKM.
188		Default: yes
189
190MKISCSI		If "no", don't build or install iSCSI library or applications
191		(depends on libpthread.)
192		Default: yes
193
194MKKERBEROS	If "no", disables building of Kerberos v5
195		infrastructure (libraries and support programs).
196		Default: yes
197
198MKLDAP		If "no", disables building of LDAP infrastructure
199		(libraries and support programs).
200		Default: yes
201
202MKLINKLIB	If "no", act as "MKLINT=no MKPICINSTALL=no MKPROFILE=no".
203		Also:
204			- don't install the .a libraries
205			- don't install _pic.a libraries on PIC systems
206			- don't build .a libraries on PIC systems
207			- don't install the .so symlink on ELF systems
208		I.e, only install the shared library (and the .so.major
209		symlink on ELF).
210		Default: yes
211
212MKLINT		If "no", don't build or install the lint libraries.
213		Default: yes
214
215MKMAN		If "no", don't build or install the man or catman pages,
216		and also acts as "MKCATPAGES=no MKHTML=no".
217		Default: yes
218
219MKMANZ		If not "no", compress manual pages at installation time.
220		Default: no
221
222MKMODULAR	If "no", don't build the versions of modload(8), modstat(8)
223		and modunload(8) that use the new modules framework present
224		in the kernel (enabled separately using 'options MODULAR'
225		int the configuration file).  Also don't build any other
226		stuff that may rely on this support, such as tests or kernel
227		modules.
228		Note: This flag will disappear when the new modules framework
229		is complete enough to replace the old LKM, effectively
230		switching it to "yes" by default.
231		Default: no
232
233MKNLS		If "no", don't build or install the NLS files and locale
234		definition files.
235		Default: yes
236
237MKOBJ		If "no", don't enable the rule which creates objdirs,
238		and also acts as "MKOBJDIRS=no".
239		Default: yes
240
241MKOBJDIRS	If "no", don't create objdirs during a "make build".
242		Default: no
243
244MKPAM		If "no", disables building of PAM authentication
245		infrastructure (libraries and support programs).
246		Default: yes
247
248MKPCC		If "no", don't build pcc(1) or any of the PCC-related
249		libraries (libpcc, libpccsoftfloat).
250		Default: no
251
252MKPCCCMDS	If "no", don't build pcc(1), but do build the PCC-related
253		libraries (libpcc, libpccsoftfloat).
254		Default: no
255
256MKPF		If "no", don't build or install the pf programs and LKM.
257		Default: yes
258
259MKPIC		If "no", don't build or install shared libraries, and
260		also acts as "MKPICLIB=no"
261		Default: yes (for MACHINE_ARCHs that support it) 
262
263MKPICINSTALL	If "no", don't install the *_pic.a libraries.
264		Default: yes
265
266MKPICLIB	If "no", don't build *_pic.a libraries, and build the
267		shared object libraries from the .a libraries.
268		A symlink is installed in ${DESTDIR}/usr/lib for the
269		_pic.a library pointing to the .a library.
270		Default: yes
271
272MKPIE		If "no", create regular executables. Otherwise create
273		PIE (Position Independent Executables).
274		Default: no
275
276MKPOSTFIX	If "no", don't build or install postfix(1).
277		Default: yes
278
279MKPROFILE	If "no", don't build or install the profiling (*_p.a) libraries.
280		Default: yes
281
282MKPUFFS		If "no", don't build librefuse (lib/librefuse) or
283		puffs applications (usr.sbin/puffs).  NOTE: libpuffs
284		is always built due to historic reasons.  This flag will
285		disappear once puffs is no longer considered experimental,
286		i.e. it will effectively default to "yes".
287		Default: no
288
289MKSHARE		If "no", act as "MKCATPAGES=no MKDOC=no MKHTML=no MKINFO=no
290		MKMAN=no MKNLS=no".
291		I.e, don't build catman pages, documentation, Info
292		documentation, man pages, NLS files, ...
293		Default: yes
294
295MKSKEY		If "no", disables building of S/key authentication
296		infrastructure (libraries and support programs).
297		Default: yes
298
299MKSOFTFLOAT	If not "no", build with options to enable the compiler to
300		generate output containing library calls for floating
301		point and possibly soft-float library support.
302		Default: no
303
304MKSTATICLIB	If "no", don't build or install the normal static (*.a)
305		libraries.
306		Default: yes
307
308MKUNPRIVED	If not "no", don't set the owner/group/mode when installing
309		files or directories, and keep a metadata log of what
310		the owner/group/mode should be.  This allows a
311		non-root "make install".
312		Default: no
313
314MKUPDATE 	If not "no", 'make install' only installs targets that are
315		more recently modified in the source directories that their
316		installed counterparts.
317		Default: no
318
319MKX11		If not "no", 'make build' also descends into src/x11
320		to cross build X11R6 and automatically enables creation
321		of X sets.
322		Default: no
323
324MKYP		If "no", disables building of YP (NIS)
325		infrastructure (libraries and support programs).
326		Default: yes
327
328USE_HESIOD	If "no", disables building Hesiod support into
329		various system utilities/libraries that support it.
330		If ${MKHESIOD} is "no", USE_HESIOD will also be
331		forced to "no".
332
333USE_INET6	If "no", disables building INET6 (IPv6) support into
334		various system utilities/libraries that support it.
335		If ${MKINET6} is "no", USE_INET6 will also be
336		forced to "no".
337
338USE_JEMALLOC	If "no", disables building the "jemalloc" allocator
339		designed for improved performance with threaded
340		applications.  The "phkmalloc" allocator as used up
341		before NetBSD-5.0 will be substituted.
342
343USE_KERBEROS	If "no", disables building Kerberos v5
344		support into various system utilities/libraries that
345		support it.  If ${MKKERBEROS} is "no", USE_KERBEROS
346		will also be forced to "no".
347
348USE_LDAP	If "no", disables building LDAP support into various
349		system utilities/libraries that support it.
350		If ${MKLDAP} is "no", USE_LDAP will also be forced to "no".
351
352USE_PAM		If "no", disables building PAM authentication support
353		into various system utilities/libraries that support it.
354		If ${MKPAM} is "no", USE_PAM will also be forced to "no".
355
356USE_SKEY	If "no", disables building S/key authentication
357		support into various system utilities/libraries that
358		support it.  If ${MKSKEY} is "no", USE_SKEY will
359		also be forced to "no".
360		Default: no
361
362USE_SSP		If "no", disables GCC stack protection code, which
363		detects stack overflows and aborts the program. This
364		imposes some performance penalty.
365		Default: no
366
367USE_YP		If "no", disables building YP (NIS) support into
368		various system utilities/libraries that support it.
369		If ${MKYP} is "no", USE_YP will also be forced to "no".
370
371COPTS.lib<lib>
372OBJCOPTS.lib<lib>
373LDADD.lib<lib>
374CPPFLAGS.lib<lib>
375CXXFLAGS.lib<lib>
376COPTS.<prog>
377OBJCCOPTS.<prog>
378LDADD.<prog>
379CPPFLAGS.<prog>
380CXXFLAGS.<prog>	These provide a way to specify additions to the associated
381		variables in a way that applies only to a particular library
382		or program.  <lib> corresponds to the LIB variable set in
383		the library's makefile.  <prog> corresponds to either PROG
384		or PROG_CXX (if set).  For example, if COPTS.libcrypto is
385		set to "-g", "-g" will be added to COPTS only when compiling
386		the crypto library.
387
388=-=-=-=-=   sys.mk   =-=-=-=-=
389
390The include file <sys.mk> has the default rules for all makes, in the BSD
391environment or otherwise.  You probably don't want to touch this file.
392
393=-=-=-=-=   bsd.own.mk   =-=-=-=-=
394
395The include file <bsd.own.mk> contains source tree configuration parameters,
396such as the owners, groups, etc. for both manual pages and binaries, and
397a few global "feature configuration" parameters.
398
399It has no targets.
400
401To get system-specific configuration parameters, <bsd.own.mk> will try to
402include the file specified by the "MAKECONF" variable.  If MAKECONF is not
403set, or no such file exists, the system make configuration file, /etc/mk.conf
404is included.  These files may define any of the variables described below.
405
406<bsd.own.mk> sets the following variables, if they are not already defined
407(defaults are in brackets):
408
409NETBSDSRCDIR	Top of the NetBSD source tree.
410		If _SRC_TOP_ != "", that will be used as the default,
411		otherwise BSDSRCDIR will be used as the default.
412		Various makefiles within the NetBSD source tree will
413		use this to reference the top level of the source tree.
414
415_SRC_TOP_	Top of the system source tree, as determined by <bsd.own.mk>
416		based on the presence of tools/ and build.sh.  This variable
417		is "internal" to <bsd.own.mk>, although its value is only
418		determined once and then propagated to all sub-makes.
419
420BSDSRCDIR	The real path to the system sources, so that 'make obj'
421		will work correctly.  [/usr/src]
422
423BSDOBJDIR	The real path to the system 'obj' tree, so that 'make obj'
424		will work correctly.  [/usr/obj]
425
426BINGRP		Binary group.  [wheel]
427
428BINOWN		Binary owner.  [root]
429
430BINMODE		Binary mode.  [555]
431
432NONBINMODE	Mode for non-executable files.  [444]
433
434MANDIR		Base path for manual installation.  [/usr/share/man/cat]
435
436MANGRP		Manual group.  [wheel]
437
438MANOWN		Manual owner.  [root]
439
440MANMODE		Manual mode.  [${NONBINMODE}]
441
442MANINSTALL	Manual installation type: maninstall, catinstall, or both
443		[maninstall catinstall]
444
445LDSTATIC	Control program linking; if set blank, link everything
446		dynamically.  If set to "-static", link everything statically.
447		If not set, programs link according to their makefile.
448
449LIBDIR		Base path for library installation.  [/usr/lib]
450
451LINTLIBDIR	Base path for lint(1) library installation.  [/usr/libdata/lint]
452
453LIBGRP		Library group.  [${BINGRP}]
454
455LIBOWN		Library owner.  [${BINOWN}]
456
457LIBMODE		Library mode.  [${NONBINMODE}]
458
459DOCDIR		Base path for system documentation (e.g. PSD, USD, etc.)
460	        installation.  [/usr/share/doc]
461
462HTMLDOCDIR	Base path for html system documentation installation.
463		[/usr/share/doc/html]
464
465DOCGRP		Documentation group.  [wheel]
466
467DOCOWN		Documentation owner.  [root]
468
469DOCMODE		Documentation mode.  [${NONBINMODE}]
470
471NLSDIR		Base path for Native Language Support files installation.
472		[/usr/share/nls]
473
474NLSGRP		Native Language Support files group.  [wheel]
475
476NLSOWN		Native Language Support files owner.  [root]
477
478NLSMODE		Native Language Support files mode.  [${NONBINMODE}]
479
480X11SRCDIR	The path to the xsrc tree.  [/usr/xsrc]
481
482X11SRCDIR.xc	The path to the X11R6 xc src tree.  [${X11SRCDIR}/xfree/xc]
483
484X11SRCDIR.local	The path to the local X11R6 src tree.  [${X11SRCDIR}/local]
485
486X11ROOTDIR	Root directory of the X11 installation.  [/usr/X11R6]
487
488X11BINDIR	X11 bin directory.  [${X11ROOTDIR}/bin]
489
490X11FONTDIR	X11 font directory.  [${X11ROOTDIR}/lib/X11/fonts]
491
492X11INCDIR	X11 include directory.  [${X11ROOTDIR}/include]
493
494X11LIBDIR	X11 lib/x11 (config) directory.  [${X11ROOTDIR}/lib/X11]
495
496X11MANDIR	X11 manual directory.  [${X11ROOTDIR}/man]
497
498X11USRLIBDIR	X11 library directory.  [${X11ROOTDIR}/lib]
499
500STRIPFLAG	The flag passed to the install program to cause the binary
501		to be stripped.  This is to be used when building your
502		own install script so that the entire system can be made
503		stripped/not-stripped using a single knob.  []
504
505COPY		The flag passed to the install program to cause the binary
506		to be copied rather than moved.  This is to be used when
507		building our own install script so that the entire system
508		can either be installed with copies, or with moves using
509		a single knob.  [-c]
510
511MAKEDIRTARGET dir target [params]
512		Runs "cd $${dir} && ${MAKE} [params] $${target}",
513		displaying a "pretty" message whilst doing so.
514
515RELEASEMACHINEDIR
516		Subdirectory used below RELEASEDIR when building
517		a release.  [${MACHINE}]
518
519RELEASEMACHINE	Subdirectory or path component used for the following
520		paths:
521			distrib/${RELEASEMACHINE}
522			distrib/notes/${RELEASEMACHINE}
523			etc/etc.${RELEASEMACHINE}
524		Used when building a release.  [${MACHINE}]
525
526Additionally, the following variables may be set by <bsd.own.mk> or in a
527make configuration file to modify the behaviour of the system build
528process (default values are in brackets along with comments, if set by
529<bsd.own.mk>):
530
531USETOOLS	Indicates whether the tools specified by ${TOOLDIR} should
532		be used as part of a build in progress.
533		Supported values:
534
535		yes	Use the tools from TOOLDIR.
536			Must be set to this if cross-compiling.
537
538		no	Do not use the tools from TOOLDIR, but refuse to
539			build native compilation tool components that are
540			version-specific for that tool.
541
542		never	Do not use the tools from TOOLDIR, even when
543			building native tool components.  This is similar to
544			the traditional NetBSD build method, but does not
545			verify that the compilation tools in use are
546			up-to-date enough in order to build the tree
547			successfully.  This may cause build or runtime
548			problems when building the whole NetBSD source tree.
549
550		Default: "yes" if building all or part of a whole NetBSD
551		source tree (detected automatically); "no" otherwise
552		(to preserve traditional semantics of the <bsd.*.mk>
553		make(1) include files).
554
555OBJECT_FMT	Object file format.  [set to "ELF" on architectures that
556		use ELF -- currently all architectures].
557
558TOOLCHAIN_MISSING
559		If not "no", this indicates that the platform being built
560		does not have a working in-tree toolchain.  If the
561		${MACHINE_ARCH} in question falls into this category,
562		TOOLCHAIN_MISSING is conditionally assigned the value "yes". 
563		Otherwise, the variable is unconditionally assigned the
564		value "no".
565		If not "no", ${MKBFD}, ${MKGCC}, and ${MKGDB} are
566		unconditionally assigned the value "no".
567
568EXTERNAL_TOOLCHAIN
569		This variable is not directly set by <bsd.own.mk>, but
570		including <bsd.own.mk> is the canonical way to gain
571		access to this variable.  The variable should be defined
572		either in the user's environment or in the user's mk.conf
573		file.  If defined, this variable indicates the root of
574		an external toolchain which will be used to build the
575		tree.  For example, if a platform is a ${TOOLCHAIN_MISSING}
576		platform, EXTERNAL_TOOLCHAIN can be used to re-enable the
577		cross-compile framework.
578
579		If EXTERNAL_TOOLCHAIN is defined, ${MKGCC} is unconditionally
580		assigned the value "no", since the external version of the
581		compiler may not be able to build the library components of
582		the in-tree compiler.
583
584		NOTE: This variable is not yet used in as many places as
585		it should be.  Expect the exact semantics of this variable
586		to change in the short term as parts of the cross-compile
587		framework continue to be cleaned up.
588
589<bsd.own.mk> is generally useful when building your own Makefiles so that
590they use the same default owners etc. as the rest of the tree.
591
592
593=-=-=-=-=   bsd.dep.mk   =-=-=-=-=
594
595The include file <bsd.dep.mk> contains the default targets for building
596.depend files.  It creates .d files from entries in SRCS and DPSRCS
597that are C, C++, or Objective C source files, and builds .depend from the
598.d files.  All other files in SRCS and all of DPSRCS will be used as
599dependencies for the .d files.  In order for this to function correctly,
600it should be .included after all other .mk files and directives that may
601modify SRCS or DPSRCS.  It uses the following variables:
602
603SRCS		List of source files to build the program.
604
605DPSRCS		List of source files which are needed for generating
606		dependencies, but are not needed in ${SRCS}.
607
608
609=-=-=-=-=   bsd.files.mk   =-=-=-=-=
610
611The include file <bsd.files.mk> handles the FILES variables and is included
612from <bsd.lib.mk> and <bsd.prog.mk>, and uses the following variables:
613
614FILES		The list of files to install.
615
616CONFIGFILES	Similar semantics to FILES, except that the files
617		are installed by the `configinstall' target,
618		not the `install' target.
619		The FILES* variables documented below also apply.
620
621FILESOWN	File owner.  [${BINOWN}]
622
623FILESGRP	File group.  [${BINGRP}]
624
625FILESMODE	File mode.  [${NONBINMODE}]
626
627FILESDIR	The location to install the files.
628
629FILESNAME	Optional name to install each file as.
630
631FILESOWN_<fn>	File owner of the specific file <fn>.
632
633FILESGRP_<fn>	File group of the specific file <fn>.
634
635FILESMODE_<fn>	File mode of the specific file <fn>.
636
637FILESDIR_<fn>	The location to install the specific file <fn>.
638
639FILESNAME_<fn>	Optional name to install <fn> as.
640
641
642BUILDSYMLINKS	List of two word items:
643			lnsrc lntgt
644		For each lnsrc item, create a symlink named lntgt.
645		The lntgt symlinks are removed by the cleandir target.
646
647UUDECODE_FILES	List of files which are stored as <file>.uue in the source
648		tree. Each one will be decoded with ${TOOL_UUDECODE}.
649		The source files have a `.uue' suffix, the generated files do 
650		not.
651
652UUDECODE_FILES_RENAME_<fn>
653		Rename the output from the decode to the provided name.
654		
655		*NOTE: These files are simply decoded, with no install or other
656		       rule applying implicitly except being added to the clean
657		       target.
658
659=-=-=-=-=   bsd.gcc.mk   =-=-=-=-=
660
661The include file <bsd.gcc.mk> computes various parameters related to GCC
662support libraries.  It defines no targets.  <bsd.own.mk> MUST be included
663before <bsd.gcc.mk>.
664
665The primary users of <bsd.gcc.mk> are <bsd.prog.mk> and <bsd.lib.mk>, each
666of which need to know where to find certain GCC support libraries.
667
668The behavior of <bsd.gcc.mk> is influenced by the EXTERNAL_TOOLCHAIN variable,
669which is generally set by the user.  If EXTERNAL_TOOLCHAIN it set, then
670the compiler is asked where to find the support libraries, otherwise the
671support libraries are found in ${DESTDIR}/usr/lib.
672
673<bsd.gcc.mk> sets the following variables:
674
675_GCC_CRTBEGIN	The full path name to crtbegin.o.
676
677_GCC_CRTBEGINS	The full path name to crtbeginS.o.
678
679_GCC_CRTEND	The full path name to crtend.o.
680
681_GCC_CRTENDS	The full path name to crtendS.o.
682
683_GCC_LIBGCCDIR	The directory where libgcc.a is located.
684
685
686=-=-=-=-=   bsd.inc.mk   =-=-=-=-=
687
688The include file <bsd.inc.mk> defines the includes target and uses the
689variables:
690
691INCS		The list of include files.
692
693INCSDIR		The location to install the include files.
694
695INCSNAME	Target name of the include file, if only one; same as
696		FILESNAME, but for include files.
697
698INCSYMLINKS	Similar to SYMLINKS in <bsd.links.mk>, except that these
699		are installed in the 'includes' target and not the
700		(much later) 'install' target.
701
702INCSNAME_<file>	The name file <file> should be installed as, if not <file>,
703		same as FILESNAME_<file>, but for include files.
704
705
706=-=-=-=-=   bsd.info.mk   =-=-=-=-=
707
708The include file <bsd.info.mk> is used to generate and install GNU Info
709documentation from respective Texinfo source files.  It defines three
710implicit targets (.txi.info, .texi.info, and .texinfo.info), and uses the
711following variables:
712
713TEXINFO		List of Texinfo source files.  Info documentation will
714		consist of single files with the extension replaced by
715		.info.
716
717INFOFLAGS	Flags to pass to makeinfo.  []
718
719
720=-=-=-=-=   bsd.kernobj.mk   =-=-=-=-=
721
722The include file <bsd.kernobj.mk> defines variables related to the
723location of kernel sources and object directories.
724
725KERNSRCDIR	Is the location of the top of the kernel src.
726		[${_SRC_TOP_}/sys]
727
728KERNARCHDIR	Is the location of the machine dependent kernel sources.
729		[arch/${MACHINE}]
730
731KERNCONFDIR	Is where the configuration files for kernels are found.
732		[${KERNSRCDIR}/${KERNARCHDIR}/conf]
733
734KERNOBJDIR	Is the kernel build directory.  The kernel GENERIC for
735		instance will be compiled in ${KERNOBJDIR}/GENERIC.
736		The default value is
737		${MAKEOBJDIRPREFIX}${KERNSRCDIR}/${KERNARCHDIR}/compile
738		if it exists or the target 'obj' is being made.
739		Otherwise the default is
740		${KERNSRCDIR}/${KERNARCHDIR}/compile.
741
742It is important that Makefiles (such as those under src/distrib) that
743wish to find compiled kernels use <bsd.kernobj.mk> and ${KERNOBJDIR}
744rather than make assumptions about the location of the compiled kernel.
745
746
747=-=-=-=-=   bsd.kinc.mk   =-=-=-=-=
748
749The include file <bsd.kinc.mk> defines the many targets (includes,
750subdirectories, etc.), and is used by kernel makefiles to handle
751include file installation.  It is intended to be included alone, by
752kernel Makefiles.  It uses similar variables to <bsd.inc.mk>.
753Please see <bsd.kinc.mk> for more details, and keep the documentation
754in that file up to date.
755
756
757=-=-=-=-=   bsd.lib.mk   =-=-=-=-=
758
759The include file <bsd.lib.mk> has support for building libraries.  It has
760the same eight targets as <bsd.prog.mk>: all, clean, cleandir, depend,
761includes, install, lint, and tags.  Additionally, it has a checkver target
762which checks for installed shared object libraries whose version is greater
763that the version of the source. It has a limited number of suffixes,
764consistent with the current needs of the BSD tree.  <bsd.lib.mk> includes
765<bsd.shlib.mk> to get shared library parameters.
766
767It sets/uses the following variables:
768
769LIB		The name of the library to build.
770
771LIBDIR		Target directory for libraries.
772
773SHLIBINSTALLDIR	Target directory for shared libraries if ${USE_SHLIBDIR}
774		is not "no".
775
776USE_SHLIBDIR	If not "no", use ${SHLIBINSTALLDIR} instead of ${LIBDIR}
777		as the path to install shared libraries to.
778		USE_SHLIBDIR must be defined before <bsd.own.mk> is included.
779		Default: no
780
781LIBISPRIVATE	If not "no", act as "MKDEBUGLIB=no MKLINT=no MKPIC=no
782		MKPROFILE=no", and don't install the (.a) library.
783		This is useful for "build only" helper libraries.
784		Default: no
785
786LINTLIBDIR	Target directory for lint libraries.
787
788LIBGRP		Library group.
789
790LIBOWN		Library owner.
791
792LIBMODE		Library mode.
793
794LDADD		Additional loader objects.
795
796MAN		The manual pages to be installed (use a .1 - .9 suffix).
797
798NOCHECKVER_<library>
799NOCHECKVER	If set, disables checking for installed shared object
800		libraries with versions greater than the source.  A
801		particular library name, without the "lib" prefix, may
802		be appended to the variable name to disable the check for
803		only that library.
804
805SRCS		List of source files to build the library.  Suffix types
806		.s, .c, and .f are supported.  Note, .s files are preferred
807		to .c files of the same name.  (This is not the default for
808		versions of make.)
809
810LIBDPLIBS	A list of the tuples:
811			libname  path-to-srcdir-of-libname
812
813		For each tuple;
814		     *	LIBDO.libname contains the .OBJDIR of the library
815			`libname', and if it is not set it is determined
816			from the srcdir and added to MAKEOVERRIDES (the
817			latter is to allow for build time optimization).
818		     *	LDADD gets  -L${LIBDO.libname} -llibname    added.
819		     *	DPADD gets  ${LIBDO.libname}/liblibname.so  or
820				    ${LIBDO.libname}/liblibname.a   added.
821
822		This variable may be used for individual libraries, as
823		well as in parent directories to cache common libraries 
824		as a build-time optimization.
825
826The include file <bsd.lib.mk> includes the file named "../Makefile.inc"
827if it exists, as well as the include file <bsd.man.mk>.
828
829It has rules for building profiled objects; profiled libraries are
830built by default.
831
832Libraries are ranlib'd when made.
833
834
835=-=-=-=-=   bsd.links.mk   =-=-=-=-=
836
837The include file <bsd.links.mk> handles the LINKS and SYMLINKS variables
838and is included from from <bsd.lib.mk> and <bsd.prog.mk>.
839
840LINKS		The list of hard links, consisting of pairs of paths:
841			source-file target-file
842		${DESTDIR} is prepended to both paths before linking.
843		For example, to link /bin/test and /bin/[, use:
844			LINKS=/bin/test /bin/[
845
846CONFIGLINKS	Similar semantics to LINKS, except that the links
847		are installed by the `configinstall' target,
848		not the `install' target.
849
850SYMLINKS	The list of symbolic links, consisting of pairs of paths:
851			source-file target-file
852		${DESTDIR} is only prepended to target-file before linking.
853		For example, to symlink /usr/bin/tar to /bin/tar resulting
854		in ${DESTDIR}/usr/bin/tar -> /bin/tar:
855			SYMLINKS=/bin/tar /usr/bin/tar
856
857CONFIGSYMLINKS	Similar semantics to SYMLINKS, except that the symbolic links
858		are installed by the `configinstall' target,
859		not the `install' target.
860
861
862=-=-=-=-=   bsd.man.mk   =-=-=-=-=
863
864The include file <bsd.man.mk> handles installing manual pages and their
865links.
866
867It has a two targets:
868
869	maninstall:
870		Install the manual page sources and their links.
871	catinstall:
872		Install the preformatted manual pages and their links.
873
874It sets/uses the following variables:
875
876MANDIR		Base path for manual installation.
877
878MANGRP		Manual group.
879
880MANOWN		Manual owner.
881
882MANMODE		Manual mode.
883
884MANSUBDIR	Subdirectory under the manual page section, i.e. "/vax"
885		or "/tahoe" for machine specific manual pages.
886
887MAN		The manual pages to be installed (use a .1 - .9 suffix).
888
889MLINKS		List of manual page links (using a .1 - .9 suffix).  The
890		linked-to file must come first, the linked file second,
891		and there may be multiple pairs.  The files are soft-linked.
892
893The include file <bsd.man.mk> includes a file named "../Makefile.inc" if
894it exists.
895
896
897=-=-=-=-=   bsd.obj.mk   =-=-=-=-=
898
899The include file <bsd.obj.mk> defines targets related to the creation
900and use of separated object and source directories.
901
902If an environment variable named MAKEOBJDIRPREFIX is set, make(1) uses
903${MAKEOBJDIRPREFIX}${.CURDIR} as the name of the object directory if
904it exists.  Otherwise make(1) looks for the existence of a
905subdirectory (or a symlink to a directory) of the source directory
906into which built targets should be placed.  If an environment variable
907named MAKEOBJDIR is set, make(1) uses its value as the name of the
908object directory; failing that, make first looks for a subdirectory
909named "obj.${MACHINE}", and if that doesn't exist, it looks for "obj".
910
911Object directories are not created automatically by make(1) if they
912don't exist; you need to run a separate "make obj".  (This will happen
913during a top-level build if "MKOBJDIRS" is set to a value other than
914"no").  When the source directory is a subdirectory of ${BSDSRCDIR} --
915and this is determined by a simple string prefix comparison -- object
916directories are created in a separate object directory tree, and a
917symlink to the object directory in that tree is created in the source
918directory; otherwise, "make obj" assumes that you're not in the main
919source tree and that it's not safe to use a separate object tree.
920
921Several variables used by <bsd.obj.mk> control exactly what
922directories and links get created during a "make obj":
923
924MAKEOBJDIR	If set, this is the component name of the object
925		directory.
926
927OBJMACHINE	If this is set but MAKEOBJDIR is not set, creates
928		object directories or links named "obj.${MACHINE}";
929		otherwise, just creates ones named "obj".
930
931USR_OBJMACHINE  If set, and the current directory is a subdirectory of
932		${BSDSRCDIR}, create object directory in the
933		corresponding subdirectory of ${BSDOBJDIR}.${MACHINE};
934		otherwise, create it in the corresponding subdirectory
935		of ${BSDOBJDIR}
936
937BUILDID		If set, the contents of this variable are appended
938		to the object directory name.  If OBJMACHINE is also
939		set, ".${BUILDID}" is added after ".${MACHINE}".
940
941
942=-=-=-=-=   bsd.prog.mk   =-=-=-=-=
943
944The include file <bsd.prog.mk> handles building programs from one or
945more source files, along with their manual pages.  It has a limited number
946of suffixes, consistent with the current needs of the BSD tree. 
947<bsd.prog.mk> includes <bsd.shlib.mk> to get shared library parameters.
948
949It has eight targets:
950
951	all:
952		build the program and its manual page.  This also
953		creates a GDB initialization file (.gdbinit) in
954		the objdir.  The .gdbinit file sets the shared library
955		prefix to ${DESTDIR} to facilitate cross-debugging.
956	clean:
957		remove the program, any object files and the files a.out,
958		Errs, errs, mklog, and ${PROG}.core.
959	cleandir:
960		remove all of the files removed by the target clean, as
961		well as .depend, tags, and any manual pages.
962		`distclean' is a synonym for `cleandir'.
963	depend:
964		make the dependencies for the source files, and store
965		them in the file .depend.
966	includes:
967		install any header files.
968	install:
969		install the program and its manual pages; if the Makefile
970		does not itself define the target install, the targets
971		beforeinstall and afterinstall may also be used to cause
972		actions immediately before and after the install target
973		is executed.
974	lint:
975		run lint on the source files
976	tags:
977		create a tags file for the source files.
978
979It sets/uses the following variables:
980
981BINGRP		Binary group.
982
983BINOWN		Binary owner.
984
985BINMODE		Binary mode.
986
987CLEANFILES	Additional files to remove for the clean and cleandir targets.
988
989COPTS		Additional flags to the compiler when creating C objects.
990
991COPTS.<fn>	Additional flags to the compiler when creating the
992		C objects for <fn>.
993		For <fn>.[ly], "<fn>.c" must be used.
994
995CPUFLAGS	Additional flags to the compiler/assembler to select
996		CPU instruction set options, CPU tuning options, etc.
997
998CPUFLAGS.<fn>	Additional flags to the compiler/assembler for <fn>.
999		For <fn>.[ly], "<fn>.c" must be used.
1000
1001CPPFLAGS	Additional flags to the C pre-processor.
1002
1003CPPFLAGS.<fn>	Additional flags to the C pre-processor for <fn>.
1004		For <fn>.[ly], "<fn>.c" must be used.
1005
1006GDBINIT		List of GDB initialization files to add to "source"
1007		directives in the .gdbinit file that is created in the
1008		objdir.
1009
1010LDADD		Additional loader objects.  Usually used for libraries.
1011		For example, to load with the compatibility and utility
1012		libraries, use:
1013
1014			LDADD+=-lutil -lcompat
1015
1016LDFLAGS		Additional linker flags (passed to ${CC} during link).
1017
1018LINKS		See <bsd.links.mk>
1019
1020OBJCOPTS	Additional flags to the compiler when creating ObjC objects.
1021
1022OBJCOPTS.<fn>	Additional flags to the compiler when creating the
1023		ObjC objects for <fn>.
1024		For <fn>.[ly], "<fn>.c" must be used.
1025
1026SYMLINKS	See <bsd.links.mk>
1027
1028MAN		Manual pages (should end in .1 - .9).  If no MAN variable is
1029		defined, "MAN=${PROG}.1" is assumed.
1030
1031PAXCTL_FLAGS	If defined, run paxctl(1) on the program binarry after link
1032		time, with the value of this variable as args to paxctl(1).
1033
1034PAXCTL_FLAGS.${PROG} Custom override for PAXCTL_FLAGS.
1035
1036PROG		The name of the program to build.  If not supplied, nothing
1037		is built.
1038
1039PROG_CXX	If defined, the name of the program to build.  Also
1040		causes <bsd.prog.mk> to link the program with the C++
1041		compiler rather than the C compiler.  PROG_CXX overrides
1042		the value of PROG if PROG is also set.
1043
1044PROGNAME	The name that the above program will be installed as, if
1045		different from ${PROG}.
1046
1047SRCS		List of source files to build the program.  If SRCS is not
1048		defined, it's assumed to be ${PROG}.c.
1049
1050DPSRCS		List of source files which are needed for generating
1051		dependencies, but are not needed in ${SRCS}.
1052
1053DPADD		Additional dependencies for the program.  Usually used for
1054		libraries.  For example, to depend on the compatibility and
1055		utility libraries use:
1056
1057			DPADD+=${LIBCOMPAT} ${LIBUTIL}
1058
1059		The following libraries are predefined for DPADD:
1060
1061		LIBCRT0?=	${DESTDIR}/usr/lib/crt0.o
1062		LIBARCHIVE?=	${DESTDIR}/usr/lib/libarchive.a
1063		LIBASN1?=	${DESTDIR}/usr/lib/libasn1.a
1064		LIBBLUETOOTH?=	${DESTDIR}/usr/lib/libbluetooth.a
1065		LIBBSDMALLOC?=	${DESTDIR}/usr/lib/libbsdmalloc.a
1066		LIBBZ2?=	${DESTDIR}/usr/lib/libbz2.a
1067		LIBC?=		${DESTDIR}/usr/lib/libc.a
1068		LIBC_PIC?=	${DESTDIR}/usr/lib/libc_pic.a
1069		LIBCOM_ERR?=	${DESTDIR}/usr/lib/libcom_err.a
1070		LIBCOMPAT?=	${DESTDIR}/usr/lib/libcompat.a
1071		LIBCRYPT?=	${DESTDIR}/usr/lib/libcrypt.a
1072		LIBCRYPTO?=	${DESTDIR}/usr/lib/libcrypto.a
1073		LIBCRYPTO_IDEA?=${DESTDIR}/usr/lib/libcrypto_idea.a
1074		LIBCRYPTO_MDC2?=${DESTDIR}/usr/lib/libcrypto_mdc2.a
1075		LIBCRYPTO_RC5?=	${DESTDIR}/usr/lib/libcrypto_rc5.a
1076		LIBCURSES?=	${DESTDIR}/usr/lib/libcurses.a
1077		LIBDBM?=	${DESTDIR}/usr/lib/libdbm.a
1078		LIBDES?=	${DESTDIR}/usr/lib/libdes.a
1079		LIBEDIT?=	${DESTDIR}/usr/lib/libedit.a
1080		LIBEVENT?=	${DESTDIR}/usr/lib/libevent.a
1081		LIBFORM?=	${DESTDIR}/usr/lib/libform.a
1082		LIBGCC?=	${DESTDIR}/usr/lib/libgcc.a
1083		LIBGNUMALLOC?=	${DESTDIR}/usr/lib/libgnumalloc.a
1084		LIBGSSAPI?=	${DESTDIR}/usr/lib/libgssapi.a
1085		LIBHDB?=	${DESTDIR}/usr/lib/libhdb.a
1086		LIBINTL?=	${DESTDIR}/usr/lib/libintl.a
1087		LIBIPSEC?=	${DESTDIR}/usr/lib/libipsec.a
1088		LIBKADM5CLNT?=	${DESTDIR}/usr/lib/libkadm5clnt.a
1089		LIBKADM5SRV?=	${DESTDIR}/usr/lib/libkadm5srv.a
1090		LIBKAFS?=	${DESTDIR}/usr/lib/libkafs.a
1091		LIBKRB5?=	${DESTDIR}/usr/lib/libkrb5.a
1092		LIBKVM?=	${DESTDIR}/usr/lib/libkvm.a
1093		LIBL?=		${DESTDIR}/usr/lib/libl.a
1094		LIBLBER?=	${DESTDIR}/usr/lib/liblber.a
1095		LIBLDAP?=	${DESTDIR}/usr/lib/libldap.a
1096		LIBLDAP_R?=	${DESTDIR}/usr/lib/libldap_r.a
1097		LIBM?=		${DESTDIR}/usr/lib/libm.a
1098		LIBMENU?=	${DESTDIR}/usr/lib/libmenu.a
1099		LIBOBJC?=	${DESTDIR}/usr/lib/libobjc.a
1100		LIBOSSAUDIO?=	${DESTDIR}/usr/lib/libossaudio.a
1101		LIBPAM?=	${DESTDIR}/usr/lib/libpam.a
1102		LIBPCAP?=	${DESTDIR}/usr/lib/libpcap.a
1103		LIBPCI?=	${DESTDIR}/usr/lib/libpci.a
1104		LIBPMC?=	${DESTDIR}/usr/lib/libpmc.a
1105		LIBPOSIX?=	${DESTDIR}/usr/lib/libposix.a
1106		LIBPTHREAD?=	${DESTDIR}/usr/lib/libpthread.a
1107		LIBPTHREAD_DBG?=${DESTDIR}/usr/lib/libpthread_dbg.a
1108		LIBRADIUS?=	${DESTDIR}/usr/lib/libradius.a
1109		LIBRESOLV?=	${DESTDIR}/usr/lib/libresolv.a
1110		LIBRMT?=	${DESTDIR}/usr/lib/librmt.a
1111		LIBROKEN?=	${DESTDIR}/usr/lib/libroken.a
1112		LIBRPCSVC?=	${DESTDIR}/usr/lib/librpcsvc.a
1113		LIBRT?=		${DESTDIR}/usr/lib/librt.a
1114		LIBSDP?=	${DESTDIR}/usr/lib/libsdp.a
1115		LIBSKEY?=	${DESTDIR}/usr/lib/libskey.a
1116		LIBSL?=		${DESTDIR}/usr/lib/libsl.a
1117		LIBSS?=		${DESTDIR}/usr/lib/libss.a
1118		LIBSSH?=	${DESTDIR}/usr/lib/libssh.a
1119		LIBSSL?=	${DESTDIR}/usr/lib/libssl.a
1120		LIBSSP?=	${DESTDIR}/usr/lib/libssp.a
1121		LIBSTDCXX?=	${DESTDIR}/usr/lib/libstdc++.a
1122		LIBSUPCXX?=	${DESTDIR}/usr/lib/libsupc++.a
1123		LIBTERMCAP?=	${DESTDIR}/usr/lib/libtermcap.a
1124		LIBUSBHID?=	${DESTDIR}/usr/lib/libusbhid.a
1125		LIBUTIL?=	${DESTDIR}/usr/lib/libutil.a
1126		LIBWRAP?=	${DESTDIR}/usr/lib/libwrap.a
1127		LIBY?=		${DESTDIR}/usr/lib/liby.a
1128		LIBZ?=		${DESTDIR}/usr/lib/libz.a
1129
1130SHAREDSTRINGS	If defined, a new .c.o rule is used that results in shared
1131		strings, using xstr(1). Note that this will not work with
1132		parallel makes.
1133
1134STRIPFLAG	The flag passed to the install program to cause the binary
1135		to be stripped.
1136
1137SUBDIR		A list of subdirectories that should be built as well.
1138		Each of the targets will execute the same target in the
1139		subdirectories.
1140
1141SCRIPTS		A list of interpreter scripts [file.{sh,csh,pl,awk,...}].
1142		These are installed exactly like programs.
1143
1144SCRIPTSDIR	The location to install the scripts.  Each script can be
1145		installed to a separate path by setting SCRIPTSDIR_<script>.
1146
1147SCRIPTSNAME	The name that the above program will be installed as, if
1148		different from ${SCRIPTS}. These can be further specialized
1149		by setting SCRIPTSNAME_<script>.
1150
1151FILES		See description of <bsd.files.mk>.
1152
1153SHLINKDIR	Target directory for shared linker.  See description of
1154		<bsd.own.mk> for additional information about this variable.
1155
1156The include file <bsd.prog.mk> includes the file named "../Makefile.inc"
1157if it exists, as well as the include file <bsd.man.mk>.
1158
1159Some simple examples:
1160
1161To build foo from foo.c with a manual page foo.1, use:
1162
1163	PROG=	foo
1164
1165	.include <bsd.prog.mk>
1166
1167To build foo from foo.c with a manual page foo.2, add the line:
1168
1169	MAN=	foo.2
1170
1171If foo does not have a manual page at all, add the line:
1172
1173	MKMAN=	no
1174
1175If foo has multiple source files, add the line:
1176
1177	SRCS=	a.c b.c c.c d.c
1178
1179
1180=-=-=-=-=   bsd.rpc.mk   =-=-=-=-=
1181
1182The include file <bsd.rpc.mk> contains a makefile fragment used to
1183construct source files built by rpcgen.
1184
1185The following macros may be defined in makefiles which include
1186<bsd.rpc.mk> in order to control which files get built and how they
1187are to be built:
1188
1189RPC_INCS:	construct .h file from .x file
1190RPC_XDRFILES:	construct _xdr.c from .x file
1191		(for marshalling/unmarshalling data types)
1192RPC_SVCFILES:	construct _svc.c from .x file
1193		(server-side stubs)
1194RPC_SVCFLAGS:	Additional flags passed to builds of RPC_SVCFILES.
1195
1196RPC_XDIR:	Directory containing .x/.h files
1197
1198
1199=-=-=-=-=   bsd.shlib.mk   =-=-=-=-=
1200
1201The include file <bsd.shlib.mk> computes parameters for shared library
1202installation and use.  It defines no targets.  <bsd.own.mk> MUST be
1203included before <bsd.shlib.mk>.
1204
1205<bsd.own.mk> sets the following variables, if they are not already defined
1206(defaults are in brackets):
1207
1208SHLIBINSTALLDIR	If ${USE_SHLIBDIR} is not "no", use ${SHLIBINSTALLDIR}
1209		instead of ${LIBDIR} as the base path for shared library
1210		installation.  [/lib]
1211
1212SHLIBDIR	The path to USE_SHLIBDIR shared libraries to use when building
1213		a program.  [/lib for programs in /bin and /sbin, /usr/lib
1214		for all others.]
1215
1216_LIBSODIR	Set to ${SHLIBINSTALLDIR} if ${USE_SHLIBDIR} is not "no",
1217		otherwise set to ${LIBDIR}
1218
1219SHLINKINSTALLDIR Base path for shared linker.  [/libexec]
1220
1221SHLINKDIR	Path to use for shared linker when building a program.
1222		[/libexec for programs in /bin and /sbin, /usr/libexec for
1223		all others.]
1224
1225
1226=-=-=-=-=   bsd.subdir.mk   =-=-=-=-=
1227
1228The include file <bsd.subdir.mk> contains the default targets for building
1229subdirectories.  It has the same eight targets as <bsd.prog.mk>: all,
1230clean, cleandir, depend, includes, install, lint, and tags.  For all of
1231the directories listed in ${SUBDIR}, the specified directory will be
1232visited and the target made.  There is also a default target which allows
1233the command "make subdir" where subdir is any directory listed in ${SUBDIR}.
1234
1235As a special case, the use of a token .WAIT as an entry in SUBDIR acts
1236as a synchronization barrier when multiple make jobs are run; subdirs
1237before the .WAIT must complete before any subdirs after .WAIT are
1238started.  See make(1) for some caveats on use of .WAIT and other
1239special sources.
1240
1241
1242=-=-=-=-=   bsd.sys.mk   =-=-=-=-=
1243
1244The include file <bsd.sys.mk> is used by <bsd.prog.mk> and
1245<bsd.lib.mk>.  It contains overrides that are used when building
1246the NetBSD source tree.
1247
1248The following variables control how various files are compiled/built.
1249(Note that these may be overridden in <bsd.own.mk> if USETOOLS == "yes"):
1250
1251AR		Create, modify, and extract from archives.  [ar]
1252
1253ARFLAGS		Options to ${AR}.  [rl]
1254
1255AS		Assembler.  [as]
1256
1257AFLAGS		Options to ${CC} when compiling or linking .s or .S
1258		assembly source files.  []
1259
1260CC		C compiler.  [cc]
1261
1262CFLAGS		Options to ${CC}.  [Usually -O or -O2]
1263
1264CPP		C Pre-Processor.  [cpp]
1265
1266CPPFLAGS	Options to ${CPP}.  []
1267
1268CPUFLAGS	Optimization flags for ${CC}.  []
1269
1270CXX		C++ compiler.  [c++]
1271
1272CXXFLAGS	Options to ${CXX}.  [${CFLAGS}]
1273
1274ELF2ECOFF	Convert ELF-format executable to ECOFF.  [elf2ecoff]
1275
1276FC		Fortran compiler.  [f77]
1277
1278FFLAGS		Options to {$FC}.  [-O]
1279
1280INSTALL		install(1) command.  [install]
1281
1282LEX		Lexical analyzer.  [lex]
1283
1284LFLAGS		Options to ${LEX}.  []
1285
1286LPREFIX		Symbol prefix for ${LEX} (see -P option in lex(1)) [yy]
1287
1288LD		Linker.  [ld]
1289
1290LDFLAGS		Options to ${CC} during the link process.  []
1291
1292LINT		C program verifier.  [lint]
1293
1294LINTFLAGS	Options to ${LINT}.  [-chapbxzFS]
1295
1296LORDER		List dependencies for object files.  [lorder]
1297
1298MAKE		make(1).  [make]
1299
1300MKDEP		Construct Makefile dependency list.  [mkdep]
1301
1302NM		List symbols from object files.  [nm]
1303
1304PC		Pascal compiler.  [pc]  (Not present)
1305
1306PFLAGS		Options to ${PC}.  []
1307
1308OBJC		Objective C compiler.  [${CC}]
1309
1310OBJCFLAGS	Options to ${OBJC}.  [${CFLAGS}]
1311
1312OBJCOPY		Copy and translate object files.  [objcopy]
1313
1314OBJDUMP		Display information from object files.  [objdump]
1315
1316RANLIB		Generate index to archive.  [ranlib]
1317
1318SHELL		Shell.  [sh]
1319
1320SIZE		List section sizes and total size.  [size]
1321
1322STRIP		Discard symbols from object files.  [strip]
1323
1324TSORT		Topological sort of a directed graph.  [tsort -q]
1325
1326YACC		LALR(1) parser generator.  [yacc]
1327
1328YFLAGS		Options to ${YACC}.  []
1329
1330YHEADER		If defined, add "-d" to YFLAGS, and add dependencies
1331		from <file>.y to <file>.h and <file>.c, and add
1332		<foo>.h to CLEANFILES.
1333
1334YPREFIX		If defined, add "-p ${YPREFIX}" to YFLAGS.
1335
1336
1337The following variables are defined to commands to perform the
1338appropriate operation, with the default in [brackets].
1339(Note that these are overridden in <bsd.own.mk> if USETOOLS == "yes"):
1340
1341TOOL_ASN1_COMPILE	ASN1 compiler.  [asn1_compile]
1342
1343TOOL_CAP_MKDB		Create capability database.  [cap_mkdb]
1344
1345TOOL_CAT		Concatenate and print files.  [cat]
1346
1347TOOL_CKSUM		Display file checksums.  [cksum]
1348
1349TOOL_COMPILE_ET		Error table compiler.  [compile_et]
1350
1351TOOL_CONFIG		Build kernel compilation directories.  [config]
1352
1353TOOL_CRUNCHGEN		Generate crunched binary build environment.  [crunchgen]
1354
1355TOOL_CTAGS		Create a tags file.  [ctags]
1356
1357TOOL_DB			Manipulate db(3) databases.  [db]
1358
1359TOOL_EQN		Format equations for groff.  [eqn]
1360
1361TOOL_FGEN		IEEE 1275 Open Firmware FCode Tokenizer.  [fgen]
1362
1363TOOL_GENASSYM		Generate constants for assembly files.  [genassym]
1364
1365TOOL_GENCAT		Generate NLS message catalogs.  [gencat]
1366
1367TOOL_GROFF		Front end for groff document formatting system.  [groff]
1368
1369TOOL_HEXDUMP		Ascii, decimal, hexadecimal, octal dump.  [hexdump]
1370
1371TOOL_INDXBIB		Make bibliographic database's inverted index.  [indxbib]
1372
1373TOOL_INSTALLBOOT	Install disk bootstrap software.  [installboot]
1374
1375TOOL_INSTALL_INFO	Update info/dir entries.  [install-info]
1376
1377TOOL_JOIN		Relational database operator.  [join]
1378
1379TOOL_M4			M4 macro language processor.  [m4]
1380
1381TOOL_MAKEFS		Create file system image from directory tree.  [makefs]
1382
1383TOOL_MAKEINFO		Translate Texinfo documents.  [makeinfo]
1384
1385TOOL_MAKEWHATIS		Create a whatis.db database.  [makewhatis]
1386
1387TOOL_MDSETIMAGE		Set kernel RAM disk image.  [mdsetimage]
1388
1389TOOL_MENUC		Menu compiler.  [menuc]
1390
1391TOOL_MKCSMAPPER		Make charset mapping table.  [mkcsmapper]
1392
1393TOOL_MKESDB		Make encoding scheme database.  [mkesdb]
1394
1395TOOL_MKLOCALE		Make LC_CTYPE locale files.  [mklocale]
1396
1397TOOL_MKMAGIC		Create database for file(1).  [file]
1398
1399TOOL_MKTEMP		Make (unique) temporary file name.  [mktemp]
1400
1401TOOL_MSGC		Simple message list compiler.  [msgc]
1402
1403TOOL_MTREE		Map a directory hierarchy.  [mtree]
1404
1405TOOL_PAX		Manipulate file archives and copy directories.  [pax]
1406
1407TOOL_PIC		Compile pictures for groff.  [pic]
1408
1409TOOL_POWERPCMKBOOTIMAGE	powerpc-mkbootimage (XXXBUILDSH).  [powerpc-mkbootimage]
1410
1411TOOL_PWD_MKDB		Generate the password databases.  [pwd_mkdb]
1412
1413TOOL_REFER		Preprocess bibliographic references for groff.  [refer]
1414
1415TOOL_ROFF_ASCII		Generate ASCII groff output.  [nroff]
1416
1417TOOL_ROFF_DVI		Generate DVI groff output.  [${TOOL_GROFF} -Tdvi]
1418
1419TOOL_ROFF_HTML		Generate HTML groff output.
1420			[${TOOL_GROFF} -Tlatin1 -mdoc2html]
1421
1422TOOL_ROFF_PS		Generate PS groff output.  [${TOOL_GROFF} -Tps]
1423
1424TOOL_ROFF_RAW		Generate "raw" groff output.  [${TOOL_GROFF} -Z]
1425
1426TOOL_RPCGEN		Remote Procedure Call (RPC) protocol compiler.  [rpcgen]
1427
1428TOOL_SOELIM		Eliminate .so's from groff input.  [soelim]
1429
1430TOOL_STAT		Display file status.  [stat]
1431
1432TOOL_SUNLABEL		Read or modify a SunOS disk label.  [sunlabel]
1433
1434TOOL_TBL		Format tables for groff.  [tbl]
1435
1436TOOL_UUDECODE		Uudecode a binary file.  [uudecode]
1437
1438TOOL_VGRIND		Grind nice listings of programs.  [vgrind -f]
1439
1440TOOL_ZIC		Time zone compiler.  [zic]
1441
1442
1443Other variables of note (incomplete list):
1444
1445NOGCCERROR	If defined, prevents passing certain ${CFLAGS} to GCC
1446		that cause warnings to be fatal, such as:
1447			-Werror -Wa,--fatal-warnings
1448		(The latter being for as(1).)
1449
1450WARNS		Crank up GCC warning options; the distinct levels are:
1451			WARNS=1
1452			WARNS=2
1453			WARNS=3
1454			WARNS=4
1455
1456=-=-=-=-=   bsd.x11.mk   =-=-=-=-=
1457
1458The include file <bsd.x11.mk> contains parameters and targets for
1459cross-building X11R6 from ${X11SRCDIR.xc}.
1460It should be included after the general Makefile contents but before
1461the include files such as <bsd.prog.mk> and <bsd.lib.mk>.
1462
1463It provides the following targets:
1464	.man.1 .man.3 .man.4 .man.5 .man.7:
1465		If ${MAN} or ${PROG} is set and ${MKMAN} != "no",
1466		these rules convert from X11R6's manual page source
1467		into an mdoc.old source file.
1468	cleanx11man:
1469		Clean up the mdoc.old files generated by the above.
1470
1471It sets the following variables:
1472
1473BINDIR			Set to ${X11BINDIR}.
1474			To override, define after including <bsd.x11.mk>
1475
1476LIBDIR			Set to ${X11USRLIBDIR}.
1477			To override, define after including <bsd.x11.mk>
1478
1479MANDIR			Set to ${X11MANDIR}.
1480			To override, define after including <bsd.x11.mk>
1481
1482CPPFLAGS		Appended with definitions to include from
1483			${DESTDIR}${X11INCDIR}
1484
1485LDFLAGS			Appended with definitions to link from
1486			${DESTDIR}${X11USRLIBDIR}
1487
1488X11FLAGS.CONNECTION	Equivalent to X11R6's CONNECTION_FLAGS.
1489
1490X11FLAGS.EXTENSION	Equivalent to X11R6's EXT_DEFINES.
1491
1492X11FLAGS.LOADABLE	Equivalent to X11R6's LOADABLE.
1493
1494X11FLAGS.OS_DEFINES	Equivalent to X11R6's OS_DEFINES.
1495
1496X11FLAGS.SERVER		Equivalent to X11R6's ServerDefines.
1497
1498X11FLAGS.THREADLIB	Equivalent to X11R6's THREADS_DEFINES for libraries.
1499
1500X11FLAGS.THREADS	Equivalent to X11R6's THREADS_DEFINES.
1501
1502X11FLAGS.VERSION	cpp(1) definitions of OSMAJORVERSION and OSMINORVERSION.
1503
1504X11TOOL_UNXCOMM		Commandline to convert `XCOMM' comments to `#'
1505
1506It uses the following variables:
1507
1508APPDEFS			List of app-default files to install.
1509
1510CPPSCRIPTS		List of files/scripts to run through cpp(1)
1511			and then ${X11TOOL_UNXCOMM}.  The source files
1512			have a `.cpp' suffix, the generated files do not.
1513
1514CPPSCRIPTFLAGS		Additional flags to cpp(1) when building CPPSCRIPTS.
1515
1516CPPSCRIPTFLAGS_<fn>	Additional flags to cpp(1) when building CPPSCRIPT <fn>.
1517
1518
1519=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1520