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