bsd.README revision 1.95
1#	$NetBSD: bsd.README,v 1.95 2002/04/10 15:05:45 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
61The following variables that control how things are made/installed that
62are not set by default. These should not be set by Makefiles; they're for
63the user to define in MAKECONF (see bsd.own.mk, below) or on the make(1)
64command line:
65
66BUILD 		If defined, 'make install' checks that the targets in the
67		source directories are up-to-date and remakes them if they
68                are out of date, instead of blindly trying to install
69                out of date or non-existent targets.
70
71UPDATE 		If defined, 'make install' only installs targets that are
72		more recently modified in the source directories that their
73		installed counterparts.
74
75UNPRIVED	If defined, don't set the owner/group/mode when installing
76		files or directories, and keep a metadata log of what
77		the owner/group/mode should be.  This allows a
78		non-root "make install".
79
80MKBFD		If "no", don't build libbfd, libiberty, or any of
81		the things that depend on them (binutils/gas/ld,
82		gdb, dbsym, mdsetimage).  Only meaningful if
83		USE_NEW_TOOLCHAIN is set.
84
85MKCATPAGES	If "no", don't build or install the catman pages.
86
87MKDOC		If "no", don't build or install the documentation.
88
89MKGDB		If "no", don't build gdb.  Only meaningful if
90		USE_NEW_TOOLCHAIN is set.
91
92MKGCC		If "no", don't build gcc or any of the gcc-related
93		libraries (libg2c, libgcc, libobjc, libstdc++).
94		Only meaningful if USE_NEW_TOOLCHAIN is set.
95
96MKIEEEFP	If "no", don't add code for IEEE754/IEC60559 conformance.
97		Has no effect on most platforms.
98
99MKINFO		If "no", don't build or install Info documentation from
100		Texinfo source files.
101
102MKLINT		If "no", don't build or install the lint libraries.
103
104MKMAN		If "no", don't build or install the man or catman pages.
105		Also acts as "MKCATPAGES=no"
106
107MKNLS		If "no", don't build or install the NLS files and locale
108		definition files.
109
110MKOBJ		If "no", don't enable the rule which creates objdirs.
111		"yes" by default.
112
113MKOBJDIRS	If "no", don't create objdirs during a "make build".
114		"no" by default.
115
116MKPIC		If "no", don't build or install shared libraries.
117
118MKPICINSTALL	If "no", don't install the *_pic.a libraries.
119
120MKPROFILE	If "no", don't build or install the profiling libraries.
121
122MKSHARE		If "no", act as "MKCATPAGES=no MKDOC=no MKINFO=no MKMAN=no
123		MKNLS=no".  I.e, don't build catman pages, documentation,
124		Info documentation, man pages, NLS files, ...
125
126=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
127
128The include file <sys.mk> has the default rules for all makes, in the BSD
129environment or otherwise.  You probably don't want to touch this file.
130If you intend to run a cross build, you will need to supply the following
131host tools, and configure the following variables properly:
132
133OBJCOPY		objcopy - copy and translate object files
134
135STRIP		strip - Discard symbols from object files
136
137CONFIG		config - build kernel compilation directories
138
139RPCGEN		rpcgen - Remote Procedure Call (RPC) protocol compiler
140
141MKLOCALE	mklocale - make LC_CTYPE locale files
142
143MTREE		mtree - build directory tree from a spec file
144
145=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
146
147The include file <bsd.man.mk> handles installing manual pages and their
148links.
149
150It has a two targets:
151
152	maninstall:
153		Install the manual page sources and their links.
154	catinstall:
155		Install the preformatted manual pages and their links.
156
157It sets/uses the following variables:
158
159MANDIR		Base path for manual installation.
160
161MANGRP		Manual group.
162
163MANOWN		Manual owner.
164
165MANMODE		Manual mode.
166
167MANSUBDIR	Subdirectory under the manual page section, i.e. "/vax"
168		or "/tahoe" for machine specific manual pages.
169
170MAN		The manual pages to be installed (use a .1 - .9 suffix).
171
172MLINKS		List of manual page links (using a .1 - .9 suffix).  The
173		linked-to file must come first, the linked file second,
174		and there may be multiple pairs.  The files are soft-linked.
175
176The include file <bsd.man.mk> includes a file named "../Makefile.inc" if
177it exists.
178
179=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
180
181The include file <bsd.own.mk> contains source tree configuration parameters,
182such as the owners, groups, etc. for both manual pages and binaries, and
183a few global "feature configuration" parameters.
184
185It has no targets.
186
187To get system-specific configuration parameters, bsd.own.mk will try to
188include the file specified by the "MAKECONF" variable.  If MAKECONF is not
189set, or no such file exists, the system make configuration file, /etc/mk.conf
190is included.  These files may define any of the variables described below.
191
192bsd.own.mk sets the following variables, if they are not already defined
193(defaults are in brackets):
194
195_SRC_TOP_	Top of the system source tree, as determined by <bsd.own.mk>
196		based on the presence of build.sh and tools/ .
197
198BSDSRCDIR	The real path to the system sources, so that 'make obj'
199		will work correctly. [/usr/src]
200
201BSDOBJDIR	The real path to the system 'obj' tree, so that 'make obj'
202		will work correctly. [/usr/obj]
203
204BINGRP		Binary group. [wheel]
205
206BINOWN		Binary owner. [root]
207
208BINMODE		Binary mode. [555]
209
210NONBINMODE	Mode for non-executable files. [444]
211
212MANDIR		Base path for manual installation. [/usr/share/man/cat]
213
214MANGRP		Manual group. [wheel]
215
216MANOWN		Manual owner. [root]
217
218MANMODE		Manual mode. [${NONBINMODE}]
219
220MANINSTALL	Manual installation type: maninstall, catinstall, or both
221
222LDSTATIC	Control program linking; if set blank, link everything
223		dynamically. If set to "-static", link everything statically.
224		If not set, programs link according to their makefile.
225
226LIBDIR		Base path for library installation. [/usr/lib]
227
228SHLIBDIR	If ${USE_SHLIBDIR} is "yes", use ${SHLIBDIR} instead of
229		${LIBDIR} as the base path for shared library installation.
230		[/usr/lib]
231
232_LIBSODIR	Set to ${SHLIBDIR} if ${USE_SHLIBDIR} is "yes",
233		otherwise set to ${LIBDIR}
234
235SHLINKDIR	Base path for shared linker. [/usr/libexec]
236
237LINTLIBDIR	Base path for lint(1) library installation. [/usr/libdata/lint]
238
239LIBGRP		Library group. [${BINGRP}]
240
241LIBOWN		Library owner. [${BINOWN}]
242
243LIBMODE		Library mode. [${NONBINMODE}]
244
245DOCDIR		Base path for system documentation (e.g. PSD, USD, etc.)
246	        installation. [/usr/share/doc]
247
248HTMLDOCDIR	Base path for html system documentation installation.
249		[/usr/share/doc/html]
250
251DOCGRP		Documentation group. [wheel]
252
253DOCOWN		Documentation owner. [root]
254
255DOCMODE		Documentation mode. [${NONBINMODE}]
256
257NLSDIR		Base path for Native Language Support files installation.
258		[/usr/share/nls]
259
260NLSGRP		Native Language Support files group. [wheel]
261
262NLSOWN		Native Language Support files owner. [root]
263
264NLSMODE		Native Language Support files mode. [${NONBINMODE}]
265
266STRIPFLAG	The flag passed to the install program to cause the binary
267		to be stripped.  This is to be used when building your
268		own install script so that the entire system can be made
269		stripped/not-stripped using a single knob. [-s]
270
271COPY		The flag passed to the install program to cause the binary
272		to be copied rather than moved.  This is to be used when
273		building our own install script so that the entire system
274		can either be installed with copies, or with moves using
275		a single knob. [-c]
276
277Additionally, the following variables may be set by bsd.own.mk or in a
278make configuration file to modify the behaviour of the system build
279process (default values are in brackets along with comments, if set by
280bsd.own.mk):
281
282MKCRYPTO	If set to "no", no cryptography support will be built
283		into the system.  Defaults to "yes".
284
285NOCRYPTO	If set, it is equivalent to setting MKCRYPTO to "no".
286
287MKCRYPTO_IDEA	If set to "yes", IDEA support will be built into
288		libcrypto_idea.a.  Defaults to "no".
289
290MKCRYPTO_RC5	If set to "yes", RC5 support will be built into
291		libcrypto_rc5.a.  Defaults to "no".
292
293MKHESIOD	If set to "no", disables building of Hesiod infrastructure
294		(libraries and support programs).
295
296MKKERBEROS	If set to "no", disables building of Kerberos (v4 or v5)
297		infrastructure (libraries and support programs).
298
299MKSKEY		If set to "no", disables building of S/key authentication
300		infrastructure (libraries and support programs).
301
302MKYP		If set to "no", disables building of YP (NIS)
303		infrastructure (libraries and support programs).
304
305USE_HESIOD	If set to "no", disables building Hesiod support into
306		various system utilities/libraries that support it.
307		If MKHESIOD is set to "no", USE_HESIOD will also be
308		forced to "no".
309
310USE_KERBEROS	If set to "no", disables building Kerberos (v4 or v5)
311		support into various system utilities/libraries that
312		support it.  If MKKERBEROS is set to "no", USE_KERBEROS
313		will also be forced to "no".
314
315USE_SKEY	If set to "no", disables building S/key authentication
316		support into various system utilities/libraries that
317		support it.  If MKSKEY is set to "no", USE_SKEY will
318		also be forced to "no".
319
320USE_YP		If set to "no", disables building YP (NIS) support into
321		various system utilities/libraries that support it.  If
322		MKYP is set to "no", USE_YP will also be forced to "no".
323
324MANZ		Compress manual pages at installation time.
325
326SYS_INCLUDE	Copy or symlink kernel include files into /usr/include.
327		Possible values are "symlinks" or "copies" (which is
328		the same as the variable being unset).
329
330NOPROFILE	Do not build profiled versions of system libraries
331
332NOPIC		Do not build PIC versions of system libraries, and
333		do not build shared libraries.  [set if ${MACHINE_ARCH}
334		is "sh3" and ${OBJECT_FMT} is "COFF", unset otherwise.]
335
336NOLINT		Do not build lint libraries.
337
338OBJECT_FMT	Object file format. [set to "ELF" on architectures that
339		use ELF -- currently if ${MACHINE_ARCH} is "alpha",
340		"mipsel", "mipseb", "powerpc", "sparc", "sparc64",
341		"i386" and some m68k machines, or set to "a.out" on
342		other architectures].
343
344MKSOFTFLOAT	If "yes", build with options to enable the compiler to
345		generate output containing library calls for floating
346		point and possibly soft-float library support.  Defaults
347		to "no".
348
349bsd.own.mk is generally useful when building your own Makefiles so that
350they use the same default owners etc. as the rest of the tree.
351
352=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
353
354The include file <bsd.prog.mk> handles building programs from one or
355more source files, along with their manual pages.  It has a limited number
356of suffixes, consistent with the current needs of the BSD tree.
357
358It has eight targets:
359
360	all:
361		build the program and its manual page
362	clean:
363		remove the program, any object files and the files a.out,
364		Errs, errs, mklog, and ${PROG}.core.
365	cleandir:
366		remove all of the files removed by the target clean, as
367		well as .depend, tags, and any manual pages.
368		`distclean' is a synonym for `cleandir'.
369	depend:
370		make the dependencies for the source files, and store
371		them in the file .depend.
372	includes:
373		install any header files.
374	install:
375		install the program and its manual pages; if the Makefile
376		does not itself define the target install, the targets
377		beforeinstall and afterinstall may also be used to cause
378		actions immediately before and after the install target
379		is executed.
380	lint:
381		run lint on the source files
382	tags:
383		create a tags file for the source files.
384
385It sets/uses the following variables:
386
387BINGRP		Binary group.
388
389BINOWN		Binary owner.
390
391BINMODE		Binary mode.
392
393CLEANFILES	Additional files to remove for the clean and cleandir targets.
394
395COPTS		Additional flags to the compiler when creating C objects.
396
397CPPFLAGS	Additional flags to the C pre-processor
398
399LDADD		Additional loader objects.  Usually used for libraries.
400		For example, to load with the compatibility and utility
401		libraries, use:
402
403			LDADD+=-lutil -lcompat
404
405LDFLAGS		Additional loader flags.
406
407LINKS		The list of binary links; should be full pathnames, the
408		linked-to file coming first, followed by the linked
409		file.  The files are hard-linked.  For example, to link
410		/bin/test and /bin/[, use:
411
412			LINKS=	${DESTDIR}/bin/test ${DESTDIR}/bin/[
413
414SYMLINKS	The list of symbolic links; should be full pathnames.
415                Syntax is identical to LINKS. Note that DESTDIR is not
416		automatically included in the link.
417
418MAN		Manual pages (should end in .1 - .9).  If no MAN variable is
419		defined, "MAN=${PROG}.1" is assumed.
420
421PROG		The name of the program to build.  If not supplied, nothing
422		is built.
423
424PROG_CXX	If defined, the name of the program to build.  Also
425		causes <bsd.prog.mk> to link the program with the C++
426		compiler rather than the C compiler.  PROG_CXX overrides
427		the value of PROG if PROG is also set.
428
429PROGNAME	The name that the above program will be installed as, if
430		different from ${PROG}.
431
432SRCS		List of source files to build the program.  If SRCS is not
433		defined, it's assumed to be ${PROG}.c.
434
435DPADD		Additional dependencies for the program.  Usually used for
436		libraries.  For example, to depend on the compatibility and
437		utility libraries use:
438
439			DPADD+=${LIBCOMPAT} ${LIBUTIL}
440
441		The following libraries are predefined for DPADD:
442
443		LIBCRT0?=	${DESTDIR}/usr/lib/crt0.o
444		LIBC?=		${DESTDIR}/usr/lib/libc.a
445		LIBC_PIC?=	${DESTDIR}/usr/lib/libc_pic.a
446		LIBCOMPAT?=	${DESTDIR}/usr/lib/libcompat.a
447		LIBCRYPT?=	${DESTDIR}/usr/lib/libcrypt.a
448		LIBCURSES?=	${DESTDIR}/usr/lib/libcurses.a
449		LIBDBM?=	${DESTDIR}/usr/lib/libdbm.a
450		LIBDES?=	${DESTDIR}/usr/lib/libdes.a
451		LIBEDIT?=	${DESTDIR}/usr/lib/libedit.a
452		LIBFORM?=	${DESTDIR}/usr/lib/libform.a
453		LIBGCC?=	${DESTDIR}/usr/lib/libgcc.a
454		LIBGNUMALLOC?=	${DESTDIR}/usr/lib/libgnumalloc.a
455		LIBINTL?=	${DESTDIR}/usr/lib/libintl.a
456		LIBIPSEC?=	${DESTDIR}/usr/lib/libipsec.a
457		LIBKDB?=	${DESTDIR}/usr/lib/libkdb.a
458		LIBKRB?=	${DESTDIR}/usr/lib/libkrb.a
459		LIBKVM?=	${DESTDIR}/usr/lib/libkvm.a
460		LIBL?=		${DESTDIR}/usr/lib/libl.a
461		LIBM?=		${DESTDIR}/usr/lib/libm.a
462		LIBMENU?=	${DESTDIR}/usr/lib/libmenu.a
463		LIBMP?=		${DESTDIR}/usr/lib/libmp.a
464		LIBNTP?=	${DESTDIR}/usr/lib/libntp.a
465		LIBPC?=		${DESTDIR}/usr/lib/libpc.a
466		LIBPCAP?=	${DESTDIR}/usr/lib/libpcap.a
467		LIBPLOT?=	${DESTDIR}/usr/lib/libplot.a
468		LIBPOSIX?=	${DESTDIR}/usr/lib/libposix.a
469		LIBRESOLV?=	${DESTDIR}/usr/lib/libresolv.a
470		LIBRPCSVC?=	${DESTDIR}/usr/lib/librpcsvc.a
471		LIBSKEY?=	${DESTDIR}/usr/lib/libskey.a
472		LIBTERMCAP?=	${DESTDIR}/usr/lib/libtermcap.a
473		LIBTELNET?=	${DESTDIR}/usr/lib/libtelnet.a
474		LIBUTIL?=	${DESTDIR}/usr/lib/libutil.a
475		LIBWRAP?=	${DESTDIR}/usr/lib/libwrap.a
476		LIBY?=		${DESTDIR}/usr/lib/liby.a
477		LIBZ?=		${DESTDIR}/usr/lib/libz.a
478
479SHAREDSTRINGS	If defined, a new .c.o rule is used that results in shared
480		strings, using xstr(1). Note that this will not work with
481		parallel makes.
482
483STRIPFLAG	The flag passed to the install program to cause the binary
484		to be stripped.
485
486SUBDIR		A list of subdirectories that should be built as well.
487		Each of the targets will execute the same target in the
488		subdirectories.
489
490SCRIPTS		A list of interpreter scripts [file.{sh,csh,pl,awk,...}].
491		These are installed exactly like programs.
492
493SCRIPTSNAME	The name that the above program will be installed as, if
494		different from ${SCRIPTS}. These can be further specialized
495		by setting SCRIPTSNAME_<script>.
496
497FILES		A list of files to install. The installation is controlled
498		by the FILESNAME, FILESOWN, FILESGRP, FILESMODE, FILESDIR
499		variables that can be further specialized by FILES<VAR>_<file>
500
501SHLINKDIR	Target directory for shared linker.
502
503The include file <bsd.prog.mk> includes the file named "../Makefile.inc"
504if it exists, as well as the include file <bsd.man.mk>.
505
506Some simple examples:
507
508To build foo from foo.c with a manual page foo.1, use:
509
510	PROG=	foo
511
512	.include <bsd.prog.mk>
513
514To build foo from foo.c with a manual page foo.2, add the line:
515
516	MAN=	foo.2
517
518If foo does not have a manual page at all, add the line:
519
520	MKMAN=	no
521
522If foo has multiple source files, add the line:
523
524	SRCS=	a.c b.c c.c d.c
525
526=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
527
528The include file <bsd.subdir.mk> contains the default targets for building
529subdirectories.  It has the same eight targets as <bsd.prog.mk>: all, 
530clean, cleandir, depend, includes, install, lint, and tags.  For all of
531the directories listed in the variable SUBDIR, the specified directory 
532will be visited and the target made.  There is also a default target which
533allows the command "make subdir" where subdir is any directory listed in
534the variable SUBDIR.
535
536As a special case, the use of a token .WAIT as an entry in SUBDIR acts
537as a synchronization barrier when multiple make jobs are run; subdirs
538before the .WAIT must complete before any subdirs after .WAIT are
539started.  See make(1) for some caveats on use of .WAIT and other
540special sources.
541
542=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
543
544The include file <bsd.links.mk> handles the LINKS and SYMLINKS variables
545and is included from from bsd.lib.mk and bsd.prog.mk.
546
547=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
548
549The include file <bsd.files.mk> handles the FILES variables and is included
550from bsd.lib.mk and bsd.prog.mk.
551
552=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
553
554The include file <bsd.inc.mk> defines the includes target and uses two
555variables:
556
557INCS		The list of include files
558
559INCSDIR		The location to install the include files.
560
561INCSNAME	Target name of the include file, if only one; same as
562		FILESNAME, but for include files.
563
564INCSNAME_<file>	The name file <file> should be installed as, if not <file>,
565		same as FILESNAME_<file>, but for include files.
566
567=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
568
569The include file <bsd.kinc.mk> defines the many targets (includes,
570subdirectories, etc.), and is used by kernel makefiles to handle
571include file installation.  It is intended to be included alone, by
572kernel Makefiles.  Please see bsd.kinc.mk for more details, and keep
573the documentation in that file up to date.
574
575=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
576
577The include file <bsd.info.mk> is used to generate and install GNU Info
578documentation from respective Texinfo source files.  It defines three
579implicit targets (.txi.info, .texi.info, and .texinfo.info), and uses the
580following variables:
581
582TEXINFO		List of Texinfo source files.  Info documentation will
583		consist of single files with the extension replaced by
584		.info.
585
586INFOFLAGS	Flags to pass to makeinfo.  []
587
588INSTALL_INFO	Name of install-info program.  [install-info]
589
590MAKEINFO	Name of makeinfo program.  [makeinfo]
591
592=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
593
594The include file <bsd.sys.mk> is used by <bsd.prog.mk> and
595<bsd.lib.mk>.  It contains overrides that are used when building
596the NetBSD source tree.  For instance, if "PARALLEL" is defined by
597the program/library Makefile, it includes a set of rules for lex and
598yacc that allow multiple lex and yacc targets to be built in parallel.
599
600Other variables of note (incomplete list):
601
602WARNS		Crank up gcc warning options; the distinct levels are:
603			WARNS=1
604			WARNS=2
605			WARNS=3
606
607FORMAT_AUDIT	If FORMAT_AUDIT is set, and WFORMAT is set and > 1, turn on
608WFORMAT 	-Wnetbsd-format-audit for extra-stringent format checking.
609		WFORMAT belongs in individual makefiles and/or
610		Makefile.inc files.  (set WFORMAT=1 in individual
611		makefiles if a program is not security critical and is
612		doing bizarre things with format strings which would
613		be even uglier if rewritten) FORMAT_AUDIT should go in
614		mk.conf if you're doing format-string auditing. 
615		FORMAT_AUDIT may go away in time.
616
617=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
618
619The include file <bsd.lib.mk> has support for building libraries.  It has
620the same eight targets as <bsd.prog.mk>: all, clean, cleandir, depend,
621includes, install, lint, and tags.  Additionally, it has a checkver target
622which checks for installed shared object libraries whose version is greater
623that the version of the source. It has a limited number of suffixes,
624consistent with the current needs of the BSD tree.
625
626It sets/uses the following variables:
627
628LIB		The name of the library to build.
629
630LIBDIR		Target directory for libraries.
631
632SHLIBDIR	Target directory for shared libraries if ${USE_SHLIBDIR}
633		is "yes".
634
635USE_SHLIBDIR	If "yes", use ${SHLIBDIR} instead of ${LIBDIR}
636		as the path to install shared libraries to.
637
638LINTLIBDIR	Target directory for lint libraries.
639
640LIBGRP		Library group.
641
642LIBOWN		Library owner.
643
644LIBMODE		Library mode.
645
646LDADD		Additional loader objects.
647
648MAN		The manual pages to be installed (use a .1 - .9 suffix).
649
650MKLINKLIB	If "no", act as "MKPICINSTALL=no MKPROFILE=no".
651		Also:
652			- don't install the .a libraries
653			- don't install _pic.a libraries on PIC systems
654			- don't build .a libraries on PIC systems
655			- don't install the .so symlink on ELF systems
656		I.e, only install the shared library (and the .so.major
657		symlink on ELF).
658
659MKPICLIB	If "no", don't build _pic.a libraries, and build the
660		shared object libraries from the .a libraries.  A
661		symlink is installed in ${DESTDIR}/usr/lib for the
662		_pic.a library pointing to the .a library.
663
664NOCHECKVER_<library>
665NOCHECKVER	If set, disables checking for installed shared object
666		libraries with versions greater than the source.  A
667		particular library name, without the "lib" prefix, may
668		be appended to the variable name to disable the check for
669		only that library.
670
671SRCS		List of source files to build the library.  Suffix types
672		.s, .c, and .f are supported.  Note, .s files are preferred
673		to .c files of the same name.  (This is not the default for
674		versions of make.)
675
676The include file <bsd.lib.mk> includes the file named "../Makefile.inc"
677if it exists, as well as the include file <bsd.man.mk>.
678
679It has rules for building profiled objects; profiled libraries are
680built by default.
681
682Libraries are ranlib'd when made.
683
684=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
685
686The include file <bsd.obj.mk> defines targets related to the creation
687and use of separated object and source directories.
688
689If an environment variable named MAKEOBJDIRPREFIX is set, make(1) uses
690${MAKEOBJDIRPREFIX}${.CURDIR} as the name of the object directory if
691it exists.  Otherwise make(1) looks for the existence of a
692subdirectory (or a symlink to a directory) of the source directory
693into which built targets should be placed.  If an environment variable
694named MAKEOBJDIR is set, make(1) uses its value as the name of the
695object directory; failing that, make first looks for a subdirectory
696named "obj.${MACHINE}", and if that doesn't exist, it looks for "obj".
697
698Object directories are not created automatically by make(1) if they
699don't exist; you need to run a separate "make obj".  (This will happen
700during a top-level build if "MKOBJDIRS" is set to a value other than
701"no").  When the source directory is a subdirectory of ${BSDSRCDIR} --
702and this is determined by a simple string prefix comparison -- object
703directories are created in a separate object directory tree, and a
704symlink to the object directory in that tree is created in the source
705directory; otherwise, "make obj" assumes that you're not in the main
706source tree and that it's not safe to use a separate object tree.
707
708Several variables used by <bsd.obj.mk> control exactly what
709directories and links get created during a "make obj":
710
711MAKEOBJDIR	If set, this is the component name of the object
712		directory.
713
714OBJMACHINE	If this is set but MAKEOBJDIR is not set, creates
715		object directories or links named "obj.${MACHINE}";
716		otherwise, just creates ones named "obj".
717
718USR_OBJMACHINE  If set, and the current directory is a subdirectory of
719		${BSDSRCDIR}, create object directory in the
720		corresponding subdirectory of ${BSDOBJDIR}.${MACHINE};
721		otherwise, create it in the corresponding subdirectory
722		of ${BSDOBJDIR}
723
724BUILDID		If set, the contents of this variable are appended
725		to the object directory name.  If OBJMACHINE is also
726		set, ".${BUILDID}" is added after ".${MACHINE}".
727
728=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
729
730The include file <bsd.kernobj.mk> defines variables related to the
731location of kernel sources and object directories.
732
733KERNSRCDIR	Is the location of the top of the kernel src.
734		It defaults to ${_SRC_TOP_}/sys
735
736KERNARCHDIR	Is the location of the machine dependent kernel
737		sources.  It defaults to arch/${MACHINE}
738		
739KERNCONFDIR	Is where the configuration files for kernels are
740		found; default is ${KERNSRCDIR}/${KERNARCHDIR}/conf.
741
742KERNOBJDIR	Is the kernel build directory.  The kernel GENERIC for
743		instance will be compiled in ${KERNOBJDIR}/GENERIC.
744		The default value is
745		${MAKEOBJDIRPREFIX}${KERNSRCDIR}/${KERNARCHDIR}/compile
746		if it exists or the target 'obj' is being made.
747		Otherwise the default is
748		${KERNSRCDIR}/${KERNARCHDIR}/compile.
749
750It is important that Makefiles (such as those under src/distrib) that
751wish to find compiled kernels use bsd.kernobj.mk and ${KERNOBJDIR}
752rather than make assumptions about the location of the compiled kernel.
753
754=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
755