bsd.README revision 1.114
1# $NetBSD: bsd.README,v 1.114 2003/06/12 23:26:19 provos 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 249LINTLIBDIR Base path for lint(1) library installation. [/usr/libdata/lint] 250 251LIBGRP Library group. [${BINGRP}] 252 253LIBOWN Library owner. [${BINOWN}] 254 255LIBMODE Library mode. [${NONBINMODE}] 256 257DOCDIR Base path for system documentation (e.g. PSD, USD, etc.) 258 installation. [/usr/share/doc] 259 260HTMLDOCDIR Base path for html system documentation installation. 261 [/usr/share/doc/html] 262 263DOCGRP Documentation group. [wheel] 264 265DOCOWN Documentation owner. [root] 266 267DOCMODE Documentation mode. [${NONBINMODE}] 268 269NLSDIR Base path for Native Language Support files installation. 270 [/usr/share/nls] 271 272NLSGRP Native Language Support files group. [wheel] 273 274NLSOWN Native Language Support files owner. [root] 275 276NLSMODE Native Language Support files mode. [${NONBINMODE}] 277 278STRIPFLAG The flag passed to the install program to cause the binary 279 to be stripped. This is to be used when building your 280 own install script so that the entire system can be made 281 stripped/not-stripped using a single knob. [-s] 282 283COPY The flag passed to the install program to cause the binary 284 to be copied rather than moved. This is to be used when 285 building our own install script so that the entire system 286 can either be installed with copies, or with moves using 287 a single knob. [-c] 288 289Additionally, the following variables may be set by bsd.own.mk or in a 290make configuration file to modify the behaviour of the system build 291process (default values are in brackets along with comments, if set by 292bsd.own.mk): 293 294MKPICLIB bsd.own.mk provides a default for this variable, which is 295 used by bsd.lib.mk. The default value is provided by 296 bsd.own.mk since non-library Makefiles may need to check 297 its value in order to generate proper dependencies against 298 libraries used only during the build process (which would 299 not be installed into the destination directory). 300 301MKCRYPTO If set to "no", no cryptography support will be built 302 into the system. Defaults to "yes". 303 304MKCRYPTO_IDEA If set to "yes", IDEA support will be built into 305 libcrypto_idea.a. Defaults to "no". 306 307MKCRYPTO_MDC2 If set to "yes", MDC2 support will be built into 308 libcrypto_mdc2.a. Defaults to "no". 309 310MKCRYPTO_RC5 If set to "yes", RC5 support will be built into 311 libcrypto_rc5.a. Defaults to "no". 312 313MKHESIOD If set to "no", disables building of Hesiod infrastructure 314 (libraries and support programs). 315 316MKKERBEROS If set to "no", disables building of Kerberos (v4 or v5) 317 infrastructure (libraries and support programs). 318 319MKSKEY If set to "no", disables building of S/key authentication 320 infrastructure (libraries and support programs). 321 322MKYP If set to "no", disables building of YP (NIS) 323 infrastructure (libraries and support programs). 324 325USE_HESIOD If set to "no", disables building Hesiod support into 326 various system utilities/libraries that support it. 327 If MKHESIOD is set to "no", USE_HESIOD will also be 328 forced to "no". 329 330USE_KERBEROS If set to "no", disables building Kerberos (v4 or v5) 331 support into various system utilities/libraries that 332 support it. If MKKERBEROS is set to "no", USE_KERBEROS 333 will also be forced to "no". 334 335USE_SKEY If set to "no", disables building S/key authentication 336 support into various system utilities/libraries that 337 support it. If MKSKEY is set to "no", USE_SKEY will 338 also be forced to "no". 339 340USE_YP If set to "no", disables building YP (NIS) support into 341 various system utilities/libraries that support it. If 342 MKYP is set to "no", USE_YP will also be forced to "no". 343 344MANZ Compress manual pages at installation time. 345 346NOPROFILE Do not build profiled versions of system libraries 347 348NOPIC Do not build PIC versions of system libraries, and 349 do not build shared libraries. [set if ${MACHINE_ARCH} 350 is "sh3" and ${OBJECT_FMT} is "COFF", unset otherwise.] 351 352NOLINT Do not build lint libraries. 353 354OBJECT_FMT Object file format. [set to "ELF" on architectures that 355 use ELF -- currently if ${MACHINE_ARCH} is "alpha", 356 "mipsel", "mipseb", "powerpc", "sparc", "sparc64", 357 "i386" and some m68k machines, or set to "a.out" on 358 other architectures]. 359 360MKSOFTFLOAT If "yes", build with options to enable the compiler to 361 generate output containing library calls for floating 362 point and possibly soft-float library support. Defaults 363 to "no". 364 365TOOLCHAIN_MISSING 366 If "yes", this indicates that the platform being built 367 does not have a working in-tree toolchain. If the 368 MACHINE_ARCH in question falls into this category, the 369 variable is conditionally assigned the value "yes". 370 Otherwise, the variable is unconditionally assigned the 371 value "no". 372 373 If TOOLCHAIN_MISSING is "yes", the variables MKBFD, MKGCC, 374 and MKGDB are unconditionally assigned the value "no". 375 376EXTERNAL_TOOLCHAIN 377 This variable is not directly set by <bsd.own.mk>, but 378 including <bsd.own.mk> is the canonical way to gain 379 access to this variable. The variable should be defined 380 either in the user's environment or in the user's mk.conf 381 file. If defined, this variable indicates the root of 382 an external toolchain which will be used to build the 383 tree. For example, if a platform is a TOOLCHAIN_MISSING 384 platform, EXTERNAL_TOOLCHAIN can be used to re-enable the 385 cross-compile framework. 386 387 If EXTERNAL_TOOLCHAIN is defined, the variable MKGCC is 388 unconditionally assigned the value "no", since the external 389 version of the compiler may not be able to build the library 390 components of the in-tree compiler. 391 392 NOTE: This variable is not yet used in as many places as 393 it should be. Expect the exact semantics of this variable 394 to change in the short term as parts of the cross-compile 395 framework continue to be cleaned up. 396 397bsd.own.mk is generally useful when building your own Makefiles so that 398they use the same default owners etc. as the rest of the tree. 399 400=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 401 402The include file <bsd.shlib.mk> computes parameters for shared library 403installation and use. It defines no targets. <bsd.own.mk> MUST be 404included before bsd.shlib.mk. 405 406bsd.own.mk sets the following variables, if they are not already defined 407(defaults are in brackets): 408 409SHLIBINSTALLDIR If ${USE_SHLIBDIR} is "yes", use ${SHLIBINSTALLDIR} instead of 410 ${LIBDIR} as the base path for shared library installation. 411 [/lib] 412 413SHLIBDIR The path to USE_SHLIBDIR shared libraries to use when building 414 a program. [/lib for programs in /bin and /sbin, /usr/lib 415 for all others.] 416 417_LIBSODIR Set to ${SHLIBINSTALLDIR} if ${USE_SHLIBDIR} is "yes", 418 otherwise set to ${LIBDIR} 419 420SHLINKINSTALLDIR Base path for shared linker. [/libexec] 421 422SHLINKDIR Path to use for shared linker when building a program. 423 [/libexec for programs in /bin and /sbin, /usr/libexec for 424 all others.] 425 426=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 427 428The include file <bsd.gcc.mk> computes various parameters related to GCC 429support libraries. It defines no targets. <bsd.own.mk> MUST be included 430before bsd.gcc.mk. 431 432The primary users of bsd.gcc.mk are <bsd.prog.mk> and <bsd.lib.mk>, each 433of which need to know where to find certain GCC support libraries. 434 435The behavior of bsd.gcc.mk is influenced by the EXTERNAL_TOOLCHAIN variable, 436which is generally set by the user. If EXTERNAL_TOOLCHAIN it set, then 437the compiler is asked where to find the support libraries, otherwise the 438support libraries are found in ${DESTDIR}/usr/lib. 439 440bsd.gcc.mk sets the following variables: 441 442_GCC_CRTBEGIN The full path name to crtbegin.o. 443 444_GCC_CRTBEGINS The full path name to crtbeginS.o. 445 446_GCC_CRTEND The full path name to crtend.o. 447 448_GCC_CRTENDS The full path name to crtendS.o. 449 450_GCC_LIBGCCDIR The directory where libgcc.a is located. 451 452=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 453 454The include file <bsd.prog.mk> handles building programs from one or 455more source files, along with their manual pages. It has a limited number 456of suffixes, consistent with the current needs of the BSD tree. bsd.prog.mk 457includes <bsd.shlib.mk> to get shared library parameters. 458 459It has eight targets: 460 461 all: 462 build the program and its manual page. This also 463 creates a GDB initialization file (.gdbinit) in 464 the objdir. The .gdbinit file sets the shared library 465 prefix to ${DESTDIR} to facilitate cross-debugging. 466 clean: 467 remove the program, any object files and the files a.out, 468 Errs, errs, mklog, and ${PROG}.core. 469 cleandir: 470 remove all of the files removed by the target clean, as 471 well as .depend, tags, and any manual pages. 472 `distclean' is a synonym for `cleandir'. 473 depend: 474 make the dependencies for the source files, and store 475 them in the file .depend. 476 includes: 477 install any header files. 478 install: 479 install the program and its manual pages; if the Makefile 480 does not itself define the target install, the targets 481 beforeinstall and afterinstall may also be used to cause 482 actions immediately before and after the install target 483 is executed. 484 lint: 485 run lint on the source files 486 tags: 487 create a tags file for the source files. 488 489It sets/uses the following variables: 490 491BINGRP Binary group. 492 493BINOWN Binary owner. 494 495BINMODE Binary mode. 496 497CLEANFILES Additional files to remove for the clean and cleandir targets. 498 499COPTS Additional flags to the compiler when creating C objects. 500 501CPUFLAGS Additional flags to the compiler/assembler to select 502 CPU instruction set options, CPU tuning options, etc. 503 504CPPFLAGS Additional flags to the C pre-processor 505 506GDBINIT List of GDB initialization files to add to "source" 507 directives in the .gdbinit file that is created in the 508 objdir. 509 510LDADD Additional loader objects. Usually used for libraries. 511 For example, to load with the compatibility and utility 512 libraries, use: 513 514 LDADD+=-lutil -lcompat 515 516LDFLAGS Additional loader flags. 517 518LINKS The list of binary links; should be full pathnames, the 519 linked-to file coming first, followed by the linked 520 file. The files are hard-linked. For example, to link 521 /bin/test and /bin/[, use: 522 523 LINKS= ${DESTDIR}/bin/test ${DESTDIR}/bin/[ 524 525SYMLINKS The list of symbolic links; should be full pathnames. 526 Syntax is identical to LINKS. Note that DESTDIR is not 527 automatically included in the link. 528 529MAN Manual pages (should end in .1 - .9). If no MAN variable is 530 defined, "MAN=${PROG}.1" is assumed. 531 532PROG The name of the program to build. If not supplied, nothing 533 is built. 534 535PROG_CXX If defined, the name of the program to build. Also 536 causes <bsd.prog.mk> to link the program with the C++ 537 compiler rather than the C compiler. PROG_CXX overrides 538 the value of PROG if PROG is also set. 539 540PROGNAME The name that the above program will be installed as, if 541 different from ${PROG}. 542 543SRCS List of source files to build the program. If SRCS is not 544 defined, it's assumed to be ${PROG}.c. 545 546DPSRCS List of source files which are needed for generating 547 dependencies, but are not needed in ${SRCS}. 548 549DPADD Additional dependencies for the program. Usually used for 550 libraries. For example, to depend on the compatibility and 551 utility libraries use: 552 553 DPADD+=${LIBCOMPAT} ${LIBUTIL} 554 555 The following libraries are predefined for DPADD: 556 557 LIBCRT0?= ${DESTDIR}/usr/lib/crt0.o 558 LIBBZ2?= ${DESTDIR}/usr/lib/libbz2.a 559 LIBC?= ${DESTDIR}/usr/lib/libc.a 560 LIBC_PIC?= ${DESTDIR}/usr/lib/libc_pic.a 561 LIBCDK?= ${DESTDIR}/usr/lib/libcdk.a 562 LIBCOM_ERR?= ${DESTDIR}/usr/lib/libcom_err.a 563 LIBCOMPAT?= ${DESTDIR}/usr/lib/libcompat.a 564 LIBCRYPT?= ${DESTDIR}/usr/lib/libcrypt.a 565 LIBCRYPTO?= ${DESTDIR}/usr/lib/libcrypto.a 566 LIBCRYPTO_IDEA?=${DESTDIR}/usr/lib/libcrypto_idea.a 567 LIBCRYPTO_MDC2?=${DESTDIR}/usr/lib/libcrypto_mdc2.a 568 LIBCRYPTO_RC5?= ${DESTDIR}/usr/lib/libcrypto_rc5.a 569 LIBCURSES?= ${DESTDIR}/usr/lib/libcurses.a 570 LIBDBM?= ${DESTDIR}/usr/lib/libdbm.a 571 LIBDES?= ${DESTDIR}/usr/lib/libdes.a 572 LIBEDIT?= ${DESTDIR}/usr/lib/libedit.a 573 LIBEVENT?= ${DESTDIR}/usr/lib/libevent.a 574 LIBFORM?= ${DESTDIR}/usr/lib/libform.a 575 LIBGCC?= ${DESTDIR}/usr/lib/libgcc.a 576 LIBGNUMALLOC?= ${DESTDIR}/usr/lib/libgnumalloc.a 577 LIBGSSAPI?= ${DESTDIR}/usr/lib/libgssapi.a 578 LIBHDB?= ${DESTDIR}/usr/lib/libhdb.a 579 LIBINTL?= ${DESTDIR}/usr/lib/libintl.a 580 LIBIPSEC?= ${DESTDIR}/usr/lib/libipsec.a 581 LIBKADM?= ${DESTDIR}/usr/lib/libkadm.a 582 LIBKADM5CLNT?= ${DESTDIR}/usr/lib/libkadm5clnt.a 583 LIBKADM5SRV?= ${DESTDIR}/usr/lib/libkadm5srv.a 584 LIBKAFS?= ${DESTDIR}/usr/lib/libkafs.a 585 LIBKDB?= ${DESTDIR}/usr/lib/libkdb.a 586 LIBKRB?= ${DESTDIR}/usr/lib/libkrb.a 587 LIBKRB5?= ${DESTDIR}/usr/lib/libkrb5.a 588 LIBKSTREAM?= ${DESTDIR}/usr/lib/libkstream.a 589 LIBKVM?= ${DESTDIR}/usr/lib/libkvm.a 590 LIBL?= ${DESTDIR}/usr/lib/libl.a 591 LIBM?= ${DESTDIR}/usr/lib/libm.a 592 LIBMENU?= ${DESTDIR}/usr/lib/libmenu.a 593 LIBMP?= ${DESTDIR}/usr/lib/libmp.a 594 LIBNTP?= ${DESTDIR}/usr/lib/libntp.a 595 LIBOBJC?= ${DESTDIR}/usr/lib/libobjc.a 596 LIBOSSAUDIO?= ${DESTDIR}/usr/lib/libossaudio.a 597 LIBPC?= ${DESTDIR}/usr/lib/libpc.a 598 LIBPCAP?= ${DESTDIR}/usr/lib/libpcap.a 599 LIBPCI?= ${DESTDIR}/usr/lib/libpci.a 600 LIBPLOT?= ${DESTDIR}/usr/lib/libplot.a 601 LIBPMC?= ${DESTDIR}/usr/lib/libpmc.a 602 LIBPOSIX?= ${DESTDIR}/usr/lib/libposix.a 603 LIBPTHREAD?= ${DESTDIR}/usr/lib/libpthread.a 604 LIBPTHREAD_DBG?=${DESTDIR}/usr/lib/libpthread_dbg.a 605 LIBRESOLV?= ${DESTDIR}/usr/lib/libresolv.a 606 LIBRMT?= ${DESTDIR}/usr/lib/librmt.a 607 LIBROKEN?= ${DESTDIR}/usr/lib/libroken.a 608 LIBRPCSVC?= ${DESTDIR}/usr/lib/librpcsvc.a 609 LIBRT?= ${DESTDIR}/usr/lib/librt.a 610 LIBSKEY?= ${DESTDIR}/usr/lib/libskey.a 611 LIBSS?= ${DESTDIR}/usr/lib/libss.a 612 LIBSSL?= ${DESTDIR}/usr/lib/libssl.a 613 LIBSKEY?= ${DESTDIR}/usr/lib/libskey.a 614 LIBSL?= ${DESTDIR}/usr/lib/libsl.a 615 LIBTERMCAP?= ${DESTDIR}/usr/lib/libtermcap.a 616 LIBTELNET?= ${DESTDIR}/usr/lib/libtelnet.a 617 LIBUSBHID?= ${DESTDIR}/usr/lib/libusbhid.a 618 LIBUTIL?= ${DESTDIR}/usr/lib/libutil.a 619 LIBWRAP?= ${DESTDIR}/usr/lib/libwrap.a 620 LIBY?= ${DESTDIR}/usr/lib/liby.a 621 LIBZ?= ${DESTDIR}/usr/lib/libz.a 622 623SHAREDSTRINGS If defined, a new .c.o rule is used that results in shared 624 strings, using xstr(1). Note that this will not work with 625 parallel makes. 626 627STRIPFLAG The flag passed to the install program to cause the binary 628 to be stripped. 629 630SUBDIR A list of subdirectories that should be built as well. 631 Each of the targets will execute the same target in the 632 subdirectories. 633 634SCRIPTS A list of interpreter scripts [file.{sh,csh,pl,awk,...}]. 635 These are installed exactly like programs. 636 637SCRIPTSNAME The name that the above program will be installed as, if 638 different from ${SCRIPTS}. These can be further specialized 639 by setting SCRIPTSNAME_<script>. 640 641FILES A list of files to install. The installation is controlled 642 by the FILESNAME, FILESOWN, FILESGRP, FILESMODE, FILESDIR 643 variables that can be further specialized by FILES<VAR>_<file> 644 645SHLINKDIR Target directory for shared linker. See description of 646 <bsd.own.mk> for additional information about this variable. 647 648The include file <bsd.prog.mk> includes the file named "../Makefile.inc" 649if it exists, as well as the include file <bsd.man.mk>. 650 651Some simple examples: 652 653To build foo from foo.c with a manual page foo.1, use: 654 655 PROG= foo 656 657 .include <bsd.prog.mk> 658 659To build foo from foo.c with a manual page foo.2, add the line: 660 661 MAN= foo.2 662 663If foo does not have a manual page at all, add the line: 664 665 MKMAN= no 666 667If foo has multiple source files, add the line: 668 669 SRCS= a.c b.c c.c d.c 670 671=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 672 673The include file <bsd.subdir.mk> contains the default targets for building 674subdirectories. It has the same eight targets as <bsd.prog.mk>: all, 675clean, cleandir, depend, includes, install, lint, and tags. For all of 676the directories listed in the variable SUBDIR, the specified directory 677will be visited and the target made. There is also a default target which 678allows the command "make subdir" where subdir is any directory listed in 679the variable SUBDIR. 680 681As a special case, the use of a token .WAIT as an entry in SUBDIR acts 682as a synchronization barrier when multiple make jobs are run; subdirs 683before the .WAIT must complete before any subdirs after .WAIT are 684started. See make(1) for some caveats on use of .WAIT and other 685special sources. 686 687=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 688 689The include file <bsd.links.mk> handles the LINKS and SYMLINKS variables 690and is included from from bsd.lib.mk and bsd.prog.mk. 691 692=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 693 694The include file <bsd.files.mk> handles the FILES variables and is included 695from bsd.lib.mk and bsd.prog.mk. 696 697=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 698 699The include file <bsd.inc.mk> defines the includes target and uses two 700variables: 701 702INCS The list of include files 703 704INCSDIR The location to install the include files. 705 706INCSNAME Target name of the include file, if only one; same as 707 FILESNAME, but for include files. 708 709INCSNAME_<file> The name file <file> should be installed as, if not <file>, 710 same as FILESNAME_<file>, but for include files. 711 712=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 713 714The include file <bsd.kinc.mk> defines the many targets (includes, 715subdirectories, etc.), and is used by kernel makefiles to handle 716include file installation. It is intended to be included alone, by 717kernel Makefiles. Please see bsd.kinc.mk for more details, and keep 718the documentation in that file up to date. 719 720=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 721 722The include file <bsd.info.mk> is used to generate and install GNU Info 723documentation from respective Texinfo source files. It defines three 724implicit targets (.txi.info, .texi.info, and .texinfo.info), and uses the 725following variables: 726 727TEXINFO List of Texinfo source files. Info documentation will 728 consist of single files with the extension replaced by 729 .info. 730 731INFOFLAGS Flags to pass to makeinfo. [] 732 733INSTALL_INFO Name of install-info program. [install-info] 734 735MAKEINFO Name of makeinfo program. [makeinfo] 736 737=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 738 739The include file <bsd.sys.mk> is used by <bsd.prog.mk> and 740<bsd.lib.mk>. It contains overrides that are used when building 741the NetBSD source tree. For instance, if "PARALLEL" is defined by 742the program/library Makefile, it includes a set of rules for lex and 743yacc that allow multiple lex and yacc targets to be built in parallel. 744 745Other variables of note (incomplete list): 746 747WARNS Crank up gcc warning options; the distinct levels are: 748 WARNS=1 749 WARNS=2 750 WARNS=3 751 752FORMAT_AUDIT If FORMAT_AUDIT is set, and WFORMAT is set and > 1, turn on 753WFORMAT -Wnetbsd-format-audit for extra-stringent format checking. 754 WFORMAT belongs in individual makefiles and/or 755 Makefile.inc files. (set WFORMAT=1 in individual 756 makefiles if a program is not security critical and is 757 doing bizarre things with format strings which would 758 be even uglier if rewritten) FORMAT_AUDIT should go in 759 mk.conf if you're doing format-string auditing. 760 FORMAT_AUDIT may go away in time. 761 762=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 763 764The include file <bsd.lib.mk> has support for building libraries. It has 765the same eight targets as <bsd.prog.mk>: all, clean, cleandir, depend, 766includes, install, lint, and tags. Additionally, it has a checkver target 767which checks for installed shared object libraries whose version is greater 768that the version of the source. It has a limited number of suffixes, 769consistent with the current needs of the BSD tree. bsd.lib.mk includes 770<bsd.shlib.mk> to get shared library parameters. 771 772It sets/uses the following variables: 773 774LIB The name of the library to build. 775 776LIBDIR Target directory for libraries. 777 778SHLIBINSTALLDIR Target directory for shared libraries if ${USE_SHLIBDIR} 779 is "yes". 780 781USE_SHLIBDIR If "yes", use ${SHLIBINSTALLDIR} instead of ${LIBDIR} 782 as the path to install shared libraries to. 783 USE_SHLIBDIR must be defined before <bsd.own.mk> is included. 784 785LINTLIBDIR Target directory for lint libraries. 786 787LIBGRP Library group. 788 789LIBOWN Library owner. 790 791LIBMODE Library mode. 792 793LDADD Additional loader objects. 794 795MAN The manual pages to be installed (use a .1 - .9 suffix). 796 797MKLINKLIB If "no", act as "MKPICINSTALL=no MKPROFILE=no". 798 Also: 799 - don't install the .a libraries 800 - don't install _pic.a libraries on PIC systems 801 - don't build .a libraries on PIC systems 802 - don't install the .so symlink on ELF systems 803 I.e, only install the shared library (and the .so.major 804 symlink on ELF). 805 806MKPICLIB If "no", don't build _pic.a libraries, and build the 807 shared object libraries from the .a libraries. A 808 symlink is installed in ${DESTDIR}/usr/lib for the 809 _pic.a library pointing to the .a library. 810 811NOCHECKVER_<library> 812NOCHECKVER If set, disables checking for installed shared object 813 libraries with versions greater than the source. A 814 particular library name, without the "lib" prefix, may 815 be appended to the variable name to disable the check for 816 only that library. 817 818SRCS List of source files to build the library. Suffix types 819 .s, .c, and .f are supported. Note, .s files are preferred 820 to .c files of the same name. (This is not the default for 821 versions of make.) 822 823The include file <bsd.lib.mk> includes the file named "../Makefile.inc" 824if it exists, as well as the include file <bsd.man.mk>. 825 826It has rules for building profiled objects; profiled libraries are 827built by default. 828 829Libraries are ranlib'd when made. 830 831=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 832 833The include file <bsd.obj.mk> defines targets related to the creation 834and use of separated object and source directories. 835 836If an environment variable named MAKEOBJDIRPREFIX is set, make(1) uses 837${MAKEOBJDIRPREFIX}${.CURDIR} as the name of the object directory if 838it exists. Otherwise make(1) looks for the existence of a 839subdirectory (or a symlink to a directory) of the source directory 840into which built targets should be placed. If an environment variable 841named MAKEOBJDIR is set, make(1) uses its value as the name of the 842object directory; failing that, make first looks for a subdirectory 843named "obj.${MACHINE}", and if that doesn't exist, it looks for "obj". 844 845Object directories are not created automatically by make(1) if they 846don't exist; you need to run a separate "make obj". (This will happen 847during a top-level build if "MKOBJDIRS" is set to a value other than 848"no"). When the source directory is a subdirectory of ${BSDSRCDIR} -- 849and this is determined by a simple string prefix comparison -- object 850directories are created in a separate object directory tree, and a 851symlink to the object directory in that tree is created in the source 852directory; otherwise, "make obj" assumes that you're not in the main 853source tree and that it's not safe to use a separate object tree. 854 855Several variables used by <bsd.obj.mk> control exactly what 856directories and links get created during a "make obj": 857 858MAKEOBJDIR If set, this is the component name of the object 859 directory. 860 861OBJMACHINE If this is set but MAKEOBJDIR is not set, creates 862 object directories or links named "obj.${MACHINE}"; 863 otherwise, just creates ones named "obj". 864 865USR_OBJMACHINE If set, and the current directory is a subdirectory of 866 ${BSDSRCDIR}, create object directory in the 867 corresponding subdirectory of ${BSDOBJDIR}.${MACHINE}; 868 otherwise, create it in the corresponding subdirectory 869 of ${BSDOBJDIR} 870 871BUILDID If set, the contents of this variable are appended 872 to the object directory name. If OBJMACHINE is also 873 set, ".${BUILDID}" is added after ".${MACHINE}". 874 875=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 876 877The include file <bsd.kernobj.mk> defines variables related to the 878location of kernel sources and object directories. 879 880KERNSRCDIR Is the location of the top of the kernel src. 881 It defaults to ${_SRC_TOP_}/sys 882 883KERNARCHDIR Is the location of the machine dependent kernel 884 sources. It defaults to arch/${MACHINE} 885 886KERNCONFDIR Is where the configuration files for kernels are 887 found; default is ${KERNSRCDIR}/${KERNARCHDIR}/conf. 888 889KERNOBJDIR Is the kernel build directory. The kernel GENERIC for 890 instance will be compiled in ${KERNOBJDIR}/GENERIC. 891 The default value is 892 ${MAKEOBJDIRPREFIX}${KERNSRCDIR}/${KERNARCHDIR}/compile 893 if it exists or the target 'obj' is being made. 894 Otherwise the default is 895 ${KERNSRCDIR}/${KERNARCHDIR}/compile. 896 897It is important that Makefiles (such as those under src/distrib) that 898wish to find compiled kernels use bsd.kernobj.mk and ${KERNOBJDIR} 899rather than make assumptions about the location of the compiled kernel. 900 901=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 902 903The include file <bsd.rpc.mk> contains a makefile fragment used to 904construct source files built by rpcgen. 905 906The following macros may be defined in makefiles which include 907<bsd.rpc.mk> in order to control which files get built and how they 908are to be built: 909 910RPC_INCS: construct .h file from .x file 911RPC_XDRFILES: construct _xdr.c from .x file 912 (for marshalling/unmarshalling data types) 913RPC_SVCFILES: construct _svc.c from .x file 914 (server-side stubs) 915RPC_SVCFLAGS: Additional flags passed to builds of RPC_SVCFILES. 916 917RPC_XDIR: Directory containing .x/.h files 918 919 920 921=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 922