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