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