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