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