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