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