bsd.README revision 1.104
1# $NetBSD: bsd.README,v 1.104 2002/09/22 15:08:19 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 Defaults to `yes' (or usually does) 66 67NOxxx If defined, disables a feature. Not intended for users, 68 it's to allow Makefiles to disable functionality that 69 they don't support (such as missing man pages). 70 NOxxx variables must be defined before <bsd.own.mk> 71 is included. 72 73The following variables that control how things are made/installed that 74are not set by default. These should not be set by Makefiles; they're for 75the user to define in MAKECONF (see bsd.own.mk, below) or on the make(1) 76command line: 77 78BUILD If defined, 'make install' checks that the targets in the 79 source directories are up-to-date and remakes them if they 80 are out of date, instead of blindly trying to install 81 out of date or non-existent targets. 82 83UPDATE If defined, 'make install' only installs targets that are 84 more recently modified in the source directories that their 85 installed counterparts. 86 87UNPRIVED If defined, don't set the owner/group/mode when installing 88 files or directories, and keep a metadata log of what 89 the owner/group/mode should be. This allows a 90 non-root "make install". 91 92MKBFD If "no", don't build libbfd, libiberty, or any of 93 the things that depend on them (binutils/gas/ld, 94 gdb, dbsym, mdsetimage). 95 96MKCATPAGES If "no", don't build or install the catman pages. 97 98MKDOC If "no", don't build or install the documentation. 99 100MKDYNAMICROOT If "no", build programs in /bin and /sbin statically, 101 don't install certain libraries in /lib, and don't 102 install the shared linker into /libexec. 103 104MKGDB If "no", don't build gdb. 105 106MKGCC If "no", don't build gcc or any of the gcc-related 107 libraries (libg2c, libgcc, libobjc, libstdc++). 108 109MKIEEEFP If "no", don't add code for IEEE754/IEC60559 conformance. 110 Has no effect on most platforms. 111 112MKINFO If "no", don't build or install Info documentation from 113 Texinfo source files. 114 115MKLINT If "no", don't build or install the lint libraries. 116 117MKMAN If "no", don't build or install the man or catman pages. 118 Also acts as "MKCATPAGES=no" 119 120MKNLS If "no", don't build or install the NLS files and locale 121 definition files. 122 123MKOBJ If "no", don't enable the rule which creates objdirs. 124 "yes" by default. 125 126MKOBJDIRS If "no", don't create objdirs during a "make build". 127 "no" by default. 128 129MKPIC If "no", don't build or install shared libraries. 130 131MKPICINSTALL If "no", don't install the *_pic.a libraries. 132 133MKPROFILE If "no", don't build or install the profiling libraries. 134 135MKSHARE If "no", act as "MKCATPAGES=no MKDOC=no MKINFO=no MKMAN=no 136 MKNLS=no". I.e, don't build catman pages, documentation, 137 Info documentation, man pages, NLS files, ... 138 139=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 140 141The include file <sys.mk> has the default rules for all makes, in the BSD 142environment or otherwise. You probably don't want to touch this file. 143If you intend to run a cross build, you will need to supply the following 144host tools, and configure the following variables properly: 145 146OBJCOPY objcopy - copy and translate object files 147 148STRIP strip - Discard symbols from object files 149 150CONFIG config - build kernel compilation directories 151 152RPCGEN rpcgen - Remote Procedure Call (RPC) protocol compiler 153 154MKLOCALE mklocale - make LC_CTYPE locale files 155 156MTREE mtree - build directory tree from a spec file 157 158=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 159 160The include file <bsd.man.mk> handles installing manual pages and their 161links. 162 163It has a two targets: 164 165 maninstall: 166 Install the manual page sources and their links. 167 catinstall: 168 Install the preformatted manual pages and their links. 169 170It sets/uses the following variables: 171 172MANDIR Base path for manual installation. 173 174MANGRP Manual group. 175 176MANOWN Manual owner. 177 178MANMODE Manual mode. 179 180MANSUBDIR Subdirectory under the manual page section, i.e. "/vax" 181 or "/tahoe" for machine specific manual pages. 182 183MAN The manual pages to be installed (use a .1 - .9 suffix). 184 185MLINKS List of manual page links (using a .1 - .9 suffix). The 186 linked-to file must come first, the linked file second, 187 and there may be multiple pairs. The files are soft-linked. 188 189The include file <bsd.man.mk> includes a file named "../Makefile.inc" if 190it exists. 191 192=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 193 194The include file <bsd.own.mk> contains source tree configuration parameters, 195such as the owners, groups, etc. for both manual pages and binaries, and 196a few global "feature configuration" parameters. 197 198It has no targets. 199 200To get system-specific configuration parameters, bsd.own.mk will try to 201include the file specified by the "MAKECONF" variable. If MAKECONF is not 202set, or no such file exists, the system make configuration file, /etc/mk.conf 203is included. These files may define any of the variables described below. 204 205bsd.own.mk sets the following variables, if they are not already defined 206(defaults are in brackets): 207 208NETBSDSRCDIR Top of the NetBSD source tree. 209 If _SRC_TOP_ != "", that will be used as the default, 210 otherwise BSDSRCDIR will be used as the default. 211 Various makefiles within the NetBSD source tree will 212 use this to reference the top level of the source tree. 213 214_SRC_TOP_ Top of the system source tree, as determined by <bsd.own.mk> 215 based on the presence of tools/ and build.sh. This variable 216 is "internal" to <bsd.own.mk>, although its value is only 217 determined once and then propagated to all sub-makes. 218 219BSDSRCDIR The real path to the system sources, so that 'make obj' 220 will work correctly. [/usr/src] 221 222BSDOBJDIR The real path to the system 'obj' tree, so that 'make obj' 223 will work correctly. [/usr/obj] 224 225BINGRP Binary group. [wheel] 226 227BINOWN Binary owner. [root] 228 229BINMODE Binary mode. [555] 230 231NONBINMODE Mode for non-executable files. [444] 232 233MANDIR Base path for manual installation. [/usr/share/man/cat] 234 235MANGRP Manual group. [wheel] 236 237MANOWN Manual owner. [root] 238 239MANMODE Manual mode. [${NONBINMODE}] 240 241MANINSTALL Manual installation type: maninstall, catinstall, or both 242 243LDSTATIC Control program linking; if set blank, link everything 244 dynamically. If set to "-static", link everything statically. 245 If not set, programs link according to their makefile. 246 247LIBDIR Base path for library installation. [/usr/lib] 248 249SHLIBDIR If ${USE_SHLIBDIR} is "yes", use ${SHLIBDIR} instead of 250 ${LIBDIR} as the base path for shared library installation. 251 [/lib] 252 253_LIBSODIR Set to ${SHLIBDIR} if ${USE_SHLIBDIR} is "yes", 254 otherwise set to ${LIBDIR} 255 256SHLINKDIR Base path for shared linker. [/libexec] 257 258LINTLIBDIR Base path for lint(1) library installation. [/usr/libdata/lint] 259 260LIBGRP Library group. [${BINGRP}] 261 262LIBOWN Library owner. [${BINOWN}] 263 264LIBMODE Library mode. [${NONBINMODE}] 265 266DOCDIR Base path for system documentation (e.g. PSD, USD, etc.) 267 installation. [/usr/share/doc] 268 269HTMLDOCDIR Base path for html system documentation installation. 270 [/usr/share/doc/html] 271 272DOCGRP Documentation group. [wheel] 273 274DOCOWN Documentation owner. [root] 275 276DOCMODE Documentation mode. [${NONBINMODE}] 277 278NLSDIR Base path for Native Language Support files installation. 279 [/usr/share/nls] 280 281NLSGRP Native Language Support files group. [wheel] 282 283NLSOWN Native Language Support files owner. [root] 284 285NLSMODE Native Language Support files mode. [${NONBINMODE}] 286 287STRIPFLAG The flag passed to the install program to cause the binary 288 to be stripped. This is to be used when building your 289 own install script so that the entire system can be made 290 stripped/not-stripped using a single knob. [-s] 291 292COPY The flag passed to the install program to cause the binary 293 to be copied rather than moved. This is to be used when 294 building our own install script so that the entire system 295 can either be installed with copies, or with moves using 296 a single knob. [-c] 297 298Additionally, the following variables may be set by bsd.own.mk or in a 299make configuration file to modify the behaviour of the system build 300process (default values are in brackets along with comments, if set by 301bsd.own.mk): 302 303MKCRYPTO If set to "no", no cryptography support will be built 304 into the system. Defaults to "yes". 305 306MKCRYPTO_IDEA If set to "yes", IDEA support will be built into 307 libcrypto_idea.a. Defaults to "no". 308 309MKCRYPTO_RC5 If set to "yes", RC5 support will be built into 310 libcrypto_rc5.a. Defaults to "no". 311 312MKHESIOD If set to "no", disables building of Hesiod infrastructure 313 (libraries and support programs). 314 315MKKERBEROS If set to "no", disables building of Kerberos (v4 or v5) 316 infrastructure (libraries and support programs). 317 318MKSKEY If set to "no", disables building of S/key authentication 319 infrastructure (libraries and support programs). 320 321MKYP If set to "no", disables building of YP (NIS) 322 infrastructure (libraries and support programs). 323 324USE_HESIOD If set to "no", disables building Hesiod support into 325 various system utilities/libraries that support it. 326 If MKHESIOD is set to "no", USE_HESIOD will also be 327 forced to "no". 328 329USE_KERBEROS If set to "no", disables building Kerberos (v4 or v5) 330 support into various system utilities/libraries that 331 support it. If MKKERBEROS is set to "no", USE_KERBEROS 332 will also be forced to "no". 333 334USE_SKEY If set to "no", disables building S/key authentication 335 support into various system utilities/libraries that 336 support it. If MKSKEY is set to "no", USE_SKEY will 337 also be forced to "no". 338 339USE_YP If set to "no", disables building YP (NIS) support into 340 various system utilities/libraries that support it. If 341 MKYP is set to "no", USE_YP will also be forced to "no". 342 343MANZ Compress manual pages at installation time. 344 345SYS_INCLUDE Copy or symlink kernel include files into /usr/include. 346 Possible values are "symlinks" or "copies" (which is 347 the same as the variable being unset). 348 349NOPROFILE Do not build profiled versions of system libraries 350 351NOPIC Do not build PIC versions of system libraries, and 352 do not build shared libraries. [set if ${MACHINE_ARCH} 353 is "sh3" and ${OBJECT_FMT} is "COFF", unset otherwise.] 354 355NOLINT Do not build lint libraries. 356 357OBJECT_FMT Object file format. [set to "ELF" on architectures that 358 use ELF -- currently if ${MACHINE_ARCH} is "alpha", 359 "mipsel", "mipseb", "powerpc", "sparc", "sparc64", 360 "i386" and some m68k machines, or set to "a.out" on 361 other architectures]. 362 363MKSOFTFLOAT If "yes", build with options to enable the compiler to 364 generate output containing library calls for floating 365 point and possibly soft-float library support. Defaults 366 to "no". 367 368TOOLCHAIN_MISSING 369 If "yes", this indicates that the platform being built 370 does not have a working in-tree toolchain. If the 371 MACHINE_ARCH in question falls into this category, the 372 variable is conditionally assigned the value "yes". 373 Otherwise, the variable is unconditionally assigned the 374 value "no". 375 376 If TOOLCHAIN_MISSING is "yes", the variables MKBFD, MKGCC, 377 and MKGDB are unconditionally assigned the value "no". 378 379EXTERNAL_TOOLCHAIN 380 This variable is not directly set by <bsd.own.mk>, but 381 including <bsd.own.mk> is the canonical way to gain 382 access to this variable. The variable should be defined 383 either in the user's environment or in the user's mk.conf 384 file. If defined, this variable indicates the root of 385 an external toolchain which will be used to build the 386 tree. For example, if a platform is a TOOLCHAIN_MISSING 387 platform, EXTERNAL_TOOLCHAIN can be used to re-enable the 388 cross-compile framework. 389 390 If EXTERNAL_TOOLCHAIN is defined, the variable MKGCC is 391 unconditionally assigned the value "no", since the external 392 version of the compiler may not be able to build the library 393 components of the in-tree compiler. 394 395 NOTE: This variable is not yet used in as many places as 396 it should be. Expect the exact semantics of this variable 397 to change in the short term as parts of the cross-compile 398 framework continue to be cleaned up. 399 400bsd.own.mk is generally useful when building your own Makefiles so that 401they use the same default owners etc. as the rest of the tree. 402 403=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 404 405The include file <bsd.prog.mk> handles building programs from one or 406more source files, along with their manual pages. It has a limited number 407of suffixes, consistent with the current needs of the BSD tree. 408 409It has eight targets: 410 411 all: 412 build the program and its manual page. This also 413 creates a GDB initialization file (.gdbinit) in 414 the objdir. The .gdbinit file sets the shared library 415 prefix to ${DESTDIR} to facilitate cross-debugging. 416 clean: 417 remove the program, any object files and the files a.out, 418 Errs, errs, mklog, and ${PROG}.core. 419 cleandir: 420 remove all of the files removed by the target clean, as 421 well as .depend, tags, and any manual pages. 422 `distclean' is a synonym for `cleandir'. 423 depend: 424 make the dependencies for the source files, and store 425 them in the file .depend. 426 includes: 427 install any header files. 428 install: 429 install the program and its manual pages; if the Makefile 430 does not itself define the target install, the targets 431 beforeinstall and afterinstall may also be used to cause 432 actions immediately before and after the install target 433 is executed. 434 lint: 435 run lint on the source files 436 tags: 437 create a tags file for the source files. 438 439It sets/uses the following variables: 440 441BINGRP Binary group. 442 443BINOWN Binary owner. 444 445BINMODE Binary mode. 446 447CLEANFILES Additional files to remove for the clean and cleandir targets. 448 449COPTS Additional flags to the compiler when creating C objects. 450 451CPPFLAGS Additional flags to the C pre-processor 452 453GDBINIT List of GDB initialization files to add to "source" 454 directives in the .gdbinit file that is created in the 455 objdir. 456 457LDADD Additional loader objects. Usually used for libraries. 458 For example, to load with the compatibility and utility 459 libraries, use: 460 461 LDADD+=-lutil -lcompat 462 463LDFLAGS Additional loader flags. 464 465LINKS The list of binary links; should be full pathnames, the 466 linked-to file coming first, followed by the linked 467 file. The files are hard-linked. For example, to link 468 /bin/test and /bin/[, use: 469 470 LINKS= ${DESTDIR}/bin/test ${DESTDIR}/bin/[ 471 472SYMLINKS The list of symbolic links; should be full pathnames. 473 Syntax is identical to LINKS. Note that DESTDIR is not 474 automatically included in the link. 475 476MAN Manual pages (should end in .1 - .9). If no MAN variable is 477 defined, "MAN=${PROG}.1" is assumed. 478 479PROG The name of the program to build. If not supplied, nothing 480 is built. 481 482PROG_CXX If defined, the name of the program to build. Also 483 causes <bsd.prog.mk> to link the program with the C++ 484 compiler rather than the C compiler. PROG_CXX overrides 485 the value of PROG if PROG is also set. 486 487PROGNAME The name that the above program will be installed as, if 488 different from ${PROG}. 489 490SRCS List of source files to build the program. If SRCS is not 491 defined, it's assumed to be ${PROG}.c. 492 493DPADD Additional dependencies for the program. Usually used for 494 libraries. For example, to depend on the compatibility and 495 utility libraries use: 496 497 DPADD+=${LIBCOMPAT} ${LIBUTIL} 498 499 The following libraries are predefined for DPADD: 500 501 LIBCRT0?= ${DESTDIR}/usr/lib/crt0.o 502 LIBBZ2?= ${DESTDIR}/usr/lib/libbz2.a 503 LIBC?= ${DESTDIR}/usr/lib/libc.a 504 LIBC_PIC?= ${DESTDIR}/usr/lib/libc_pic.a 505 LIBCDK?= ${DESTDIR}/usr/lib/libcdk.a 506 LIBCOM_ERR?= ${DESTDIR}/usr/lib/libcom_err.a 507 LIBCOMPAT?= ${DESTDIR}/usr/lib/libcompat.a 508 LIBCRYPT?= ${DESTDIR}/usr/lib/libcrypt.a 509 LIBCRYPTO?= ${DESTDIR}/usr/lib/libcrypto.a 510 LIBCRYPTO_IDEA?=${DESTDIR}/usr/lib/libcrypto_idea.a 511 LIBCRYPTO_RC5?= ${DESTDIR}/usr/lib/libcrypto_rc5.a 512 LIBCURSES?= ${DESTDIR}/usr/lib/libcurses.a 513 LIBDBM?= ${DESTDIR}/usr/lib/libdbm.a 514 LIBDES?= ${DESTDIR}/usr/lib/libdes.a 515 LIBEDIT?= ${DESTDIR}/usr/lib/libedit.a 516 LIBFORM?= ${DESTDIR}/usr/lib/libform.a 517 LIBGCC?= ${DESTDIR}/usr/lib/libgcc.a 518 LIBGNUMALLOC?= ${DESTDIR}/usr/lib/libgnumalloc.a 519 LIBGSSAPI?= ${DESTDIR}/usr/lib/libgssapi.a 520 LIBHDB?= ${DESTDIR}/usr/lib/libhdb.a 521 LIBINTL?= ${DESTDIR}/usr/lib/libintl.a 522 LIBIPSEC?= ${DESTDIR}/usr/lib/libipsec.a 523 LIBKADM?= ${DESTDIR}/usr/lib/libkadm.a 524 LIBKADM5CLNT?= ${DESTDIR}/usr/lib/libkadm5clnt.a 525 LIBKADM5SRV?= ${DESTDIR}/usr/lib/libkadm5srv.a 526 LIBKAFS?= ${DESTDIR}/usr/lib/libkafs.a 527 LIBKDB?= ${DESTDIR}/usr/lib/libkdb.a 528 LIBKRB?= ${DESTDIR}/usr/lib/libkrb.a 529 LIBKRB5?= ${DESTDIR}/usr/lib/libkrb5.a 530 LIBKSTREAM?= ${DESTDIR}/usr/lib/libkstream.a 531 LIBKVM?= ${DESTDIR}/usr/lib/libkvm.a 532 LIBL?= ${DESTDIR}/usr/lib/libl.a 533 LIBM?= ${DESTDIR}/usr/lib/libm.a 534 LIBMENU?= ${DESTDIR}/usr/lib/libmenu.a 535 LIBMP?= ${DESTDIR}/usr/lib/libmp.a 536 LIBNTP?= ${DESTDIR}/usr/lib/libntp.a 537 LIBOBJC?= ${DESTDIR}/usr/lib/libobjc.a 538 LIBOSSAUDIO?= ${DESTDIR}/usr/lib/libossaudio.a 539 LIBPC?= ${DESTDIR}/usr/lib/libpc.a 540 LIBPCAP?= ${DESTDIR}/usr/lib/libpcap.a 541 LIBPCI?= ${DESTDIR}/usr/lib/libpci.a 542 LIBPLOT?= ${DESTDIR}/usr/lib/libplot.a 543 LIBPMC?= ${DESTDIR}/usr/lib/libpmc.a 544 LIBPOSIX?= ${DESTDIR}/usr/lib/libposix.a 545 LIBRESOLV?= ${DESTDIR}/usr/lib/libresolv.a 546 LIBRMT?= ${DESTDIR}/usr/lib/librmt.a 547 LIBROKEN?= ${DESTDIR}/usr/lib/libroken.a 548 LIBRPCSVC?= ${DESTDIR}/usr/lib/librpcsvc.a 549 LIBSKEY?= ${DESTDIR}/usr/lib/libskey.a 550 LIBSS?= ${DESTDIR}/usr/lib/libss.a 551 LIBSSL?= ${DESTDIR}/usr/lib/libssl.a 552 LIBSKEY?= ${DESTDIR}/usr/lib/libskey.a 553 LIBSL?= ${DESTDIR}/usr/lib/libsl.a 554 LIBTERMCAP?= ${DESTDIR}/usr/lib/libtermcap.a 555 LIBTELNET?= ${DESTDIR}/usr/lib/libtelnet.a 556 LIBUSBHID?= ${DESTDIR}/usr/lib/libusbhid.a 557 LIBUTIL?= ${DESTDIR}/usr/lib/libutil.a 558 LIBWRAP?= ${DESTDIR}/usr/lib/libwrap.a 559 LIBY?= ${DESTDIR}/usr/lib/liby.a 560 LIBZ?= ${DESTDIR}/usr/lib/libz.a 561 562SHAREDSTRINGS If defined, a new .c.o rule is used that results in shared 563 strings, using xstr(1). Note that this will not work with 564 parallel makes. 565 566STRIPFLAG The flag passed to the install program to cause the binary 567 to be stripped. 568 569SUBDIR A list of subdirectories that should be built as well. 570 Each of the targets will execute the same target in the 571 subdirectories. 572 573SCRIPTS A list of interpreter scripts [file.{sh,csh,pl,awk,...}]. 574 These are installed exactly like programs. 575 576SCRIPTSNAME The name that the above program will be installed as, if 577 different from ${SCRIPTS}. These can be further specialized 578 by setting SCRIPTSNAME_<script>. 579 580FILES A list of files to install. The installation is controlled 581 by the FILESNAME, FILESOWN, FILESGRP, FILESMODE, FILESDIR 582 variables that can be further specialized by FILES<VAR>_<file> 583 584SHLINKDIR Target directory for shared linker. 585 586The include file <bsd.prog.mk> includes the file named "../Makefile.inc" 587if it exists, as well as the include file <bsd.man.mk>. 588 589Some simple examples: 590 591To build foo from foo.c with a manual page foo.1, use: 592 593 PROG= foo 594 595 .include <bsd.prog.mk> 596 597To build foo from foo.c with a manual page foo.2, add the line: 598 599 MAN= foo.2 600 601If foo does not have a manual page at all, add the line: 602 603 MKMAN= no 604 605If foo has multiple source files, add the line: 606 607 SRCS= a.c b.c c.c d.c 608 609=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 610 611The include file <bsd.subdir.mk> contains the default targets for building 612subdirectories. It has the same eight targets as <bsd.prog.mk>: all, 613clean, cleandir, depend, includes, install, lint, and tags. For all of 614the directories listed in the variable SUBDIR, the specified directory 615will be visited and the target made. There is also a default target which 616allows the command "make subdir" where subdir is any directory listed in 617the variable SUBDIR. 618 619As a special case, the use of a token .WAIT as an entry in SUBDIR acts 620as a synchronization barrier when multiple make jobs are run; subdirs 621before the .WAIT must complete before any subdirs after .WAIT are 622started. See make(1) for some caveats on use of .WAIT and other 623special sources. 624 625=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 626 627The include file <bsd.links.mk> handles the LINKS and SYMLINKS variables 628and is included from from bsd.lib.mk and bsd.prog.mk. 629 630=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 631 632The include file <bsd.files.mk> handles the FILES variables and is included 633from bsd.lib.mk and bsd.prog.mk. 634 635=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 636 637The include file <bsd.inc.mk> defines the includes target and uses two 638variables: 639 640INCS The list of include files 641 642INCSDIR The location to install the include files. 643 644INCSNAME Target name of the include file, if only one; same as 645 FILESNAME, but for include files. 646 647INCSNAME_<file> The name file <file> should be installed as, if not <file>, 648 same as FILESNAME_<file>, but for include files. 649 650=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 651 652The include file <bsd.kinc.mk> defines the many targets (includes, 653subdirectories, etc.), and is used by kernel makefiles to handle 654include file installation. It is intended to be included alone, by 655kernel Makefiles. Please see bsd.kinc.mk for more details, and keep 656the documentation in that file up to date. 657 658=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 659 660The include file <bsd.info.mk> is used to generate and install GNU Info 661documentation from respective Texinfo source files. It defines three 662implicit targets (.txi.info, .texi.info, and .texinfo.info), and uses the 663following variables: 664 665TEXINFO List of Texinfo source files. Info documentation will 666 consist of single files with the extension replaced by 667 .info. 668 669INFOFLAGS Flags to pass to makeinfo. [] 670 671INSTALL_INFO Name of install-info program. [install-info] 672 673MAKEINFO Name of makeinfo program. [makeinfo] 674 675=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 676 677The include file <bsd.sys.mk> is used by <bsd.prog.mk> and 678<bsd.lib.mk>. It contains overrides that are used when building 679the NetBSD source tree. For instance, if "PARALLEL" is defined by 680the program/library Makefile, it includes a set of rules for lex and 681yacc that allow multiple lex and yacc targets to be built in parallel. 682 683Other variables of note (incomplete list): 684 685WARNS Crank up gcc warning options; the distinct levels are: 686 WARNS=1 687 WARNS=2 688 WARNS=3 689 690FORMAT_AUDIT If FORMAT_AUDIT is set, and WFORMAT is set and > 1, turn on 691WFORMAT -Wnetbsd-format-audit for extra-stringent format checking. 692 WFORMAT belongs in individual makefiles and/or 693 Makefile.inc files. (set WFORMAT=1 in individual 694 makefiles if a program is not security critical and is 695 doing bizarre things with format strings which would 696 be even uglier if rewritten) FORMAT_AUDIT should go in 697 mk.conf if you're doing format-string auditing. 698 FORMAT_AUDIT may go away in time. 699 700=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 701 702The include file <bsd.lib.mk> has support for building libraries. It has 703the same eight targets as <bsd.prog.mk>: all, clean, cleandir, depend, 704includes, install, lint, and tags. Additionally, it has a checkver target 705which checks for installed shared object libraries whose version is greater 706that the version of the source. It has a limited number of suffixes, 707consistent with the current needs of the BSD tree. 708 709It sets/uses the following variables: 710 711LIB The name of the library to build. 712 713LIBDIR Target directory for libraries. 714 715SHLIBDIR Target directory for shared libraries if ${USE_SHLIBDIR} 716 is "yes". 717 718USE_SHLIBDIR If "yes", use ${SHLIBDIR} instead of ${LIBDIR} 719 as the path to install shared libraries to. 720 USE_SHLIBDIR must be defined before <bsd.own.mk> is included. 721 722LINTLIBDIR Target directory for lint libraries. 723 724LIBGRP Library group. 725 726LIBOWN Library owner. 727 728LIBMODE Library mode. 729 730LDADD Additional loader objects. 731 732MAN The manual pages to be installed (use a .1 - .9 suffix). 733 734MKLINKLIB If "no", act as "MKPICINSTALL=no MKPROFILE=no". 735 Also: 736 - don't install the .a libraries 737 - don't install _pic.a libraries on PIC systems 738 - don't build .a libraries on PIC systems 739 - don't install the .so symlink on ELF systems 740 I.e, only install the shared library (and the .so.major 741 symlink on ELF). 742 743MKPICLIB If "no", don't build _pic.a libraries, and build the 744 shared object libraries from the .a libraries. A 745 symlink is installed in ${DESTDIR}/usr/lib for the 746 _pic.a library pointing to the .a library. 747 748NOCHECKVER_<library> 749NOCHECKVER If set, disables checking for installed shared object 750 libraries with versions greater than the source. A 751 particular library name, without the "lib" prefix, may 752 be appended to the variable name to disable the check for 753 only that library. 754 755SRCS List of source files to build the library. Suffix types 756 .s, .c, and .f are supported. Note, .s files are preferred 757 to .c files of the same name. (This is not the default for 758 versions of make.) 759 760The include file <bsd.lib.mk> includes the file named "../Makefile.inc" 761if it exists, as well as the include file <bsd.man.mk>. 762 763It has rules for building profiled objects; profiled libraries are 764built by default. 765 766Libraries are ranlib'd when made. 767 768=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 769 770The include file <bsd.obj.mk> defines targets related to the creation 771and use of separated object and source directories. 772 773If an environment variable named MAKEOBJDIRPREFIX is set, make(1) uses 774${MAKEOBJDIRPREFIX}${.CURDIR} as the name of the object directory if 775it exists. Otherwise make(1) looks for the existence of a 776subdirectory (or a symlink to a directory) of the source directory 777into which built targets should be placed. If an environment variable 778named MAKEOBJDIR is set, make(1) uses its value as the name of the 779object directory; failing that, make first looks for a subdirectory 780named "obj.${MACHINE}", and if that doesn't exist, it looks for "obj". 781 782Object directories are not created automatically by make(1) if they 783don't exist; you need to run a separate "make obj". (This will happen 784during a top-level build if "MKOBJDIRS" is set to a value other than 785"no"). When the source directory is a subdirectory of ${BSDSRCDIR} -- 786and this is determined by a simple string prefix comparison -- object 787directories are created in a separate object directory tree, and a 788symlink to the object directory in that tree is created in the source 789directory; otherwise, "make obj" assumes that you're not in the main 790source tree and that it's not safe to use a separate object tree. 791 792Several variables used by <bsd.obj.mk> control exactly what 793directories and links get created during a "make obj": 794 795MAKEOBJDIR If set, this is the component name of the object 796 directory. 797 798OBJMACHINE If this is set but MAKEOBJDIR is not set, creates 799 object directories or links named "obj.${MACHINE}"; 800 otherwise, just creates ones named "obj". 801 802USR_OBJMACHINE If set, and the current directory is a subdirectory of 803 ${BSDSRCDIR}, create object directory in the 804 corresponding subdirectory of ${BSDOBJDIR}.${MACHINE}; 805 otherwise, create it in the corresponding subdirectory 806 of ${BSDOBJDIR} 807 808BUILDID If set, the contents of this variable are appended 809 to the object directory name. If OBJMACHINE is also 810 set, ".${BUILDID}" is added after ".${MACHINE}". 811 812=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 813 814The include file <bsd.kernobj.mk> defines variables related to the 815location of kernel sources and object directories. 816 817KERNSRCDIR Is the location of the top of the kernel src. 818 It defaults to ${_SRC_TOP_}/sys 819 820KERNARCHDIR Is the location of the machine dependent kernel 821 sources. It defaults to arch/${MACHINE} 822 823KERNCONFDIR Is where the configuration files for kernels are 824 found; default is ${KERNSRCDIR}/${KERNARCHDIR}/conf. 825 826KERNOBJDIR Is the kernel build directory. The kernel GENERIC for 827 instance will be compiled in ${KERNOBJDIR}/GENERIC. 828 The default value is 829 ${MAKEOBJDIRPREFIX}${KERNSRCDIR}/${KERNARCHDIR}/compile 830 if it exists or the target 'obj' is being made. 831 Otherwise the default is 832 ${KERNSRCDIR}/${KERNARCHDIR}/compile. 833 834It is important that Makefiles (such as those under src/distrib) that 835wish to find compiled kernels use bsd.kernobj.mk and ${KERNOBJDIR} 836rather than make assumptions about the location of the compiled kernel. 837 838=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 839