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