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