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