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