xref: /netbsd/share/mk/bsd.README (revision bf9ec67e)
1#	$NetBSD: bsd.README,v 1.98 2002/04/26 15:02:02 lukem Exp $
2#	@(#)bsd.README	8.2 (Berkeley) 4/2/94
3
4This is the README file for the new make "include" files for the BSD
5source tree.  The files are installed in /usr/share/mk, and are, by
6convention, named with the suffix ".mk".
7
8Note, this file is not intended to replace reading through the .mk
9files for anything tricky.
10
11=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
12
13RANDOM THINGS WORTH KNOWING:
14
15The files are simply C-style #include files, and pretty much behave like
16you'd expect.  The syntax is slightly different in that a single '.' is
17used instead of the hash mark, i.e. ".include <bsd.prog.mk>".
18
19One difference that will save you lots of debugging time is that inclusion
20of the file is normally done at the *end* of the Makefile.  The reason for
21this is because .mk files often modify variables and behavior based on the
22values of variables set in the Makefile.  To make this work, remember that
23the FIRST target found is the target that is used, i.e. if the Makefile has:
24
25	a:
26		echo a
27	a:
28		echo a number two
29
30the command "make a" will echo "a".  To make things confusing, the SECOND
31variable assignment is the overriding one, i.e. if the Makefile has:
32
33	a=	foo
34	a=	bar
35
36	b:
37		echo ${a}
38
39the command "make b" will echo "bar".  This is for compatibility with the
40way the V7 make behaved.
41
42It's fairly difficult to make the BSD .mk files work when you're building
43multiple programs in a single directory.  It's a lot easier to split up the
44programs than to deal with the problem.  Most of the agony comes from making
45the "obj" directory stuff work right, not because we switched to a new version
46of make.  So, don't get mad at us, figure out a better way to handle multiple
47architectures so we can quit using the symbolic link stuff.  (Imake doesn't
48count.)
49
50The file .depend in the source directory is expected to contain dependencies
51for the source files.  This file is read automatically by make after reading
52the Makefile.
53
54The variable DESTDIR works as before.  It's not set anywhere but will change
55the tree where the file gets installed.
56
57The profiled libraries are no longer built in a different directory than
58the regular libraries.  A new suffix, ".po", is used to denote a profiled
59object, and ".so" denotes a shared (position-independent) object.
60
61There are various make variables used during the build.  Basic rule for
62the variable naming scheme is as follows:
63
64MKxxx		Can be set to `no' by a user to disable functionality.
65		Defaults to `yes' (or usually does)
66
67NOxxx		If defined, disables a feature.  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		LIBC?=		${DESTDIR}/usr/lib/libc.a
461		LIBC_PIC?=	${DESTDIR}/usr/lib/libc_pic.a
462		LIBCOMPAT?=	${DESTDIR}/usr/lib/libcompat.a
463		LIBCRYPT?=	${DESTDIR}/usr/lib/libcrypt.a
464		LIBCURSES?=	${DESTDIR}/usr/lib/libcurses.a
465		LIBDBM?=	${DESTDIR}/usr/lib/libdbm.a
466		LIBDES?=	${DESTDIR}/usr/lib/libdes.a
467		LIBEDIT?=	${DESTDIR}/usr/lib/libedit.a
468		LIBFORM?=	${DESTDIR}/usr/lib/libform.a
469		LIBGCC?=	${DESTDIR}/usr/lib/libgcc.a
470		LIBGNUMALLOC?=	${DESTDIR}/usr/lib/libgnumalloc.a
471		LIBINTL?=	${DESTDIR}/usr/lib/libintl.a
472		LIBIPSEC?=	${DESTDIR}/usr/lib/libipsec.a
473		LIBKDB?=	${DESTDIR}/usr/lib/libkdb.a
474		LIBKRB?=	${DESTDIR}/usr/lib/libkrb.a
475		LIBKVM?=	${DESTDIR}/usr/lib/libkvm.a
476		LIBL?=		${DESTDIR}/usr/lib/libl.a
477		LIBM?=		${DESTDIR}/usr/lib/libm.a
478		LIBMENU?=	${DESTDIR}/usr/lib/libmenu.a
479		LIBMP?=		${DESTDIR}/usr/lib/libmp.a
480		LIBNTP?=	${DESTDIR}/usr/lib/libntp.a
481		LIBPC?=		${DESTDIR}/usr/lib/libpc.a
482		LIBPCAP?=	${DESTDIR}/usr/lib/libpcap.a
483		LIBPLOT?=	${DESTDIR}/usr/lib/libplot.a
484		LIBPOSIX?=	${DESTDIR}/usr/lib/libposix.a
485		LIBRESOLV?=	${DESTDIR}/usr/lib/libresolv.a
486		LIBRPCSVC?=	${DESTDIR}/usr/lib/librpcsvc.a
487		LIBSKEY?=	${DESTDIR}/usr/lib/libskey.a
488		LIBTERMCAP?=	${DESTDIR}/usr/lib/libtermcap.a
489		LIBTELNET?=	${DESTDIR}/usr/lib/libtelnet.a
490		LIBUTIL?=	${DESTDIR}/usr/lib/libutil.a
491		LIBWRAP?=	${DESTDIR}/usr/lib/libwrap.a
492		LIBY?=		${DESTDIR}/usr/lib/liby.a
493		LIBZ?=		${DESTDIR}/usr/lib/libz.a
494
495SHAREDSTRINGS	If defined, a new .c.o rule is used that results in shared
496		strings, using xstr(1). Note that this will not work with
497		parallel makes.
498
499STRIPFLAG	The flag passed to the install program to cause the binary
500		to be stripped.
501
502SUBDIR		A list of subdirectories that should be built as well.
503		Each of the targets will execute the same target in the
504		subdirectories.
505
506SCRIPTS		A list of interpreter scripts [file.{sh,csh,pl,awk,...}].
507		These are installed exactly like programs.
508
509SCRIPTSNAME	The name that the above program will be installed as, if
510		different from ${SCRIPTS}. These can be further specialized
511		by setting SCRIPTSNAME_<script>.
512
513FILES		A list of files to install. The installation is controlled
514		by the FILESNAME, FILESOWN, FILESGRP, FILESMODE, FILESDIR
515		variables that can be further specialized by FILES<VAR>_<file>
516
517SHLINKDIR	Target directory for shared linker.
518
519The include file <bsd.prog.mk> includes the file named "../Makefile.inc"
520if it exists, as well as the include file <bsd.man.mk>.
521
522Some simple examples:
523
524To build foo from foo.c with a manual page foo.1, use:
525
526	PROG=	foo
527
528	.include <bsd.prog.mk>
529
530To build foo from foo.c with a manual page foo.2, add the line:
531
532	MAN=	foo.2
533
534If foo does not have a manual page at all, add the line:
535
536	MKMAN=	no
537
538If foo has multiple source files, add the line:
539
540	SRCS=	a.c b.c c.c d.c
541
542=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
543
544The include file <bsd.subdir.mk> contains the default targets for building
545subdirectories.  It has the same eight targets as <bsd.prog.mk>: all,
546clean, cleandir, depend, includes, install, lint, and tags.  For all of
547the directories listed in the variable SUBDIR, the specified directory
548will be visited and the target made.  There is also a default target which
549allows the command "make subdir" where subdir is any directory listed in
550the variable SUBDIR.
551
552As a special case, the use of a token .WAIT as an entry in SUBDIR acts
553as a synchronization barrier when multiple make jobs are run; subdirs
554before the .WAIT must complete before any subdirs after .WAIT are
555started.  See make(1) for some caveats on use of .WAIT and other
556special sources.
557
558=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
559
560The include file <bsd.links.mk> handles the LINKS and SYMLINKS variables
561and is included from from bsd.lib.mk and bsd.prog.mk.
562
563=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
564
565The include file <bsd.files.mk> handles the FILES variables and is included
566from bsd.lib.mk and bsd.prog.mk.
567
568=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
569
570The include file <bsd.inc.mk> defines the includes target and uses two
571variables:
572
573INCS		The list of include files
574
575INCSDIR		The location to install the include files.
576
577INCSNAME	Target name of the include file, if only one; same as
578		FILESNAME, but for include files.
579
580INCSNAME_<file>	The name file <file> should be installed as, if not <file>,
581		same as FILESNAME_<file>, but for include files.
582
583=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
584
585The include file <bsd.kinc.mk> defines the many targets (includes,
586subdirectories, etc.), and is used by kernel makefiles to handle
587include file installation.  It is intended to be included alone, by
588kernel Makefiles.  Please see bsd.kinc.mk for more details, and keep
589the documentation in that file up to date.
590
591=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
592
593The include file <bsd.info.mk> is used to generate and install GNU Info
594documentation from respective Texinfo source files.  It defines three
595implicit targets (.txi.info, .texi.info, and .texinfo.info), and uses the
596following variables:
597
598TEXINFO		List of Texinfo source files.  Info documentation will
599		consist of single files with the extension replaced by
600		.info.
601
602INFOFLAGS	Flags to pass to makeinfo.  []
603
604INSTALL_INFO	Name of install-info program.  [install-info]
605
606MAKEINFO	Name of makeinfo program.  [makeinfo]
607
608=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
609
610The include file <bsd.sys.mk> is used by <bsd.prog.mk> and
611<bsd.lib.mk>.  It contains overrides that are used when building
612the NetBSD source tree.  For instance, if "PARALLEL" is defined by
613the program/library Makefile, it includes a set of rules for lex and
614yacc that allow multiple lex and yacc targets to be built in parallel.
615
616Other variables of note (incomplete list):
617
618WARNS		Crank up gcc warning options; the distinct levels are:
619			WARNS=1
620			WARNS=2
621			WARNS=3
622
623FORMAT_AUDIT	If FORMAT_AUDIT is set, and WFORMAT is set and > 1, turn on
624WFORMAT 	-Wnetbsd-format-audit for extra-stringent format checking.
625		WFORMAT belongs in individual makefiles and/or
626		Makefile.inc files.  (set WFORMAT=1 in individual
627		makefiles if a program is not security critical and is
628		doing bizarre things with format strings which would
629		be even uglier if rewritten) FORMAT_AUDIT should go in
630		mk.conf if you're doing format-string auditing.
631		FORMAT_AUDIT may go away in time.
632
633=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
634
635The include file <bsd.lib.mk> has support for building libraries.  It has
636the same eight targets as <bsd.prog.mk>: all, clean, cleandir, depend,
637includes, install, lint, and tags.  Additionally, it has a checkver target
638which checks for installed shared object libraries whose version is greater
639that the version of the source. It has a limited number of suffixes,
640consistent with the current needs of the BSD tree.
641
642It sets/uses the following variables:
643
644LIB		The name of the library to build.
645
646LIBDIR		Target directory for libraries.
647
648SHLIBDIR	Target directory for shared libraries if ${USE_SHLIBDIR}
649		is "yes".
650
651USE_SHLIBDIR	If "yes", use ${SHLIBDIR} instead of ${LIBDIR}
652		as the path to install shared libraries to.
653
654LINTLIBDIR	Target directory for lint libraries.
655
656LIBGRP		Library group.
657
658LIBOWN		Library owner.
659
660LIBMODE		Library mode.
661
662LDADD		Additional loader objects.
663
664MAN		The manual pages to be installed (use a .1 - .9 suffix).
665
666MKLINKLIB	If "no", act as "MKPICINSTALL=no MKPROFILE=no".
667		Also:
668			- don't install the .a libraries
669			- don't install _pic.a libraries on PIC systems
670			- don't build .a libraries on PIC systems
671			- don't install the .so symlink on ELF systems
672		I.e, only install the shared library (and the .so.major
673		symlink on ELF).
674
675MKPICLIB	If "no", don't build _pic.a libraries, and build the
676		shared object libraries from the .a libraries.  A
677		symlink is installed in ${DESTDIR}/usr/lib for the
678		_pic.a library pointing to the .a library.
679
680NOCHECKVER_<library>
681NOCHECKVER	If set, disables checking for installed shared object
682		libraries with versions greater than the source.  A
683		particular library name, without the "lib" prefix, may
684		be appended to the variable name to disable the check for
685		only that library.
686
687SRCS		List of source files to build the library.  Suffix types
688		.s, .c, and .f are supported.  Note, .s files are preferred
689		to .c files of the same name.  (This is not the default for
690		versions of make.)
691
692The include file <bsd.lib.mk> includes the file named "../Makefile.inc"
693if it exists, as well as the include file <bsd.man.mk>.
694
695It has rules for building profiled objects; profiled libraries are
696built by default.
697
698Libraries are ranlib'd when made.
699
700=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
701
702The include file <bsd.obj.mk> defines targets related to the creation
703and use of separated object and source directories.
704
705If an environment variable named MAKEOBJDIRPREFIX is set, make(1) uses
706${MAKEOBJDIRPREFIX}${.CURDIR} as the name of the object directory if
707it exists.  Otherwise make(1) looks for the existence of a
708subdirectory (or a symlink to a directory) of the source directory
709into which built targets should be placed.  If an environment variable
710named MAKEOBJDIR is set, make(1) uses its value as the name of the
711object directory; failing that, make first looks for a subdirectory
712named "obj.${MACHINE}", and if that doesn't exist, it looks for "obj".
713
714Object directories are not created automatically by make(1) if they
715don't exist; you need to run a separate "make obj".  (This will happen
716during a top-level build if "MKOBJDIRS" is set to a value other than
717"no").  When the source directory is a subdirectory of ${BSDSRCDIR} --
718and this is determined by a simple string prefix comparison -- object
719directories are created in a separate object directory tree, and a
720symlink to the object directory in that tree is created in the source
721directory; otherwise, "make obj" assumes that you're not in the main
722source tree and that it's not safe to use a separate object tree.
723
724Several variables used by <bsd.obj.mk> control exactly what
725directories and links get created during a "make obj":
726
727MAKEOBJDIR	If set, this is the component name of the object
728		directory.
729
730OBJMACHINE	If this is set but MAKEOBJDIR is not set, creates
731		object directories or links named "obj.${MACHINE}";
732		otherwise, just creates ones named "obj".
733
734USR_OBJMACHINE  If set, and the current directory is a subdirectory of
735		${BSDSRCDIR}, create object directory in the
736		corresponding subdirectory of ${BSDOBJDIR}.${MACHINE};
737		otherwise, create it in the corresponding subdirectory
738		of ${BSDOBJDIR}
739
740BUILDID		If set, the contents of this variable are appended
741		to the object directory name.  If OBJMACHINE is also
742		set, ".${BUILDID}" is added after ".${MACHINE}".
743
744=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
745
746The include file <bsd.kernobj.mk> defines variables related to the
747location of kernel sources and object directories.
748
749KERNSRCDIR	Is the location of the top of the kernel src.
750		It defaults to ${_SRC_TOP_}/sys
751
752KERNARCHDIR	Is the location of the machine dependent kernel
753		sources.  It defaults to arch/${MACHINE}
754
755KERNCONFDIR	Is where the configuration files for kernels are
756		found; default is ${KERNSRCDIR}/${KERNARCHDIR}/conf.
757
758KERNOBJDIR	Is the kernel build directory.  The kernel GENERIC for
759		instance will be compiled in ${KERNOBJDIR}/GENERIC.
760		The default value is
761		${MAKEOBJDIRPREFIX}${KERNSRCDIR}/${KERNARCHDIR}/compile
762		if it exists or the target 'obj' is being made.
763		Otherwise the default is
764		${KERNSRCDIR}/${KERNARCHDIR}/compile.
765
766It is important that Makefiles (such as those under src/distrib) that
767wish to find compiled kernels use bsd.kernobj.mk and ${KERNOBJDIR}
768rather than make assumptions about the location of the compiled kernel.
769
770=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
771