bsd.README revision 1.140
1#	$NetBSD: bsd.README,v 1.140 2003/09/29 01:06:37 lukem Exp $
2#	@(#)bsd.README	8.2 (Berkeley) 4/2/94
3
4This is the README file for the new make "include" files for the BSD
5source tree.  The files are installed in /usr/share/mk, and are, by
6convention, 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.  Basic rule for
62the variable naming scheme is as follows:
63
64MKxxx		Can be set to "no" to disable functionality, or
65		"yes" to enable it.
66		Usually defaults to "yes", although some variables
67		default to "no".
68		Due to make(1) implementation issues, if a temporary
69		command-line override of a mk.conf or <bsd.own.mk> setting
70		is required whilst still honouring a particular
71		Makefile's setting of MKxxx, use
72			env MKxxx=value make
73		instead of
74			make MKxxx=value
75
76NOxxx		If defined, disables a feature.
77		Not intended for users.
78		This is to allow Makefiles to disable functionality
79		that they don't support (such as missing man pages).
80		NOxxx variables must be defined before <bsd.own.mk>
81		is included.
82
83The following variables that control how things are made/installed that
84are not set by default. These should not be set by Makefiles; they're for
85the user to define in MAKECONF (see <bsd.own.mk>, below) or on the make(1)
86command line:
87
88BUILD 		If defined, 'make install' checks that the targets in the
89		source directories are up-to-date and remakes them if they
90                are out of date, instead of blindly trying to install
91                out of date or non-existent targets.
92
93MKBFD		If "no", don't build libbfd, libiberty, or any of the things
94		that depend on them (binutils/gas/ld, gdb, dbsym, mdsetimage).
95		Default: yes
96
97MKCATPAGES	If "no", don't build or install the catman pages.
98		Default: yes
99
100MKCRYPTO	If "no", no cryptography support will be built into the system,
101		and also acts as MKKERBEROS=no MKKERBEROS4=no.
102		Default: yes
103
104MKCRYPTO_IDEA	If not "no", IDEA support will be built into libcrypto_idea.a.
105		Default: no
106
107MKCRYPTO_MDC2	If not "no", MDC2 support will be built into libcrypto_mdc2.a
108		Default: no
109
110MKCRYPTO_RC5	If not "no", RC5 support will be built into libcrypto_rc5.a.
111		Default: no
112
113MKDOC		If "no", don't build or install the documentation.
114		Default: yes
115
116MKDYNAMICROOT	If "no", build programs in /bin and /sbin statically,
117		don't install certain libraries in /lib, and don't
118		install the shared linker into /libexec.
119		Default: yes
120
121MKGCC		If "no", don't build gcc or any of the gcc-related
122		libraries (libg2c, libgcc, libobjc, libstdc++).
123		Default: yes
124
125MKGDB		If "no", don't build gdb.
126		Default: yes
127
128MKHESIOD	If "no", disables building of Hesiod infrastructure
129		(libraries and support programs).
130		Default: yes
131
132MKHOSTOBJ	If "yes", for programs intended to be run on the compile host,
133		the name, release, and architecture of the host operating
134		system will be suffixed to the name of the object directory
135		created by "make obj".
136		Default: no
137
138MKHTML		If "no", don't build or install the html man pages.
139		Default: yes
140
141MKIEEEFP	If "no", don't add code for IEEE754/IEC60559 conformance.
142		Has no effect on most platforms.
143		Default: yes
144
145MKINFO		If "no", don't build or install Info documentation from
146		Texinfo source files.
147		Default: yes
148
149MKKERBEROS4	If "no", disables building of Kerberos v4
150		infrastructure (libraries and support programs).
151		Default: yes
152
153MKKERBEROS	If "no", disables building of Kerberos v5
154		infrastructure (libraries and support programs).
155		Default: yes
156
157MKLINKLIB	If "no", act as "MKPICINSTALL=no MKPROFILE=no".
158		Also:
159			- don't install the .a libraries
160			- don't install _pic.a libraries on PIC systems
161			- don't build .a libraries on PIC systems
162			- don't install the .so symlink on ELF systems
163		I.e, only install the shared library (and the .so.major
164		symlink on ELF).
165		Default: yes
166
167MKLINT		If "no", don't build or install the lint libraries.
168		Default: yes
169
170MKMAN		If "no", don't build or install the man or catman pages,
171		and also acts as "MKCATPAGES=no MKHTML=no"
172		Default: yes
173
174MKMANZ		If not "no", compress manual pages at installation time.
175		Default: no
176
177MKNLS		If "no", don't build or install the NLS files and locale
178		definition files.
179		Default: yes
180
181MKOBJ		If "no", don't enable the rule which creates objdirs,
182		and also acts as "MKOBJDIRS=no"
183		Default: yes
184
185MKOBJDIRS	If "no", don't create objdirs during a "make build".
186		Default: no
187
188MKPIC		If "no", don't build or install shared libraries, and
189		also acts as "MKPICLIB=no"
190		Default: yes, except for ${MACHINE_ARCH} == "sh3"
191
192MKPICINSTALL	If "no", don't install the *_pic.a libraries.
193		Default: yes
194
195MKPICLIB	If "no", don't build *_pic.a libraries, and build the
196		shared object libraries from the .a libraries.
197		A symlink is installed in ${DESTDIR}/usr/lib for the
198		_pic.a library pointing to the .a library.
199		Default: yes
200
201MKPROFILE	If "no", don't build or install the profiling (*_p.a) libraries.
202		Default: yes
203
204MKSHARE		If "no", act as "MKCATPAGES=no MKDOC=no MKHTML=no MKINFO=no
205		MKMAN=no MKNLS=no".
206		I.e, don't build catman pages, documentation, Info
207		documentation, man pages, NLS files, ...
208		Default: yes
209
210MKSKEY		If "no", disables building of S/key authentication
211		infrastructure (libraries and support programs).
212		Default: yes
213
214MKSOFTFLOAT	If not "no", build with options to enable the compiler to
215		generate output containing library calls for floating
216		point and possibly soft-float library support.
217		Default: no
218
219MKSTATICLIB	If "no", don't build or install the normal static (*.a)
220		libraries.
221		Default: yes
222
223MKUNPRIVED	If not "no", don't set the owner/group/mode when installing
224		files or directories, and keep a metadata log of what
225		the owner/group/mode should be.  This allows a
226		non-root "make install".
227		Default: no
228
229MKUPDATE 	If not "no", 'make install' only installs targets that are
230		more recently modified in the source directories that their
231		installed counterparts.
232		Default: no
233
234MKYP		If "no", disables building of YP (NIS)
235		infrastructure (libraries and support programs).
236		Default: yes
237
238USE_HESIOD	If "no", disables building Hesiod support into
239		various system utilities/libraries that support it.
240		If MKHESIOD is "no", USE_HESIOD will also be
241		forced to "no".
242
243USE_KERBEROS4	If "no", disables building Kerberos v4
244		support into various system utilities/libraries that
245		support it.  If MKKERBEROS4 is "no", USE_KERBEROS4
246		will also be forced to "no".
247
248USE_KERBEROS	If "no", disables building Kerberos v4 or v5)
249		support into various system utilities/libraries that
250		support it.  If MKKERBEROS is "no", USE_KERBEROS
251		will also be forced to "no".
252
253USE_SKEY	If "no", disables building S/key authentication
254		support into various system utilities/libraries that
255		support it.  If MKSKEY is "no", USE_SKEY will
256		also be forced to "no".
257
258USE_YP		If "no", disables building YP (NIS) support into
259		various system utilities/libraries that support it.
260		If MKYP is "no", USE_YP will also be forced to "no".
261
262COPTS.lib<lib>
263LDADD.lib<lib>
264CPPFLAGS.lib<lib>
265CXXFLAGS.lib<lib>
266COPTS.<prog>
267LDADD.<prog>
268CPPFLAGS.<prog>
269CXXFLAGS.<prog>	These provide a way to specify additions to the associated
270		variables in a way that applies only to a particular library
271		or program.  <lib> corresponds to the LIB variable set in
272		the library's makefile.  <prog> corresponds to either PROG
273		or PROG_CXX (if set).  For example, if COPTS.libcrypto is
274		set to "-g", "-g" will be added to COPTS only when compiling
275		the crypto library.
276
277=-=-=-=-=   sys.mk   =-=-=-=-=
278
279The include file <sys.mk> has the default rules for all makes, in the BSD
280environment or otherwise.  You probably don't want to touch this file.
281
282=-=-=-=-=   bsd.own.mk   =-=-=-=-=
283
284The include file <bsd.own.mk> contains source tree configuration parameters,
285such as the owners, groups, etc. for both manual pages and binaries, and
286a few global "feature configuration" parameters.
287
288It has no targets.
289
290To get system-specific configuration parameters, <bsd.own.mk> will try to
291include the file specified by the "MAKECONF" variable.  If MAKECONF is not
292set, or no such file exists, the system make configuration file, /etc/mk.conf
293is included.  These files may define any of the variables described below.
294
295<bsd.own.mk> sets the following variables, if they are not already defined
296(defaults are in brackets):
297
298NETBSDSRCDIR	Top of the NetBSD source tree.
299		If _SRC_TOP_ != "", that will be used as the default,
300		otherwise BSDSRCDIR will be used as the default.
301		Various makefiles within the NetBSD source tree will
302		use this to reference the top level of the source tree.
303
304_SRC_TOP_	Top of the system source tree, as determined by <bsd.own.mk>
305		based on the presence of tools/ and build.sh.  This variable
306		is "internal" to <bsd.own.mk>, although its value is only
307		determined once and then propagated to all sub-makes.
308
309BSDSRCDIR	The real path to the system sources, so that 'make obj'
310		will work correctly.  [/usr/src]
311
312BSDOBJDIR	The real path to the system 'obj' tree, so that 'make obj'
313		will work correctly.  [/usr/obj]
314
315BINGRP		Binary group.  [wheel]
316
317BINOWN		Binary owner.  [root]
318
319BINMODE		Binary mode.  [555]
320
321NONBINMODE	Mode for non-executable files.  [444]
322
323MANDIR		Base path for manual installation.  [/usr/share/man/cat]
324
325MANGRP		Manual group.  [wheel]
326
327MANOWN		Manual owner.  [root]
328
329MANMODE		Manual mode.  [${NONBINMODE}]
330
331MANINSTALL	Manual installation type: maninstall, catinstall, or both
332
333LDSTATIC	Control program linking; if set blank, link everything
334		dynamically.  If set to "-static", link everything statically.
335		If not set, programs link according to their makefile.
336
337LIBDIR		Base path for library installation.  [/usr/lib]
338
339LINTLIBDIR	Base path for lint(1) library installation.  [/usr/libdata/lint]
340
341LIBGRP		Library group.  [${BINGRP}]
342
343LIBOWN		Library owner.  [${BINOWN}]
344
345LIBMODE		Library mode.  [${NONBINMODE}]
346
347DOCDIR		Base path for system documentation (e.g. PSD, USD, etc.)
348	        installation.  [/usr/share/doc]
349
350HTMLDOCDIR	Base path for html system documentation installation.
351		[/usr/share/doc/html]
352
353DOCGRP		Documentation group.  [wheel]
354
355DOCOWN		Documentation owner.  [root]
356
357DOCMODE		Documentation mode.  [${NONBINMODE}]
358
359NLSDIR		Base path for Native Language Support files installation.
360		[/usr/share/nls]
361
362NLSGRP		Native Language Support files group.  [wheel]
363
364NLSOWN		Native Language Support files owner.  [root]
365
366NLSMODE		Native Language Support files mode.  [${NONBINMODE}]
367
368STRIPFLAG	The flag passed to the install program to cause the binary
369		to be stripped.  This is to be used when building your
370		own install script so that the entire system can be made
371		stripped/not-stripped using a single knob.  [-s]
372
373COPY		The flag passed to the install program to cause the binary
374		to be copied rather than moved.  This is to be used when
375		building our own install script so that the entire system
376		can either be installed with copies, or with moves using
377		a single knob.  [-c]
378
379Additionally, the following variables may be set by <bsd.own.mk> or in a
380make configuration file to modify the behaviour of the system build
381process (default values are in brackets along with comments, if set by
382<bsd.own.mk>):
383
384OBJECT_FMT	Object file format.  [set to "ELF" on architectures that
385		use ELF -- currently if ${MACHINE_ARCH} is "alpha",
386		"mipsel", "mipseb", "powerpc", "sparc", "sparc64",
387		"i386" and some m68k machines, or set to "a.out" on
388		other architectures].
389
390TOOLCHAIN_MISSING
391		If "yes", this indicates that the platform being built
392		does not have a working in-tree toolchain.  If the
393		MACHINE_ARCH in question falls into this category, the
394		variable is conditionally assigned the value "yes".
395		Otherwise, the variable is unconditionally assigned the
396		value "no".
397
398		If TOOLCHAIN_MISSING is "yes", the variables MKBFD, MKGCC,
399		and MKGDB are unconditionally assigned the value "no".
400
401EXTERNAL_TOOLCHAIN
402		This variable is not directly set by <bsd.own.mk>, but
403		including <bsd.own.mk> is the canonical way to gain
404		access to this variable.  The variable should be defined
405		either in the user's environment or in the user's mk.conf
406		file.  If defined, this variable indicates the root of
407		an external toolchain which will be used to build the
408		tree.  For example, if a platform is a TOOLCHAIN_MISSING
409		platform, EXTERNAL_TOOLCHAIN can be used to re-enable the
410		cross-compile framework.
411
412		If EXTERNAL_TOOLCHAIN is defined, the variable MKGCC is
413		unconditionally assigned the value "no", since the external
414		version of the compiler may not be able to build the library
415		components of the in-tree compiler.
416
417		NOTE: This variable is not yet used in as many places as
418		it should be.  Expect the exact semantics of this variable
419		to change in the short term as parts of the cross-compile
420		framework continue to be cleaned up.
421
422<bsd.own.mk> is generally useful when building your own Makefiles so that
423they use the same default owners etc. as the rest of the tree.
424
425
426=-=-=-=-=   bsd.dep.mk   =-=-=-=-=
427
428The include file <bsd.dep.mk> contains the default targets for building
429.depend files.  It creates .d files from entries in SRCS and DPSRCS
430that are C, C++, or Objective C source files, and builds .depend from the
431.d files.  All other files in SRCS and all of DPSRCS will be used as
432dependencies for the .d files.  In order for this to function correctly,
433it should be .included after all other .mk files and directives that may
434modify SRCS or DPSRCS.  It uses the following variables:
435
436SRCS		List of source files to build the program.
437
438DPSRCS		List of source files which are needed for generating
439		dependencies, but are not needed in ${SRCS}.
440
441
442=-=-=-=-=   bsd.files.mk   =-=-=-=-=
443
444The include file <bsd.files.mk> handles the FILES variables and is included
445from <bsd.lib.mk> and <bsd.prog.mk>, and uses the following variables:
446
447FILES		The list of files to install.
448
449FILESOWN	File owner.  [${BINOWN}]
450
451FILESGRP	File group.  [${BINGRP}]
452
453FILESMODE	File mode.  [${BINMODE}]
454
455FILESDIR	The location to install the files.
456
457FILESNAME	Optional name to install each file as.
458
459FILESDIR.<fn>	The location to install the specific file <fn>.
460
461FILESNAME.<fn>	Optional name to install <fn> as.
462
463BUILDSYMLINKS	List of two word items:
464			lnsrc lntgt
465		For each lnsrc item, create a symlink named lntgt.
466		The lntgt symlinks are removed by the cleandir target.
467
468
469=-=-=-=-=   bsd.gcc.mk   =-=-=-=-=
470
471The include file <bsd.gcc.mk> computes various parameters related to GCC
472support libraries.  It defines no targets.  <bsd.own.mk> MUST be included
473before <bsd.gcc.mk>.
474
475The primary users of <bsd.gcc.mk> are <bsd.prog.mk> and <bsd.lib.mk>, each
476of which need to know where to find certain GCC support libraries.
477
478The behavior of <bsd.gcc.mk> is influenced by the EXTERNAL_TOOLCHAIN variable,
479which is generally set by the user.  If EXTERNAL_TOOLCHAIN it set, then
480the compiler is asked where to find the support libraries, otherwise the
481support libraries are found in ${DESTDIR}/usr/lib.
482
483<bsd.gcc.mk> sets the following variables:
484
485_GCC_CRTBEGIN	The full path name to crtbegin.o.
486
487_GCC_CRTBEGINS	The full path name to crtbeginS.o.
488
489_GCC_CRTEND	The full path name to crtend.o.
490
491_GCC_CRTENDS	The full path name to crtendS.o.
492
493_GCC_LIBGCCDIR	The directory where libgcc.a is located.
494
495
496=-=-=-=-=   bsd.inc.mk   =-=-=-=-=
497
498The include file <bsd.inc.mk> defines the includes target and uses the
499variables:
500
501INCS		The list of include files.
502
503INCSDIR		The location to install the include files.
504
505INCSNAME	Target name of the include file, if only one; same as
506		FILESNAME, but for include files.
507
508INCSYMLINKS	Similar to SYMLINKS in <bsd.links.mk>, except that these
509		are installed in the 'includes' target and not the
510		(much later) 'install' target.
511
512INCSNAME_<file>	The name file <file> should be installed as, if not <file>,
513		same as FILESNAME_<file>, but for include files.
514
515
516=-=-=-=-=   bsd.info.mk   =-=-=-=-=
517
518The include file <bsd.info.mk> is used to generate and install GNU Info
519documentation from respective Texinfo source files.  It defines three
520implicit targets (.txi.info, .texi.info, and .texinfo.info), and uses the
521following variables:
522
523TEXINFO		List of Texinfo source files.  Info documentation will
524		consist of single files with the extension replaced by
525		.info.
526
527INFOFLAGS	Flags to pass to makeinfo.  []
528
529
530=-=-=-=-=   bsd.kernobj.mk   =-=-=-=-=
531
532The include file <bsd.kernobj.mk> defines variables related to the
533location of kernel sources and object directories.
534
535KERNSRCDIR	Is the location of the top of the kernel src.
536		[${_SRC_TOP_}/sys]
537
538KERNARCHDIR	Is the location of the machine dependent kernel sources.
539		[arch/${MACHINE}]
540
541KERNCONFDIR	Is where the configuration files for kernels are found.
542		[${KERNSRCDIR}/${KERNARCHDIR}/conf]
543
544KERNOBJDIR	Is the kernel build directory.  The kernel GENERIC for
545		instance will be compiled in ${KERNOBJDIR}/GENERIC.
546		The default value is
547		${MAKEOBJDIRPREFIX}${KERNSRCDIR}/${KERNARCHDIR}/compile
548		if it exists or the target 'obj' is being made.
549		Otherwise the default is
550		${KERNSRCDIR}/${KERNARCHDIR}/compile.
551
552It is important that Makefiles (such as those under src/distrib) that
553wish to find compiled kernels use <bsd.kernobj.mk> and ${KERNOBJDIR}
554rather than make assumptions about the location of the compiled kernel.
555
556
557=-=-=-=-=   bsd.kinc.mk   =-=-=-=-=
558
559The include file <bsd.kinc.mk> defines the many targets (includes,
560subdirectories, etc.), and is used by kernel makefiles to handle
561include file installation.  It is intended to be included alone, by
562kernel Makefiles.  It uses similar variables to <bsd.inc.mk>.
563Please see <bsd.kinc.mk> for more details, and keep the documentation
564in that file up to date.
565
566
567=-=-=-=-=   bsd.lib.mk   =-=-=-=-=
568
569The include file <bsd.lib.mk> has support for building libraries.  It has
570the same eight targets as <bsd.prog.mk>: all, clean, cleandir, depend,
571includes, install, lint, and tags.  Additionally, it has a checkver target
572which checks for installed shared object libraries whose version is greater
573that the version of the source. It has a limited number of suffixes,
574consistent with the current needs of the BSD tree.  <bsd.lib.mk> includes
575<bsd.shlib.mk> to get shared library parameters.
576
577It sets/uses the following variables:
578
579LIB		The name of the library to build.
580
581LIBDIR		Target directory for libraries.
582
583SHLIBINSTALLDIR	Target directory for shared libraries if ${USE_SHLIBDIR}
584		is "yes".
585
586USE_SHLIBDIR	If "yes", use ${SHLIBINSTALLDIR} instead of ${LIBDIR}
587		as the path to install shared libraries to.
588		USE_SHLIBDIR must be defined before <bsd.own.mk> is included.
589		Default: no
590
591LINTLIBDIR	Target directory for lint libraries.
592
593LIBGRP		Library group.
594
595LIBOWN		Library owner.
596
597LIBMODE		Library mode.
598
599LDADD		Additional loader objects.
600
601MAN		The manual pages to be installed (use a .1 - .9 suffix).
602
603NOCHECKVER_<library>
604NOCHECKVER	If set, disables checking for installed shared object
605		libraries with versions greater than the source.  A
606		particular library name, without the "lib" prefix, may
607		be appended to the variable name to disable the check for
608		only that library.
609
610SRCS		List of source files to build the library.  Suffix types
611		.s, .c, and .f are supported.  Note, .s files are preferred
612		to .c files of the same name.  (This is not the default for
613		versions of make.)
614
615The include file <bsd.lib.mk> includes the file named "../Makefile.inc"
616if it exists, as well as the include file <bsd.man.mk>.
617
618It has rules for building profiled objects; profiled libraries are
619built by default.
620
621Libraries are ranlib'd when made.
622
623
624=-=-=-=-=   bsd.links.mk   =-=-=-=-=
625
626The include file <bsd.links.mk> handles the LINKS and SYMLINKS variables
627and is included from from <bsd.lib.mk> and <bsd.prog.mk>.
628
629LINKS		The list of hard links, consisting of pairs of paths:
630			source-file target-file
631		${DESTDIR} is prepended to both paths before linking.
632		For example, to link /bin/test and /bin/[, use:
633			LINKS=/bin/test /bin/[
634
635SYMLINKS	The list of symbolic links, consisting of pairs of paths:
636			source-file target-file
637		${DESTDIR} is only prepended to target-file before linking.
638		For example, to symlink /usr/bin/tar to /bin/tar resulting
639		in ${DESTDIR}/usr/bin/tar -> /bin/tar:
640			SYMLINKS=/bin/tar /usr/bin/tar
641
642
643=-=-=-=-=   bsd.man.mk   =-=-=-=-=
644
645The include file <bsd.man.mk> handles installing manual pages and their
646links.
647
648It has a two targets:
649
650	maninstall:
651		Install the manual page sources and their links.
652	catinstall:
653		Install the preformatted manual pages and their links.
654
655It sets/uses the following variables:
656
657MANDIR		Base path for manual installation.
658
659MANGRP		Manual group.
660
661MANOWN		Manual owner.
662
663MANMODE		Manual mode.
664
665MANSUBDIR	Subdirectory under the manual page section, i.e. "/vax"
666		or "/tahoe" for machine specific manual pages.
667
668MAN		The manual pages to be installed (use a .1 - .9 suffix).
669
670MLINKS		List of manual page links (using a .1 - .9 suffix).  The
671		linked-to file must come first, the linked file second,
672		and there may be multiple pairs.  The files are soft-linked.
673
674The include file <bsd.man.mk> includes a file named "../Makefile.inc" if
675it exists.
676
677
678=-=-=-=-=   bsd.obj.mk   =-=-=-=-=
679
680The include file <bsd.obj.mk> defines targets related to the creation
681and use of separated object and source directories.
682
683If an environment variable named MAKEOBJDIRPREFIX is set, make(1) uses
684${MAKEOBJDIRPREFIX}${.CURDIR} as the name of the object directory if
685it exists.  Otherwise make(1) looks for the existence of a
686subdirectory (or a symlink to a directory) of the source directory
687into which built targets should be placed.  If an environment variable
688named MAKEOBJDIR is set, make(1) uses its value as the name of the
689object directory; failing that, make first looks for a subdirectory
690named "obj.${MACHINE}", and if that doesn't exist, it looks for "obj".
691
692Object directories are not created automatically by make(1) if they
693don't exist; you need to run a separate "make obj".  (This will happen
694during a top-level build if "MKOBJDIRS" is set to a value other than
695"no").  When the source directory is a subdirectory of ${BSDSRCDIR} --
696and this is determined by a simple string prefix comparison -- object
697directories are created in a separate object directory tree, and a
698symlink to the object directory in that tree is created in the source
699directory; otherwise, "make obj" assumes that you're not in the main
700source tree and that it's not safe to use a separate object tree.
701
702Several variables used by <bsd.obj.mk> control exactly what
703directories and links get created during a "make obj":
704
705MAKEOBJDIR	If set, this is the component name of the object
706		directory.
707
708OBJMACHINE	If this is set but MAKEOBJDIR is not set, creates
709		object directories or links named "obj.${MACHINE}";
710		otherwise, just creates ones named "obj".
711
712USR_OBJMACHINE  If set, and the current directory is a subdirectory of
713		${BSDSRCDIR}, create object directory in the
714		corresponding subdirectory of ${BSDOBJDIR}.${MACHINE};
715		otherwise, create it in the corresponding subdirectory
716		of ${BSDOBJDIR}
717
718BUILDID		If set, the contents of this variable are appended
719		to the object directory name.  If OBJMACHINE is also
720		set, ".${BUILDID}" is added after ".${MACHINE}".
721
722
723=-=-=-=-=   bsd.prog.mk   =-=-=-=-=
724
725The include file <bsd.prog.mk> handles building programs from one or
726more source files, along with their manual pages.  It has a limited number
727of suffixes, consistent with the current needs of the BSD tree. 
728<bsd.prog.mk> includes <bsd.shlib.mk> to get shared library parameters.
729
730It has eight targets:
731
732	all:
733		build the program and its manual page.  This also
734		creates a GDB initialization file (.gdbinit) in
735		the objdir.  The .gdbinit file sets the shared library
736		prefix to ${DESTDIR} to facilitate cross-debugging.
737	clean:
738		remove the program, any object files and the files a.out,
739		Errs, errs, mklog, and ${PROG}.core.
740	cleandir:
741		remove all of the files removed by the target clean, as
742		well as .depend, tags, and any manual pages.
743		`distclean' is a synonym for `cleandir'.
744	depend:
745		make the dependencies for the source files, and store
746		them in the file .depend.
747	includes:
748		install any header files.
749	install:
750		install the program and its manual pages; if the Makefile
751		does not itself define the target install, the targets
752		beforeinstall and afterinstall may also be used to cause
753		actions immediately before and after the install target
754		is executed.
755	lint:
756		run lint on the source files
757	tags:
758		create a tags file for the source files.
759
760It sets/uses the following variables:
761
762BINGRP		Binary group.
763
764BINOWN		Binary owner.
765
766BINMODE		Binary mode.
767
768CLEANFILES	Additional files to remove for the clean and cleandir targets.
769
770COPTS		Additional flags to the compiler when creating C objects.
771
772COPTS.<fn>	Additional flags to the compiler when creating the
773		C objects for <fn>.
774		For <fn>.[ly], "<fn>.c" must be used.
775
776CPUFLAGS	Additional flags to the compiler/assembler to select
777		CPU instruction set options, CPU tuning options, etc.
778
779CPUFLAGS.<fn>	Additional flags to the compiler/assembler for <fn>.
780		For <fn>.[ly], "<fn>.c" must be used.
781
782CPPFLAGS	Additional flags to the C pre-processor.
783
784CPPFLAGS.<fn>	Additional flags to the C pre-processor for <fn>.
785		For <fn>.[ly], "<fn>.c" must be used.
786
787GDBINIT		List of GDB initialization files to add to "source"
788		directives in the .gdbinit file that is created in the
789		objdir.
790
791LDADD		Additional loader objects.  Usually used for libraries.
792		For example, to load with the compatibility and utility
793		libraries, use:
794
795			LDADD+=-lutil -lcompat
796
797LDFLAGS		Additional loader flags.
798
799LINKS		See <bsd.links.mk>
800
801SYMLINKS	See <bsd.links.mk>
802
803MAN		Manual pages (should end in .1 - .9).  If no MAN variable is
804		defined, "MAN=${PROG}.1" is assumed.
805
806PROG		The name of the program to build.  If not supplied, nothing
807		is built.
808
809PROG_CXX	If defined, the name of the program to build.  Also
810		causes <bsd.prog.mk> to link the program with the C++
811		compiler rather than the C compiler.  PROG_CXX overrides
812		the value of PROG if PROG is also set.
813
814PROGNAME	The name that the above program will be installed as, if
815		different from ${PROG}.
816
817SRCS		List of source files to build the program.  If SRCS is not
818		defined, it's assumed to be ${PROG}.c.
819
820DPSRCS		List of source files which are needed for generating
821		dependencies, but are not needed in ${SRCS}.
822
823DPADD		Additional dependencies for the program.  Usually used for
824		libraries.  For example, to depend on the compatibility and
825		utility libraries use:
826
827			DPADD+=${LIBCOMPAT} ${LIBUTIL}
828
829		The following libraries are predefined for DPADD:
830
831		LIBCRT0?=	${DESTDIR}/usr/lib/crt0.o
832		LIBBZ2?=	${DESTDIR}/usr/lib/libbz2.a
833		LIBC?=		${DESTDIR}/usr/lib/libc.a
834		LIBC_PIC?=	${DESTDIR}/usr/lib/libc_pic.a
835		LIBCDK?=	${DESTDIR}/usr/lib/libcdk.a
836		LIBCOM_ERR?=	${DESTDIR}/usr/lib/libcom_err.a
837		LIBCOMPAT?=	${DESTDIR}/usr/lib/libcompat.a
838		LIBCRYPT?=	${DESTDIR}/usr/lib/libcrypt.a
839		LIBCRYPTO?=	${DESTDIR}/usr/lib/libcrypto.a
840		LIBCRYPTO_IDEA?=${DESTDIR}/usr/lib/libcrypto_idea.a
841		LIBCRYPTO_MDC2?=${DESTDIR}/usr/lib/libcrypto_mdc2.a
842		LIBCRYPTO_RC5?=	${DESTDIR}/usr/lib/libcrypto_rc5.a
843		LIBCURSES?=	${DESTDIR}/usr/lib/libcurses.a
844		LIBDBM?=	${DESTDIR}/usr/lib/libdbm.a
845		LIBDES?=	${DESTDIR}/usr/lib/libdes.a
846		LIBEDIT?=	${DESTDIR}/usr/lib/libedit.a
847		LIBEVENT?=	${DESTDIR}/usr/lib/libevent.a
848		LIBFORM?=	${DESTDIR}/usr/lib/libform.a
849		LIBGCC?=	${DESTDIR}/usr/lib/libgcc.a
850		LIBGNUMALLOC?=	${DESTDIR}/usr/lib/libgnumalloc.a
851		LIBGSSAPI?=	${DESTDIR}/usr/lib/libgssapi.a
852		LIBHDB?=	${DESTDIR}/usr/lib/libhdb.a
853		LIBINTL?=	${DESTDIR}/usr/lib/libintl.a
854		LIBIPSEC?=	${DESTDIR}/usr/lib/libipsec.a
855		LIBKADM?=	${DESTDIR}/usr/lib/libkadm.a
856		LIBKADM5CLNT?=	${DESTDIR}/usr/lib/libkadm5clnt.a
857		LIBKADM5SRV?=	${DESTDIR}/usr/lib/libkadm5srv.a
858		LIBKAFS?=	${DESTDIR}/usr/lib/libkafs.a
859		LIBKDB?=	${DESTDIR}/usr/lib/libkdb.a
860		LIBKRB?=	${DESTDIR}/usr/lib/libkrb.a
861		LIBKRB5?=	${DESTDIR}/usr/lib/libkrb5.a
862		LIBKSTREAM?=	${DESTDIR}/usr/lib/libkstream.a
863		LIBKVM?=	${DESTDIR}/usr/lib/libkvm.a
864		LIBL?=		${DESTDIR}/usr/lib/libl.a
865		LIBM?=		${DESTDIR}/usr/lib/libm.a
866		LIBMENU?=	${DESTDIR}/usr/lib/libmenu.a
867		LIBOBJC?=	${DESTDIR}/usr/lib/libobjc.a
868		LIBOSSAUDIO?=	${DESTDIR}/usr/lib/libossaudio.a
869		LIBPCAP?=	${DESTDIR}/usr/lib/libpcap.a
870		LIBPCI?=	${DESTDIR}/usr/lib/libpci.a
871		LIBPMC?=	${DESTDIR}/usr/lib/libpmc.a
872		LIBPOSIX?=	${DESTDIR}/usr/lib/libposix.a
873		LIBPTHREAD?=	${DESTDIR}/usr/lib/libpthread.a
874		LIBPTHREAD_DBG?=${DESTDIR}/usr/lib/libpthread_dbg.a
875		LIBRESOLV?=	${DESTDIR}/usr/lib/libresolv.a
876		LIBRMT?=	${DESTDIR}/usr/lib/librmt.a
877		LIBROKEN?=	${DESTDIR}/usr/lib/libroken.a
878		LIBRPCSVC?=	${DESTDIR}/usr/lib/librpcsvc.a
879		LIBRT?=		${DESTDIR}/usr/lib/librt.a
880		LIBSKEY?=	${DESTDIR}/usr/lib/libskey.a
881		LIBSL?=		${DESTDIR}/usr/lib/libsl.a
882		LIBSS?=		${DESTDIR}/usr/lib/libss.a
883		LIBSSL?=	${DESTDIR}/usr/lib/libssl.a
884		LIBSTDCXX?=	${DESTDIR}/usr/lib/libstdc++.a
885		LIBTERMCAP?=	${DESTDIR}/usr/lib/libtermcap.a
886		LIBUSBHID?=	${DESTDIR}/usr/lib/libusbhid.a
887		LIBUTIL?=	${DESTDIR}/usr/lib/libutil.a
888		LIBWRAP?=	${DESTDIR}/usr/lib/libwrap.a
889		LIBY?=		${DESTDIR}/usr/lib/liby.a
890		LIBZ?=		${DESTDIR}/usr/lib/libz.a
891
892SHAREDSTRINGS	If defined, a new .c.o rule is used that results in shared
893		strings, using xstr(1). Note that this will not work with
894		parallel makes.
895
896STRIPFLAG	The flag passed to the install program to cause the binary
897		to be stripped.
898
899SUBDIR		A list of subdirectories that should be built as well.
900		Each of the targets will execute the same target in the
901		subdirectories.
902
903SCRIPTS		A list of interpreter scripts [file.{sh,csh,pl,awk,...}].
904		These are installed exactly like programs.
905
906SCRIPTSNAME	The name that the above program will be installed as, if
907		different from ${SCRIPTS}. These can be further specialized
908		by setting SCRIPTSNAME_<script>.
909
910FILES		See description of <bsd.files.mk>.
911
912SHLINKDIR	Target directory for shared linker.  See description of
913		<bsd.own.mk> for additional information about this variable.
914
915USE_LIBSTDCXX	If "no", the support libraries needed for C++ programs
916		are set to `-lsupc++ -lm', rather than `-lstdc++ -lm'.
917		Default: yes
918
919The include file <bsd.prog.mk> includes the file named "../Makefile.inc"
920if it exists, as well as the include file <bsd.man.mk>.
921
922Some simple examples:
923
924To build foo from foo.c with a manual page foo.1, use:
925
926	PROG=	foo
927
928	.include <bsd.prog.mk>
929
930To build foo from foo.c with a manual page foo.2, add the line:
931
932	MAN=	foo.2
933
934If foo does not have a manual page at all, add the line:
935
936	MKMAN=	no
937
938If foo has multiple source files, add the line:
939
940	SRCS=	a.c b.c c.c d.c
941
942
943=-=-=-=-=   bsd.rpc.mk   =-=-=-=-=
944
945The include file <bsd.rpc.mk> contains a makefile fragment used to
946construct source files built by rpcgen.
947
948The following macros may be defined in makefiles which include
949<bsd.rpc.mk> in order to control which files get built and how they
950are to be built:
951
952RPC_INCS:	construct .h file from .x file
953RPC_XDRFILES:	construct _xdr.c from .x file
954		(for marshalling/unmarshalling data types)
955RPC_SVCFILES:	construct _svc.c from .x file
956		(server-side stubs)
957RPC_SVCFLAGS:	Additional flags passed to builds of RPC_SVCFILES.
958
959RPC_XDIR:	Directory containing .x/.h files
960
961
962=-=-=-=-=   bsd.shlib.mk   =-=-=-=-=
963
964The include file <bsd.shlib.mk> computes parameters for shared library
965installation and use.  It defines no targets.  <bsd.own.mk> MUST be
966included before <bsd.shlib.mk>.
967
968<bsd.own.mk> sets the following variables, if they are not already defined
969(defaults are in brackets):
970
971SHLIBINSTALLDIR	If ${USE_SHLIBDIR} is "yes", use ${SHLIBINSTALLDIR} instead of
972		${LIBDIR} as the base path for shared library installation.
973		[/lib]
974
975SHLIBDIR	The path to USE_SHLIBDIR shared libraries to use when building
976		a program.  [/lib for programs in /bin and /sbin, /usr/lib
977		for all others.]
978
979_LIBSODIR	Set to ${SHLIBINSTALLDIR} if ${USE_SHLIBDIR} is "yes",
980		otherwise set to ${LIBDIR}
981
982SHLINKINSTALLDIR Base path for shared linker.  [/libexec]
983
984SHLINKDIR	Path to use for shared linker when building a program.
985		[/libexec for programs in /bin and /sbin, /usr/libexec for
986		all others.]
987
988
989=-=-=-=-=   bsd.subdir.mk   =-=-=-=-=
990
991The include file <bsd.subdir.mk> contains the default targets for building
992subdirectories.  It has the same eight targets as <bsd.prog.mk>: all,
993clean, cleandir, depend, includes, install, lint, and tags.  For all of
994the directories listed in the variable SUBDIR, the specified directory
995will be visited and the target made.  There is also a default target which
996allows the command "make subdir" where subdir is any directory listed in
997the variable SUBDIR.
998
999As a special case, the use of a token .WAIT as an entry in SUBDIR acts
1000as a synchronization barrier when multiple make jobs are run; subdirs
1001before the .WAIT must complete before any subdirs after .WAIT are
1002started.  See make(1) for some caveats on use of .WAIT and other
1003special sources.
1004
1005
1006=-=-=-=-=   bsd.sys.mk   =-=-=-=-=
1007
1008The include file <bsd.sys.mk> is used by <bsd.prog.mk> and
1009<bsd.lib.mk>.  It contains overrides that are used when building
1010the NetBSD source tree.
1011
1012The following variables control how various files are compiled/built.
1013(Note that these may be overridden in <bsd.own.mk> if USETOOLS=yes):
1014
1015AR		Create, modify, and extract from archives.  [ar]
1016
1017ARFLAGS		Options to ${AR}.  [rl]
1018
1019CC		C compiler.  [cc]
1020
1021CFLAGS		Options to ${CC}.  [Usually -O or -O2]
1022
1023CPP		C Pre-Processor.  [cpp]
1024
1025CPPFLAGS	Options to ${CPP}.  []
1026
1027CPUFLAGS	Optimization flags for ${CC}
1028
1029CXX		C++ compiler.  [c++]
1030
1031CXXFLAGS	Options to ${CXX}.  [${CFLAGS}]
1032
1033ELF2ECOFF	Convert ELF-format executable to ECOFF.  [elf2ecoff]
1034
1035FC		Fortran compiler.  [f77]
1036
1037FFLAGS		Options to {$FC}.  [-O]
1038
1039INSTALL		install(1) command.  [install]
1040
1041LEX		Lexical analyzer.  [lex]
1042
1043LFLAGS		Options to ${LEX}.  []
1044
1045LD		Linker.  [ld]
1046
1047LDFLAGS		Options to ${LD}.  []
1048
1049LINT		C program verifier.  [lint]
1050
1051LINTFLAGS	Options to ${LINT}.  [-chapbxzF]
1052
1053LORDER		List dependencies for object files.  [lorder]
1054
1055MAKE		make(1).  [make]
1056
1057MKDEP		Construct Makefile dependency list.  [mkdep]
1058
1059NM		List symbols from object files.  [nm]
1060
1061PC		Pascal compiler.  [pc]  (Not present)
1062
1063PFLAGS		Options to ${PC}.  []
1064
1065OBJC		Objective C compiler.  [${CC}]
1066
1067OBJCFLAGS	Options to ${OBJC}.  [${CFLAGS}]
1068
1069OBJCOPY		Copy and translate object files.  [objcopy]
1070
1071RANLIB		Generate index to archive.  [ranlib]
1072
1073SHELL		Shell.  [sh]
1074
1075SIZE		List section sizes and total size.  [size]
1076
1077STRIP		Discard symbols from object files.  [strip]
1078
1079TSORT		Topological sort of a directed graph.  [tsort -q]
1080
1081YACC		LALR(1) parser generator.  [yacc]
1082
1083YFLAGS		Options to ${YACC}.  []
1084
1085YHEADER		If defined, add "-d" to YFLAGS, and add dependencies
1086		from <file>.y to <file>.h and <file>.c, and add
1087		<foo>.h to CLEANFILES.
1088
1089YPREFIX		If defined, add "-p ${YPREFIX}" to YFLAGS.
1090
1091
1092The following variables are defined to commands to perform the
1093appropriate operation, with the default in [brackets].
1094(Note that these are overridden in <bsd.own.mk> if USETOOLS=yes):
1095
1096TOOL_ASN1_COMPILE	ASN1 compiler.  [asn1_compile]
1097
1098TOOL_CAP_MKDB		Create capability database.  [cap_mkdb]
1099
1100TOOL_CAT		Concatenate and print files.  [cat]
1101
1102TOOL_CKSUM		Display file checksums.  [cksum]
1103
1104TOOL_COMPILE_ET		Error table compiler.  [compile_et]
1105
1106TOOL_CONFIG		Build kernel compilation directories.  [config]
1107
1108TOOL_CRUNCHGEN		Generate crunched binary build environment.  [crunchgen]
1109
1110TOOL_CTAGS		Create a tags file.  [ctags]
1111
1112TOOL_DB			Manipulate db(3) databases.  [db]
1113
1114TOOL_EQN		Format equations for groff.  [eqn]
1115
1116TOOL_FGEN		IEEE 1275 Open Firmware FCode Tokenizer.  [fgen]
1117
1118TOOL_GENCAT		Generate NLS message catalogs.  [gencat]
1119
1120TOOL_GROFF		Front end for groff document formatting system.  [groff]
1121
1122TOOL_HEXDUMP		Ascii, decimal, hexadecimal, octal dump.  [hexdump]
1123
1124TOOL_INDXBIB		Make bibliographic database's inverted index.  [indxbib]
1125
1126TOOL_INSTALLBOOT	Install disk bootstrap software.  [installboot]
1127
1128TOOL_INSTALL_INFO	Update info/dir entries.  [install-info]
1129
1130TOOL_M4			M4 macro language processor.  [m4]
1131
1132TOOL_MAKEFS		Create file system image from directory tree.  [makefs]
1133
1134TOOL_MAKEINFO		Translate Texinfo documents.  [makeinfo]
1135
1136TOOL_MAKEWHATIS		Create a whatis.db database.  [makewhatis]
1137
1138TOOL_MDSETIMAGE		Set kernel RAM disk image.  [mdsetimage]
1139
1140TOOL_MENUC		Menu compiler.  [menuc]
1141
1142TOOL_MKCSMAPPER		Make charset mapping table.  [mkcsmapper]
1143
1144TOOL_MKESDB		Make encoding scheme database.  [mkesdb]
1145
1146TOOL_MKLOCALE		Make LC_CTYPE locale files.  [mklocale]
1147
1148TOOL_MKMAGIC		Create database for file(1).  [file]
1149
1150TOOL_MKTEMP		Make (unique) temporary file name.  [mktemp]
1151
1152TOOL_MSGC		Simple message list compiler.  [msgc]
1153
1154TOOL_MTREE		Map a directory hierarchy.  [mtree]
1155
1156TOOL_PAX		Manipulate file archives and copy directories.  [pax]
1157
1158TOOL_PIC		Compile pictures for groff.  [pic]
1159
1160TOOL_PREPMKBOOTIMAGE	prep-mkbootimage (XXXBUILDSH).  [prep-mkbootimage]
1161
1162TOOL_PWD_MKDB		Generate the password databases.  [pwd_mkdb]
1163
1164TOOL_REFER		Preprocess bibliographic references for groff.  [refer]
1165
1166TOOL_ROFF_ASCII		Generate ASCII groff output.  [nroff]
1167
1168TOOL_ROFF_DVI		Generate DVI groff output.  [${TOOL_GROFF} -Tdvi]
1169
1170TOOL_ROFF_HTML		Generate HTML groff output.
1171			[${TOOL_GROFF} -Tlatin1 -mdoc2html]
1172
1173TOOL_ROFF_PS		Generate PS groff output.  [${TOOL_GROFF} -Tps]
1174
1175TOOL_ROFF_RAW		Generate "raw" groff output.  [${TOOL_GROFF} -Z]
1176
1177TOOL_RPCGEN		Remote Procedure Call (RPC) protocol compiler.  [rpcgen]
1178
1179TOOL_SOELIM		Eliminate .so's from groff input.  [soelim]
1180
1181TOOL_STAT		Display file status.  [stat]
1182
1183TOOL_SUNLABEL		Read or modify a SunOS disk label.  [sunlabel]
1184
1185TOOL_TBL		Format tables for groff.  [tbl]
1186
1187TOOL_UUDECODE		Uudecode a binary file.  [uudecode]
1188
1189TOOL_VGRIND		Grind nice listings of programs.  [vgrind -f]
1190
1191TOOL_ZIC		Time zone compiler.  [zic]
1192
1193
1194Other variables of note (incomplete list):
1195
1196WARNS		Crank up gcc warning options; the distinct levels are:
1197			WARNS=1
1198			WARNS=2
1199			WARNS=3
1200
1201FORMAT_AUDIT	If FORMAT_AUDIT is set, and WFORMAT is set and > 1, turn on
1202WFORMAT 	-Wnetbsd-format-audit for extra-stringent format checking.
1203		WFORMAT belongs in individual makefiles and/or
1204		Makefile.inc files.  (set WFORMAT=1 in individual
1205		makefiles if a program is not security critical and is
1206		doing bizarre things with format strings which would
1207		be even uglier if rewritten) FORMAT_AUDIT should go in
1208		mk.conf if you're doing format-string auditing.
1209		FORMAT_AUDIT may go away in time.
1210
1211=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1212