bsd.README revision 1.116
1# $NetBSD: bsd.README,v 1.116 2003/07/10 10:34:35 lukem 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. 68 Not intended for users. 69 This is to allow Makefiles to disable functionality 70 that they don't support (such as missing man pages). 71 NOxxx variables must be defined before <bsd.own.mk> 72 is included. 73 74The following variables that control how things are made/installed that 75are not set by default. These should not be set by Makefiles; they're for 76the user to define in MAKECONF (see bsd.own.mk, below) or on the make(1) 77command line: 78 79BUILD If defined, 'make install' checks that the targets in the 80 source directories are up-to-date and remakes them if they 81 are out of date, instead of blindly trying to install 82 out of date or non-existent targets. 83 84UPDATE If defined, 'make install' only installs targets that are 85 more recently modified in the source directories that their 86 installed counterparts. 87 88UNPRIVED If defined, don't set the owner/group/mode when installing 89 files or directories, and keep a metadata log of what 90 the owner/group/mode should be. This allows a 91 non-root "make install". 92 93MKBFD If "no", don't build libbfd, libiberty, or any of 94 the things that depend on them (binutils/gas/ld, 95 gdb, dbsym, mdsetimage). 96 97MKCATPAGES If "no", don't build or install the catman pages. 98 99MKDOC If "no", don't build or install the documentation. 100 101MKDYNAMICROOT If "no", build programs in /bin and /sbin statically, 102 don't install certain libraries in /lib, and don't 103 install the shared linker into /libexec. 104 105MKGDB If "no", don't build gdb. 106 107MKGCC If "no", don't build gcc or any of the gcc-related 108 libraries (libg2c, libgcc, libobjc, libstdc++). 109 110MKIEEEFP If "no", don't add code for IEEE754/IEC60559 conformance. 111 Has no effect on most platforms. 112 113MKINFO If "no", don't build or install Info documentation from 114 Texinfo source files. 115 116MKLINT If "no", don't build or install the lint libraries. 117 118MKMAN If "no", don't build or install the man or catman pages. 119 Also acts as "MKCATPAGES=no" 120 121MKNLS If "no", don't build or install the NLS files and locale 122 definition files. 123 124MKOBJ If "no", don't enable the rule which creates objdirs. 125 "yes" by default. 126 127MKOBJDIRS If "no", don't create objdirs during a "make build". 128 "no" by default. 129 130MKPIC If "no", don't build or install shared libraries. 131 132MKPICINSTALL If "no", don't install the *_pic.a libraries. 133 134MKPROFILE If "no", don't build or install the profiling libraries. 135 136MKSHARE If "no", act as "MKCATPAGES=no MKDOC=no MKINFO=no MKMAN=no 137 MKNLS=no". I.e, don't build catman pages, documentation, 138 Info documentation, man pages, NLS files, ... 139 140=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 141 142The include file <sys.mk> has the default rules for all makes, in the BSD 143environment or otherwise. You probably don't want to touch this file. 144If you intend to run a cross build, you will need to supply the following 145host tools, and configure the following variables properly: 146 147OBJCOPY objcopy - copy and translate object files 148 149STRIP strip - Discard symbols from object files 150 151=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 152 153The include file <bsd.man.mk> handles installing manual pages and their 154links. 155 156It has a two targets: 157 158 maninstall: 159 Install the manual page sources and their links. 160 catinstall: 161 Install the preformatted manual pages and their links. 162 163It sets/uses the following variables: 164 165MANDIR Base path for manual installation. 166 167MANGRP Manual group. 168 169MANOWN Manual owner. 170 171MANMODE Manual mode. 172 173MANSUBDIR Subdirectory under the manual page section, i.e. "/vax" 174 or "/tahoe" for machine specific manual pages. 175 176MAN The manual pages to be installed (use a .1 - .9 suffix). 177 178MLINKS List of manual page links (using a .1 - .9 suffix). The 179 linked-to file must come first, the linked file second, 180 and there may be multiple pairs. The files are soft-linked. 181 182The include file <bsd.man.mk> includes a file named "../Makefile.inc" if 183it exists. 184 185=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 186 187The include file <bsd.own.mk> contains source tree configuration parameters, 188such as the owners, groups, etc. for both manual pages and binaries, and 189a few global "feature configuration" parameters. 190 191It has no targets. 192 193To get system-specific configuration parameters, bsd.own.mk will try to 194include the file specified by the "MAKECONF" variable. If MAKECONF is not 195set, or no such file exists, the system make configuration file, /etc/mk.conf 196is included. These files may define any of the variables described below. 197 198bsd.own.mk sets the following variables, if they are not already defined 199(defaults are in brackets): 200 201NETBSDSRCDIR Top of the NetBSD source tree. 202 If _SRC_TOP_ != "", that will be used as the default, 203 otherwise BSDSRCDIR will be used as the default. 204 Various makefiles within the NetBSD source tree will 205 use this to reference the top level of the source tree. 206 207_SRC_TOP_ Top of the system source tree, as determined by <bsd.own.mk> 208 based on the presence of tools/ and build.sh. This variable 209 is "internal" to <bsd.own.mk>, although its value is only 210 determined once and then propagated to all sub-makes. 211 212BSDSRCDIR The real path to the system sources, so that 'make obj' 213 will work correctly. [/usr/src] 214 215BSDOBJDIR The real path to the system 'obj' tree, so that 'make obj' 216 will work correctly. [/usr/obj] 217 218BINGRP Binary group. [wheel] 219 220BINOWN Binary owner. [root] 221 222BINMODE Binary mode. [555] 223 224NONBINMODE Mode for non-executable files. [444] 225 226MANDIR Base path for manual installation. [/usr/share/man/cat] 227 228MANGRP Manual group. [wheel] 229 230MANOWN Manual owner. [root] 231 232MANMODE Manual mode. [${NONBINMODE}] 233 234MANINSTALL Manual installation type: maninstall, catinstall, or both 235 236LDSTATIC Control program linking; if set blank, link everything 237 dynamically. If set to "-static", link everything statically. 238 If not set, programs link according to their makefile. 239 240LIBDIR Base path for library installation. [/usr/lib] 241 242LINTLIBDIR Base path for lint(1) library installation. [/usr/libdata/lint] 243 244LIBGRP Library group. [${BINGRP}] 245 246LIBOWN Library owner. [${BINOWN}] 247 248LIBMODE Library mode. [${NONBINMODE}] 249 250DOCDIR Base path for system documentation (e.g. PSD, USD, etc.) 251 installation. [/usr/share/doc] 252 253HTMLDOCDIR Base path for html system documentation installation. 254 [/usr/share/doc/html] 255 256DOCGRP Documentation group. [wheel] 257 258DOCOWN Documentation owner. [root] 259 260DOCMODE Documentation mode. [${NONBINMODE}] 261 262NLSDIR Base path for Native Language Support files installation. 263 [/usr/share/nls] 264 265NLSGRP Native Language Support files group. [wheel] 266 267NLSOWN Native Language Support files owner. [root] 268 269NLSMODE Native Language Support files mode. [${NONBINMODE}] 270 271STRIPFLAG The flag passed to the install program to cause the binary 272 to be stripped. This is to be used when building your 273 own install script so that the entire system can be made 274 stripped/not-stripped using a single knob. [-s] 275 276COPY The flag passed to the install program to cause the binary 277 to be copied rather than moved. This is to be used when 278 building our own install script so that the entire system 279 can either be installed with copies, or with moves using 280 a single knob. [-c] 281 282Additionally, the following variables may be set by bsd.own.mk or in a 283make configuration file to modify the behaviour of the system build 284process (default values are in brackets along with comments, if set by 285bsd.own.mk): 286 287MKPICLIB bsd.own.mk provides a default for this variable, which is 288 used by bsd.lib.mk. The default value is provided by 289 bsd.own.mk since non-library Makefiles may need to check 290 its value in order to generate proper dependencies against 291 libraries used only during the build process (which would 292 not be installed into the destination directory). 293 294MKCRYPTO If set to "no", no cryptography support will be built 295 into the system. Defaults to "yes". 296 297MKCRYPTO_IDEA If set to "yes", IDEA support will be built into 298 libcrypto_idea.a. Defaults to "no". 299 300MKCRYPTO_MDC2 If set to "yes", MDC2 support will be built into 301 libcrypto_mdc2.a. Defaults to "no". 302 303MKCRYPTO_RC5 If set to "yes", RC5 support will be built into 304 libcrypto_rc5.a. Defaults to "no". 305 306MKHESIOD If set to "no", disables building of Hesiod infrastructure 307 (libraries and support programs). 308 309MKKERBEROS If set to "no", disables building of Kerberos (v4 or v5) 310 infrastructure (libraries and support programs). 311 312MKSKEY If set to "no", disables building of S/key authentication 313 infrastructure (libraries and support programs). 314 315MKYP If set to "no", disables building of YP (NIS) 316 infrastructure (libraries and support programs). 317 318USE_HESIOD If set to "no", disables building Hesiod support into 319 various system utilities/libraries that support it. 320 If MKHESIOD is set to "no", USE_HESIOD will also be 321 forced to "no". 322 323USE_KERBEROS If set to "no", disables building Kerberos (v4 or v5) 324 support into various system utilities/libraries that 325 support it. If MKKERBEROS is set to "no", USE_KERBEROS 326 will also be forced to "no". 327 328USE_SKEY If set to "no", disables building S/key authentication 329 support into various system utilities/libraries that 330 support it. If MKSKEY is set to "no", USE_SKEY will 331 also be forced to "no". 332 333USE_YP If set to "no", disables building YP (NIS) support into 334 various system utilities/libraries that support it. If 335 MKYP is set to "no", USE_YP will also be forced to "no". 336 337MANZ Compress manual pages at installation time. 338 339NOPROFILE Do not build profiled versions of system libraries 340 341NOPIC Do not build PIC versions of system libraries, and 342 do not build shared libraries. [set if ${MACHINE_ARCH} 343 is "sh3" and ${OBJECT_FMT} is "COFF", unset otherwise.] 344 345NOLINT Do not build lint libraries. 346 347OBJECT_FMT Object file format. [set to "ELF" on architectures that 348 use ELF -- currently if ${MACHINE_ARCH} is "alpha", 349 "mipsel", "mipseb", "powerpc", "sparc", "sparc64", 350 "i386" and some m68k machines, or set to "a.out" on 351 other architectures]. 352 353MKSOFTFLOAT If "yes", build with options to enable the compiler to 354 generate output containing library calls for floating 355 point and possibly soft-float library support. Defaults 356 to "no". 357 358TOOLCHAIN_MISSING 359 If "yes", this indicates that the platform being built 360 does not have a working in-tree toolchain. If the 361 MACHINE_ARCH in question falls into this category, the 362 variable is conditionally assigned the value "yes". 363 Otherwise, the variable is unconditionally assigned the 364 value "no". 365 366 If TOOLCHAIN_MISSING is "yes", the variables MKBFD, MKGCC, 367 and MKGDB are unconditionally assigned the value "no". 368 369EXTERNAL_TOOLCHAIN 370 This variable is not directly set by <bsd.own.mk>, but 371 including <bsd.own.mk> is the canonical way to gain 372 access to this variable. The variable should be defined 373 either in the user's environment or in the user's mk.conf 374 file. If defined, this variable indicates the root of 375 an external toolchain which will be used to build the 376 tree. For example, if a platform is a TOOLCHAIN_MISSING 377 platform, EXTERNAL_TOOLCHAIN can be used to re-enable the 378 cross-compile framework. 379 380 If EXTERNAL_TOOLCHAIN is defined, the variable MKGCC is 381 unconditionally assigned the value "no", since the external 382 version of the compiler may not be able to build the library 383 components of the in-tree compiler. 384 385 NOTE: This variable is not yet used in as many places as 386 it should be. Expect the exact semantics of this variable 387 to change in the short term as parts of the cross-compile 388 framework continue to be cleaned up. 389 390bsd.own.mk is generally useful when building your own Makefiles so that 391they use the same default owners etc. as the rest of the tree. 392 393=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 394 395The include file <bsd.shlib.mk> computes parameters for shared library 396installation and use. It defines no targets. <bsd.own.mk> MUST be 397included before bsd.shlib.mk. 398 399bsd.own.mk sets the following variables, if they are not already defined 400(defaults are in brackets): 401 402SHLIBINSTALLDIR If ${USE_SHLIBDIR} is "yes", use ${SHLIBINSTALLDIR} instead of 403 ${LIBDIR} as the base path for shared library installation. 404 [/lib] 405 406SHLIBDIR The path to USE_SHLIBDIR shared libraries to use when building 407 a program. [/lib for programs in /bin and /sbin, /usr/lib 408 for all others.] 409 410_LIBSODIR Set to ${SHLIBINSTALLDIR} if ${USE_SHLIBDIR} is "yes", 411 otherwise set to ${LIBDIR} 412 413SHLINKINSTALLDIR Base path for shared linker. [/libexec] 414 415SHLINKDIR Path to use for shared linker when building a program. 416 [/libexec for programs in /bin and /sbin, /usr/libexec for 417 all others.] 418 419=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 420 421The include file <bsd.gcc.mk> computes various parameters related to GCC 422support libraries. It defines no targets. <bsd.own.mk> MUST be included 423before bsd.gcc.mk. 424 425The primary users of bsd.gcc.mk are <bsd.prog.mk> and <bsd.lib.mk>, each 426of which need to know where to find certain GCC support libraries. 427 428The behavior of bsd.gcc.mk is influenced by the EXTERNAL_TOOLCHAIN variable, 429which is generally set by the user. If EXTERNAL_TOOLCHAIN it set, then 430the compiler is asked where to find the support libraries, otherwise the 431support libraries are found in ${DESTDIR}/usr/lib. 432 433bsd.gcc.mk sets the following variables: 434 435_GCC_CRTBEGIN The full path name to crtbegin.o. 436 437_GCC_CRTBEGINS The full path name to crtbeginS.o. 438 439_GCC_CRTEND The full path name to crtend.o. 440 441_GCC_CRTENDS The full path name to crtendS.o. 442 443_GCC_LIBGCCDIR The directory where libgcc.a is located. 444 445=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 446 447The include file <bsd.prog.mk> handles building programs from one or 448more source files, along with their manual pages. It has a limited number 449of suffixes, consistent with the current needs of the BSD tree. bsd.prog.mk 450includes <bsd.shlib.mk> to get shared library parameters. 451 452It has eight targets: 453 454 all: 455 build the program and its manual page. This also 456 creates a GDB initialization file (.gdbinit) in 457 the objdir. The .gdbinit file sets the shared library 458 prefix to ${DESTDIR} to facilitate cross-debugging. 459 clean: 460 remove the program, any object files and the files a.out, 461 Errs, errs, mklog, and ${PROG}.core. 462 cleandir: 463 remove all of the files removed by the target clean, as 464 well as .depend, tags, and any manual pages. 465 `distclean' is a synonym for `cleandir'. 466 depend: 467 make the dependencies for the source files, and store 468 them in the file .depend. 469 includes: 470 install any header files. 471 install: 472 install the program and its manual pages; if the Makefile 473 does not itself define the target install, the targets 474 beforeinstall and afterinstall may also be used to cause 475 actions immediately before and after the install target 476 is executed. 477 lint: 478 run lint on the source files 479 tags: 480 create a tags file for the source files. 481 482It sets/uses the following variables: 483 484BINGRP Binary group. 485 486BINOWN Binary owner. 487 488BINMODE Binary mode. 489 490CLEANFILES Additional files to remove for the clean and cleandir targets. 491 492COPTS Additional flags to the compiler when creating C objects. 493 494CPUFLAGS Additional flags to the compiler/assembler to select 495 CPU instruction set options, CPU tuning options, etc. 496 497CPPFLAGS Additional flags to the C pre-processor 498 499GDBINIT List of GDB initialization files to add to "source" 500 directives in the .gdbinit file that is created in the 501 objdir. 502 503LDADD Additional loader objects. Usually used for libraries. 504 For example, to load with the compatibility and utility 505 libraries, use: 506 507 LDADD+=-lutil -lcompat 508 509LDFLAGS Additional loader flags. 510 511LINKS The list of binary links; should be full pathnames, the 512 linked-to file coming first, followed by the linked 513 file. The files are hard-linked. For example, to link 514 /bin/test and /bin/[, use: 515 516 LINKS= ${DESTDIR}/bin/test ${DESTDIR}/bin/[ 517 518SYMLINKS The list of symbolic links; should be full pathnames. 519 Syntax is identical to LINKS. Note that DESTDIR is not 520 automatically included in the link. 521 522MAN Manual pages (should end in .1 - .9). If no MAN variable is 523 defined, "MAN=${PROG}.1" is assumed. 524 525PROG The name of the program to build. If not supplied, nothing 526 is built. 527 528PROG_CXX If defined, the name of the program to build. Also 529 causes <bsd.prog.mk> to link the program with the C++ 530 compiler rather than the C compiler. PROG_CXX overrides 531 the value of PROG if PROG is also set. 532 533PROGNAME The name that the above program will be installed as, if 534 different from ${PROG}. 535 536SRCS List of source files to build the program. If SRCS is not 537 defined, it's assumed to be ${PROG}.c. 538 539DPSRCS List of source files which are needed for generating 540 dependencies, but are not needed in ${SRCS}. 541 542DPADD Additional dependencies for the program. Usually used for 543 libraries. For example, to depend on the compatibility and 544 utility libraries use: 545 546 DPADD+=${LIBCOMPAT} ${LIBUTIL} 547 548 The following libraries are predefined for DPADD: 549 550 LIBCRT0?= ${DESTDIR}/usr/lib/crt0.o 551 LIBBZ2?= ${DESTDIR}/usr/lib/libbz2.a 552 LIBC?= ${DESTDIR}/usr/lib/libc.a 553 LIBC_PIC?= ${DESTDIR}/usr/lib/libc_pic.a 554 LIBCDK?= ${DESTDIR}/usr/lib/libcdk.a 555 LIBCOM_ERR?= ${DESTDIR}/usr/lib/libcom_err.a 556 LIBCOMPAT?= ${DESTDIR}/usr/lib/libcompat.a 557 LIBCRYPT?= ${DESTDIR}/usr/lib/libcrypt.a 558 LIBCRYPTO?= ${DESTDIR}/usr/lib/libcrypto.a 559 LIBCRYPTO_IDEA?=${DESTDIR}/usr/lib/libcrypto_idea.a 560 LIBCRYPTO_MDC2?=${DESTDIR}/usr/lib/libcrypto_mdc2.a 561 LIBCRYPTO_RC5?= ${DESTDIR}/usr/lib/libcrypto_rc5.a 562 LIBCURSES?= ${DESTDIR}/usr/lib/libcurses.a 563 LIBDBM?= ${DESTDIR}/usr/lib/libdbm.a 564 LIBDES?= ${DESTDIR}/usr/lib/libdes.a 565 LIBEDIT?= ${DESTDIR}/usr/lib/libedit.a 566 LIBEVENT?= ${DESTDIR}/usr/lib/libevent.a 567 LIBFORM?= ${DESTDIR}/usr/lib/libform.a 568 LIBGCC?= ${DESTDIR}/usr/lib/libgcc.a 569 LIBGNUMALLOC?= ${DESTDIR}/usr/lib/libgnumalloc.a 570 LIBGSSAPI?= ${DESTDIR}/usr/lib/libgssapi.a 571 LIBHDB?= ${DESTDIR}/usr/lib/libhdb.a 572 LIBINTL?= ${DESTDIR}/usr/lib/libintl.a 573 LIBIPSEC?= ${DESTDIR}/usr/lib/libipsec.a 574 LIBKADM?= ${DESTDIR}/usr/lib/libkadm.a 575 LIBKADM5CLNT?= ${DESTDIR}/usr/lib/libkadm5clnt.a 576 LIBKADM5SRV?= ${DESTDIR}/usr/lib/libkadm5srv.a 577 LIBKAFS?= ${DESTDIR}/usr/lib/libkafs.a 578 LIBKDB?= ${DESTDIR}/usr/lib/libkdb.a 579 LIBKRB?= ${DESTDIR}/usr/lib/libkrb.a 580 LIBKRB5?= ${DESTDIR}/usr/lib/libkrb5.a 581 LIBKSTREAM?= ${DESTDIR}/usr/lib/libkstream.a 582 LIBKVM?= ${DESTDIR}/usr/lib/libkvm.a 583 LIBL?= ${DESTDIR}/usr/lib/libl.a 584 LIBM?= ${DESTDIR}/usr/lib/libm.a 585 LIBMENU?= ${DESTDIR}/usr/lib/libmenu.a 586 LIBMP?= ${DESTDIR}/usr/lib/libmp.a 587 LIBNTP?= ${DESTDIR}/usr/lib/libntp.a 588 LIBOBJC?= ${DESTDIR}/usr/lib/libobjc.a 589 LIBOSSAUDIO?= ${DESTDIR}/usr/lib/libossaudio.a 590 LIBPC?= ${DESTDIR}/usr/lib/libpc.a 591 LIBPCAP?= ${DESTDIR}/usr/lib/libpcap.a 592 LIBPCI?= ${DESTDIR}/usr/lib/libpci.a 593 LIBPLOT?= ${DESTDIR}/usr/lib/libplot.a 594 LIBPMC?= ${DESTDIR}/usr/lib/libpmc.a 595 LIBPOSIX?= ${DESTDIR}/usr/lib/libposix.a 596 LIBPTHREAD?= ${DESTDIR}/usr/lib/libpthread.a 597 LIBPTHREAD_DBG?=${DESTDIR}/usr/lib/libpthread_dbg.a 598 LIBRESOLV?= ${DESTDIR}/usr/lib/libresolv.a 599 LIBRMT?= ${DESTDIR}/usr/lib/librmt.a 600 LIBROKEN?= ${DESTDIR}/usr/lib/libroken.a 601 LIBRPCSVC?= ${DESTDIR}/usr/lib/librpcsvc.a 602 LIBRT?= ${DESTDIR}/usr/lib/librt.a 603 LIBSKEY?= ${DESTDIR}/usr/lib/libskey.a 604 LIBSS?= ${DESTDIR}/usr/lib/libss.a 605 LIBSSL?= ${DESTDIR}/usr/lib/libssl.a 606 LIBSKEY?= ${DESTDIR}/usr/lib/libskey.a 607 LIBSL?= ${DESTDIR}/usr/lib/libsl.a 608 LIBTERMCAP?= ${DESTDIR}/usr/lib/libtermcap.a 609 LIBTELNET?= ${DESTDIR}/usr/lib/libtelnet.a 610 LIBUSBHID?= ${DESTDIR}/usr/lib/libusbhid.a 611 LIBUTIL?= ${DESTDIR}/usr/lib/libutil.a 612 LIBWRAP?= ${DESTDIR}/usr/lib/libwrap.a 613 LIBY?= ${DESTDIR}/usr/lib/liby.a 614 LIBZ?= ${DESTDIR}/usr/lib/libz.a 615 616SHAREDSTRINGS If defined, a new .c.o rule is used that results in shared 617 strings, using xstr(1). Note that this will not work with 618 parallel makes. 619 620STRIPFLAG The flag passed to the install program to cause the binary 621 to be stripped. 622 623SUBDIR A list of subdirectories that should be built as well. 624 Each of the targets will execute the same target in the 625 subdirectories. 626 627SCRIPTS A list of interpreter scripts [file.{sh,csh,pl,awk,...}]. 628 These are installed exactly like programs. 629 630SCRIPTSNAME The name that the above program will be installed as, if 631 different from ${SCRIPTS}. These can be further specialized 632 by setting SCRIPTSNAME_<script>. 633 634FILES A list of files to install. The installation is controlled 635 by the FILESNAME, FILESOWN, FILESGRP, FILESMODE, FILESDIR 636 variables that can be further specialized by FILES<VAR>_<file> 637 638SHLINKDIR Target directory for shared linker. See description of 639 <bsd.own.mk> for additional information about this variable. 640 641The include file <bsd.prog.mk> includes the file named "../Makefile.inc" 642if it exists, as well as the include file <bsd.man.mk>. 643 644Some simple examples: 645 646To build foo from foo.c with a manual page foo.1, use: 647 648 PROG= foo 649 650 .include <bsd.prog.mk> 651 652To build foo from foo.c with a manual page foo.2, add the line: 653 654 MAN= foo.2 655 656If foo does not have a manual page at all, add the line: 657 658 MKMAN= no 659 660If foo has multiple source files, add the line: 661 662 SRCS= a.c b.c c.c d.c 663 664=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 665 666The include file <bsd.subdir.mk> contains the default targets for building 667subdirectories. It has the same eight targets as <bsd.prog.mk>: all, 668clean, cleandir, depend, includes, install, lint, and tags. For all of 669the directories listed in the variable SUBDIR, the specified directory 670will be visited and the target made. There is also a default target which 671allows the command "make subdir" where subdir is any directory listed in 672the variable SUBDIR. 673 674As a special case, the use of a token .WAIT as an entry in SUBDIR acts 675as a synchronization barrier when multiple make jobs are run; subdirs 676before the .WAIT must complete before any subdirs after .WAIT are 677started. See make(1) for some caveats on use of .WAIT and other 678special sources. 679 680=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 681 682The include file <bsd.links.mk> handles the LINKS and SYMLINKS variables 683and is included from from bsd.lib.mk and bsd.prog.mk. 684 685=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 686 687The include file <bsd.files.mk> handles the FILES variables and is included 688from bsd.lib.mk and bsd.prog.mk. 689 690=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 691 692The include file <bsd.inc.mk> defines the includes target and uses two 693variables: 694 695INCS The list of include files 696 697INCSDIR The location to install the include files. 698 699INCSNAME Target name of the include file, if only one; same as 700 FILESNAME, but for include files. 701 702INCSNAME_<file> The name file <file> should be installed as, if not <file>, 703 same as FILESNAME_<file>, but for include files. 704 705=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 706 707The include file <bsd.kinc.mk> defines the many targets (includes, 708subdirectories, etc.), and is used by kernel makefiles to handle 709include file installation. It is intended to be included alone, by 710kernel Makefiles. Please see bsd.kinc.mk for more details, and keep 711the documentation in that file up to date. 712 713=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 714 715The include file <bsd.info.mk> is used to generate and install GNU Info 716documentation from respective Texinfo source files. It defines three 717implicit targets (.txi.info, .texi.info, and .texinfo.info), and uses the 718following variables: 719 720TEXINFO List of Texinfo source files. Info documentation will 721 consist of single files with the extension replaced by 722 .info. 723 724INFOFLAGS Flags to pass to makeinfo. [] 725 726=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 727 728The include file <bsd.sys.mk> is used by <bsd.prog.mk> and 729<bsd.lib.mk>. It contains overrides that are used when building 730the NetBSD source tree. For instance, if "PARALLEL" is defined by 731the program/library Makefile, it includes a set of rules for lex and 732yacc that allow multiple lex and yacc targets to be built in parallel. 733 734The following variables are defined to commands to perform the 735appropriate operation, with the default in [brackets]. 736(Note that these are overridden in <bsd.own.mk> if USETOOLS=yes): 737 738TOOL_ASN1_COMPILE ASN1 compiler. [asn1_compile] 739 740TOOL_CAP_MKDB Create capability database. [cap_mkdb] 741 742TOOL_CAT Concatenate and print files. [cat] 743 744TOOL_CKSUM Display file checksums. [cksum] 745 746TOOL_COMPILE_ET Error table compiler. [compile_et] 747 748TOOL_CONFIG Build kernel compilation directories. [config] 749 750TOOL_CRUNCHGEN Generate crunched binary build environment. [crunchgen] 751 752TOOL_CTAGS Create a tags file. [ctags] 753 754TOOL_DB Manipulate db(3) databases. [db] 755 756TOOL_EQN Format equations for groff. [eqn] 757 758TOOL_FGEN IEEE 1275 Open Firmware FCode Tokenizer. [fgen] 759 760TOOL_GENCAT Generate NLS message catalogs. [gencat] 761 762TOOL_GROFF Front end for groff document formatting system. [groff] 763 764TOOL_HEXDUMP Ascii, decimal, hexadecimal, octal dump. [hexdump] 765 766TOOL_INDXBIB Make bibliographic database's inverted index. [indxbib] 767 768TOOL_INSTALLBOOT Install disk bootstrap software. [installboot] 769 770TOOL_INSTALL_INFO Update info/dir entries. [install-info] 771 772TOOL_M4 M4 macro language processor. [m4] 773 774TOOL_MAKEFS Create file system image from directory tree. [makefs] 775 776TOOL_MAKEINFO Translate Texinfo documents. [makeinfo] 777 778TOOL_MAKEWHATIS Create a whatis.db database. [makewhatis] 779 780TOOL_MDSETIMAGE Set kernel RAM disk image. [mdsetimage] 781 782TOOL_MENUC Menu compiler. [menuc] 783 784TOOL_MKCSMAPPER Make charset mapping table. [mkcsmapper] 785 786TOOL_MKESDB Make encoding scheme database. [mkesdb] 787 788TOOL_MKLOCALE Make LC_CTYPE locale files. [mklocale] 789 790TOOL_MKMAGIC Create database for file(1). [file] 791 792TOOL_MKTEMP Make (unique) temporary file name. [mktemp] 793 794TOOL_MSGC Simple message list compiler. [msgc] 795 796TOOL_MTREE Map a directory hierarchy. [mtree] 797 798TOOL_PAX Manipulate file archives and copy directories. [pax] 799 800TOOL_PIC Compile pictures for groff. [pic] 801 802TOOL_PREPMKBOOTIMAGE prep-mkbootimage (XXXBUILDSH). [prep-mkbootimage] 803 804TOOL_PWD_MKDB Generate the password databases. [pwd_mkdb] 805 806TOOL_REFER Preprocess bibliographic references for groff. [refer] 807 808TOOL_ROFF_ASCII Generate ASCII groff output. [nroff] 809 810TOOL_ROFF_DVI Generate DVI groff output. [${TOOL_GROFF} -Tdvi] 811 812TOOL_ROFF_HTML Generate HTML groff output. 813 [${TOOL_GROFF} -Tlatin1 -mdoc2html -P-b -P-o -P-u] 814 815TOOL_ROFF_PS Generate PS groff output. [${TOOL_GROFF} -Tps] 816 817TOOL_ROFF_RAW Generate "raw" groff output. [${TOOL_GROFF} -Z] 818 819TOOL_RPCGEN Remote Procedure Call (RPC) protocol compiler. [rpcgen] 820 821TOOL_SOELIM Eliminate .so's from groff input. [soelim] 822 823TOOL_SUNLABEL Read or modify a SunOS disk label. [sunlabel] 824 825TOOL_TBL Format tables for groff. [tbl] 826 827TOOL_UUDECODE Uudecode a binary file. [uudecode] 828 829TOOL_VGRIND Grind nice listings of programs. [vgrind -f] 830 831TOOL_ZIC Time zone compiler. [zic] 832 833 834Other variables of note (incomplete list): 835 836WARNS Crank up gcc warning options; the distinct levels are: 837 WARNS=1 838 WARNS=2 839 WARNS=3 840 841FORMAT_AUDIT If FORMAT_AUDIT is set, and WFORMAT is set and > 1, turn on 842WFORMAT -Wnetbsd-format-audit for extra-stringent format checking. 843 WFORMAT belongs in individual makefiles and/or 844 Makefile.inc files. (set WFORMAT=1 in individual 845 makefiles if a program is not security critical and is 846 doing bizarre things with format strings which would 847 be even uglier if rewritten) FORMAT_AUDIT should go in 848 mk.conf if you're doing format-string auditing. 849 FORMAT_AUDIT may go away in time. 850 851=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 852 853The include file <bsd.lib.mk> has support for building libraries. It has 854the same eight targets as <bsd.prog.mk>: all, clean, cleandir, depend, 855includes, install, lint, and tags. Additionally, it has a checkver target 856which checks for installed shared object libraries whose version is greater 857that the version of the source. It has a limited number of suffixes, 858consistent with the current needs of the BSD tree. bsd.lib.mk includes 859<bsd.shlib.mk> to get shared library parameters. 860 861It sets/uses the following variables: 862 863LIB The name of the library to build. 864 865LIBDIR Target directory for libraries. 866 867SHLIBINSTALLDIR Target directory for shared libraries if ${USE_SHLIBDIR} 868 is "yes". 869 870USE_SHLIBDIR If "yes", use ${SHLIBINSTALLDIR} instead of ${LIBDIR} 871 as the path to install shared libraries to. 872 USE_SHLIBDIR must be defined before <bsd.own.mk> is included. 873 874LINTLIBDIR Target directory for lint libraries. 875 876LIBGRP Library group. 877 878LIBOWN Library owner. 879 880LIBMODE Library mode. 881 882LDADD Additional loader objects. 883 884MAN The manual pages to be installed (use a .1 - .9 suffix). 885 886MKLINKLIB If "no", act as "MKPICINSTALL=no MKPROFILE=no". 887 Also: 888 - don't install the .a libraries 889 - don't install _pic.a libraries on PIC systems 890 - don't build .a libraries on PIC systems 891 - don't install the .so symlink on ELF systems 892 I.e, only install the shared library (and the .so.major 893 symlink on ELF). 894 895MKPICLIB If "no", don't build _pic.a libraries, and build the 896 shared object libraries from the .a libraries. A 897 symlink is installed in ${DESTDIR}/usr/lib for the 898 _pic.a library pointing to the .a library. 899 900NOCHECKVER_<library> 901NOCHECKVER If set, disables checking for installed shared object 902 libraries with versions greater than the source. A 903 particular library name, without the "lib" prefix, may 904 be appended to the variable name to disable the check for 905 only that library. 906 907SRCS List of source files to build the library. Suffix types 908 .s, .c, and .f are supported. Note, .s files are preferred 909 to .c files of the same name. (This is not the default for 910 versions of make.) 911 912The include file <bsd.lib.mk> includes the file named "../Makefile.inc" 913if it exists, as well as the include file <bsd.man.mk>. 914 915It has rules for building profiled objects; profiled libraries are 916built by default. 917 918Libraries are ranlib'd when made. 919 920=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 921 922The include file <bsd.obj.mk> defines targets related to the creation 923and use of separated object and source directories. 924 925If an environment variable named MAKEOBJDIRPREFIX is set, make(1) uses 926${MAKEOBJDIRPREFIX}${.CURDIR} as the name of the object directory if 927it exists. Otherwise make(1) looks for the existence of a 928subdirectory (or a symlink to a directory) of the source directory 929into which built targets should be placed. If an environment variable 930named MAKEOBJDIR is set, make(1) uses its value as the name of the 931object directory; failing that, make first looks for a subdirectory 932named "obj.${MACHINE}", and if that doesn't exist, it looks for "obj". 933 934Object directories are not created automatically by make(1) if they 935don't exist; you need to run a separate "make obj". (This will happen 936during a top-level build if "MKOBJDIRS" is set to a value other than 937"no"). When the source directory is a subdirectory of ${BSDSRCDIR} -- 938and this is determined by a simple string prefix comparison -- object 939directories are created in a separate object directory tree, and a 940symlink to the object directory in that tree is created in the source 941directory; otherwise, "make obj" assumes that you're not in the main 942source tree and that it's not safe to use a separate object tree. 943 944Several variables used by <bsd.obj.mk> control exactly what 945directories and links get created during a "make obj": 946 947MAKEOBJDIR If set, this is the component name of the object 948 directory. 949 950OBJMACHINE If this is set but MAKEOBJDIR is not set, creates 951 object directories or links named "obj.${MACHINE}"; 952 otherwise, just creates ones named "obj". 953 954USR_OBJMACHINE If set, and the current directory is a subdirectory of 955 ${BSDSRCDIR}, create object directory in the 956 corresponding subdirectory of ${BSDOBJDIR}.${MACHINE}; 957 otherwise, create it in the corresponding subdirectory 958 of ${BSDOBJDIR} 959 960BUILDID If set, the contents of this variable are appended 961 to the object directory name. If OBJMACHINE is also 962 set, ".${BUILDID}" is added after ".${MACHINE}". 963 964=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 965 966The include file <bsd.kernobj.mk> defines variables related to the 967location of kernel sources and object directories. 968 969KERNSRCDIR Is the location of the top of the kernel src. 970 It defaults to ${_SRC_TOP_}/sys 971 972KERNARCHDIR Is the location of the machine dependent kernel 973 sources. It defaults to arch/${MACHINE} 974 975KERNCONFDIR Is where the configuration files for kernels are 976 found; default is ${KERNSRCDIR}/${KERNARCHDIR}/conf. 977 978KERNOBJDIR Is the kernel build directory. The kernel GENERIC for 979 instance will be compiled in ${KERNOBJDIR}/GENERIC. 980 The default value is 981 ${MAKEOBJDIRPREFIX}${KERNSRCDIR}/${KERNARCHDIR}/compile 982 if it exists or the target 'obj' is being made. 983 Otherwise the default is 984 ${KERNSRCDIR}/${KERNARCHDIR}/compile. 985 986It is important that Makefiles (such as those under src/distrib) that 987wish to find compiled kernels use bsd.kernobj.mk and ${KERNOBJDIR} 988rather than make assumptions about the location of the compiled kernel. 989 990=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 991 992The include file <bsd.rpc.mk> contains a makefile fragment used to 993construct source files built by rpcgen. 994 995The following macros may be defined in makefiles which include 996<bsd.rpc.mk> in order to control which files get built and how they 997are to be built: 998 999RPC_INCS: construct .h file from .x file 1000RPC_XDRFILES: construct _xdr.c from .x file 1001 (for marshalling/unmarshalling data types) 1002RPC_SVCFILES: construct _svc.c from .x file 1003 (server-side stubs) 1004RPC_SVCFLAGS: Additional flags passed to builds of RPC_SVCFILES. 1005 1006RPC_XDIR: Directory containing .x/.h files 1007 1008 1009 1010=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 1011