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