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