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