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