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