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