bsd.README revision 1.16
11.16Sjtc# $NetBSD: bsd.README,v 1.16 1996/04/04 02:05:03 jtc Exp $ 21.1Scgd# @(#)bsd.README 5.1 (Berkeley) 5/11/90 31.1Scgd 41.1ScgdThis is the README file for the new make "include" files for the BSD 51.1Scgdsource tree. The files are installed in /usr/share/mk, and are, by 61.11Sjtcconvention, named with the suffix ".mk". 71.1Scgd 81.1ScgdNote, this file is not intended to replace reading through the .mk 91.1Scgdfiles for anything tricky. 101.1Scgd 111.1Scgd=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 121.1Scgd 131.1ScgdRANDOM THINGS WORTH KNOWING: 141.1Scgd 151.1ScgdThe files are simply C-style #include files, and pretty much behave like 161.1Scgdyou'd expect. The syntax is slightly different in that a single '.' is 171.1Scgdused instead of the hash mark, i.e. ".include <bsd.prog.mk>". 181.1Scgd 191.1ScgdOne difference that will save you lots of debugging time is that inclusion 201.1Scgdof the file is normally done at the *end* of the Makefile. The reason for 211.1Scgdthis is because .mk files often modify variables and behavior based on the 221.1Scgdvalues of variables set in the Makefile. To make this work, remember that 231.1Scgdthe FIRST target found is the target that is used, i.e. if the Makefile has: 241.1Scgd 251.1Scgd a: 261.1Scgd echo a 271.1Scgd a: 281.1Scgd echo a number two 291.1Scgd 301.1Scgdthe command "make a" will echo "a". To make things confusing, the SECOND 311.1Scgdvariable assignment is the overriding one, i.e. if the Makefile has: 321.1Scgd 331.1Scgd a= foo 341.1Scgd a= bar 351.1Scgd 361.1Scgd b: 371.1Scgd echo ${a} 381.1Scgd 391.1Scgdthe command "make b" will echo "bar". This is for compatibility with the 401.1Scgdway the V7 make behaved. 411.1Scgd 421.1ScgdIt's fairly difficult to make the BSD .mk files work when you're building 431.1Scgdmultiple programs in a single directory. It's a lot easier split up the 441.1Scgdprograms than to deal with the problem. Most of the agony comes from making 451.1Scgdthe "obj" directory stuff work right, not because we switch to a new version 461.1Scgdof make. So, don't get mad at us, figure out a better way to handle multiple 471.1Scgdarchitectures so we can quit using the symbolic link stuff. (Imake doesn't 481.1Scgdcount.) 491.1Scgd 501.1ScgdThe file .depend in the source directory is expected to contain dependencies 511.1Scgdfor the source files. This file is read automatically by make after reading 521.1Scgdthe Makefile. 531.1Scgd 541.1ScgdThe variable DESTDIR works as before. It's not set anywhere but will change 551.1Scgdthe tree where the file gets installed. 561.1Scgd 571.1ScgdThe profiled libraries are no longer built in a different directory than 581.1Scgdthe regular libraries. A new suffix, ".po", is used to denote a profiled 591.1Scgdobject. 601.1Scgd 611.1Scgd=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 621.1Scgd 631.1ScgdThe include file <sys.mk> has the default rules for all makes, in the BSD 641.1Scgdenvironment or otherwise. You probably don't want to touch this file. 651.1Scgd 661.1Scgd=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 671.1Scgd 681.1ScgdThe include file <bsd.man.mk> handles installing manual pages and their 691.1Scgdlinks. 701.1Scgd 711.1ScgdIt has a single target: 721.1Scgd 731.1Scgd maninstall: 741.1Scgd Install the manual pages and their links. 751.1Scgd 761.1ScgdIt sets/uses the following variables: 771.1Scgd 781.1ScgdMANDIR Base path for manual installation. 791.1Scgd 801.1ScgdMANGRP Manual group. 811.1Scgd 821.1ScgdMANOWN Manual owner. 831.1Scgd 841.1ScgdMANMODE Manual mode. 851.1Scgd 861.1ScgdMANSUBDIR Subdirectory under the manual page section, i.e. "/vax" 871.1Scgd or "/tahoe" for machine specific manual pages. 881.1Scgd 891.15ScgdMAN The manual pages to be installed (use a .1 - .9 suffix). 901.1Scgd 911.15ScgdMLINKS List of manual page links (using a .1 - .9 suffix). The 921.1Scgd linked-to file must come first, the linked file second, 931.1Scgd and there may be multiple pairs. The files are soft-linked. 941.1Scgd 951.1ScgdThe include file <bsd.man.mk> includes a file named "../Makefile.inc" if 961.1Scgdit exists. 971.1Scgd 981.1Scgd=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 991.1Scgd 1001.1ScgdThe include file <bsd.own.mk> contains the owners, groups, etc. for both 1011.1Scgdmanual pages and binaries. 1021.1Scgd 1031.1ScgdIt has no targets. 1041.1Scgd 1051.15ScgdIt sets the following variables, if they are not already defined (defaults 1061.15Scgdare in brackets): 1071.15Scgd 1081.15ScgdBSDSRCDIR The real path to the system sources, so that 'make obj' 1091.15Scgd will work correctly. [/usr/src] 1101.15Scgd 1111.15ScgdBSDOBJDIR The real path to the system 'obj' tree, so that 'make obj' 1121.15Scgd will work correctly. [/usr/obj] 1131.15Scgd 1141.15ScgdBINGRP Binary group. [bin] 1151.15Scgd 1161.15ScgdBINOWN Binary owner. [bin] 1171.15Scgd 1181.15ScgdBINMODE Binary mode. [555] 1191.15Scgd 1201.15ScgdNONBINMODE Mode for non-executable files. [444] 1211.15Scgd 1221.15ScgdMANDIR Base path for manual installation. [/usr/share/man/cat] 1231.15Scgd 1241.15ScgdMANGRP Manual group. [bin] 1251.15Scgd 1261.15ScgdMANOWN Manual owner. [bin] 1271.15Scgd 1281.15ScgdMANMODE Manual mode. [${NONBINMODE}] 1291.15Scgd 1301.15ScgdLIBDIR Base path for library installation. [/usr/lib] 1311.15Scgd 1321.15ScgdLINTLIBDIR Base path for lint(1) library installation. [/usr/libdata/lint] 1331.15Scgd 1341.15ScgdLIBGRP Library group. [${BINGRP}] 1351.15Scgd 1361.15ScgdLIBOWN Library owner. [${BINOWN}] 1371.15Scgd 1381.15ScgdLIBMODE Library mode. [${NONBINMODE}] 1391.15Scgd 1401.15ScgdDOCDIR Base path for system documentation (e.g. PSD, USD, etc.) 1411.15Scgd installation. [/usr/share/doc] 1421.15Scgd 1431.15ScgdDOCGRP Documentation group. [bin] 1441.15Scgd 1451.15ScgdDOCOWN Documentation owner. [bin] 1461.15Scgd 1471.15ScgdDOCMODE Documentation mode. [${NONBINMODE}] 1481.15Scgd 1491.15ScgdNLSDIR Base path for National Language Support files installation. 1501.15Scgd [/usr/share/nls] 1511.1Scgd 1521.15ScgdNLSGRP National Language Support files group. [bin] 1531.1Scgd 1541.15ScgdNLSOWN National Language Support files owner. [bin] 1551.1Scgd 1561.15ScgdNLSMODE National Language Support files mode. [${NONBINMODE}] 1571.1Scgd 1581.1ScgdSTRIP The flag passed to the install program to cause the binary 1591.1Scgd to be stripped. This is to be used when building your 1601.1Scgd own install script so that the entire system can be made 1611.15Scgd stripped/not-stripped using a single knob. [-s] 1621.1Scgd 1631.2ScgdCOPY The flag passed to the install program to cause the binary 1641.2Scgd to be copied rather than moved. This is to be used when 1651.2Scgd building our own install script so that the entire system 1661.2Scgd can either be installed with copies, or with moves using 1671.15Scgd a single knob. [-c] 1681.15Scgd 1691.15ScgdAdditionally, the following variables may be set to modify the behaviour 1701.15Scgdof the system build process (default values are in brackets along with 1711.15Scgdcomments, if set by bsd.own.mk): 1721.15Scgd 1731.15ScgdEXPORTABLE_SYSTEM 1741.15Scgd Do not build /usr/src/domestic, even if it is present. 1751.2Scgd 1761.15ScgdSKEY Compile in support for S/key authentication. [yes, set 1771.15Scgd unconditionally] 1781.15Scgd 1791.15ScgdKERBEROS Compile in support for Kerberos 4 authentication. 1801.15Scgd 1811.15ScgdKERBEROS5 Compile in support for Kerberos 5 authentication. 1821.15Scgd 1831.15ScgdMANZ Compress manual pages at installation time. 1841.15Scgd 1851.15ScgdSYS_INCLUDE Copy or symlink kernel include files into /usr/include. 1861.15Scgd Possible values are "symlinks" or "copies" (which is 1871.15Scgd the same as the variable being unset). 1881.1Scgd 1891.15ScgdNOPROFILE Do not build profiled versions of system libraries 1901.1Scgd 1911.15ScgdNOPIC Do not build PIC versions of system libraries, and 1921.15Scgd do not build shared libraries. [set if ${MACHINE_ARCH} 1931.15Scgd is "mips", "vax", or "alpha", unset otherwise.] 1941.1Scgd 1951.15ScgdNOLINT Do not build lint libraries. [set, set unconditionally] 1961.1Scgd 1971.1ScgdThis file is generally useful when building your own Makefiles so that 1981.1Scgdthey use the same default owners etc. as the rest of the tree. 1991.1Scgd 2001.1Scgd=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 2011.1Scgd 2021.1ScgdThe include file <bsd.prog.mk> handles building programs from one or 2031.1Scgdmore source files, along with their manual pages. It has a limited number 2041.1Scgdof suffixes, consistent with the current needs of the BSD tree. 2051.1Scgd 2061.16SjtcIt has eight targets: 2071.1Scgd 2081.1Scgd all: 2091.1Scgd build the program and its manual page 2101.1Scgd clean: 2111.1Scgd remove the program, any object files and the files a.out, 2121.1Scgd Errs, errs, mklog, and core. 2131.1Scgd cleandir: 2141.1Scgd remove all of the files removed by the target clean, as 2151.1Scgd well as .depend, tags, and any manual pages. 2161.1Scgd depend: 2171.1Scgd make the dependencies for the source files, and store 2181.1Scgd them in the file .depend. 2191.16Sjtc includes: 2201.16Sjtc install any header files. 2211.1Scgd install: 2221.1Scgd install the program and its manual pages; if the Makefile 2231.1Scgd does not itself define the target install, the targets 2241.1Scgd beforeinstall and afterinstall may also be used to cause 2251.1Scgd actions immediately before and after the install target 2261.1Scgd is executed. 2271.1Scgd lint: 2281.1Scgd run lint on the source files 2291.1Scgd tags: 2301.1Scgd create a tags file for the source files. 2311.1Scgd 2321.1ScgdIt sets/uses the following variables: 2331.1Scgd 2341.1ScgdBINGRP Binary group. 2351.1Scgd 2361.1ScgdBINOWN Binary owner. 2371.1Scgd 2381.1ScgdBINMODE Binary mode. 2391.1Scgd 2401.1ScgdCLEANFILES Additional files to remove for the clean and cleandir targets. 2411.1Scgd 2421.1ScgdCOPTS Additional flags to the compiler when creating C objects. 2431.1Scgd 2441.1ScgdHIDEGAME If HIDEGAME is defined, the binary is installed in 2451.1Scgd /usr/games/hide, and a symbolic link is created to 2461.1Scgd /usr/games/dm. 2471.1Scgd 2481.1ScgdLDADD Additional loader objects. Usually used for libraries. 2491.1Scgd For example, to load with the compatibility and utility 2501.1Scgd libraries, use: 2511.1Scgd 2521.5Sjtc LDADD+=-lutil -lcompat 2531.1Scgd 2541.1ScgdLDFLAGS Additional loader flags. 2551.1Scgd 2561.1ScgdLINKS The list of binary links; should be full pathnames, the 2571.1Scgd linked-to file coming first, followed by the linked 2581.1Scgd file. The files are hard-linked. For example, to link 2591.1Scgd /bin/test and /bin/[, use: 2601.1Scgd 2611.1Scgd LINKS= ${DESTDIR}/bin/test ${DESTDIR}/bin/[ 2621.1Scgd 2631.15ScgdMAN Manual pages (should end in .1 - .9). If no MAN variable is 2641.8Scgd defined, "MAN=${PROG}.1" is assumed. 2651.1Scgd 2661.1ScgdPROG The name of the program to build. If not supplied, nothing 2671.1Scgd is built. 2681.1Scgd 2691.1ScgdSRCS List of source files to build the program. If PROG is not 2701.1Scgd defined, it's assumed to be ${PROG}.c. 2711.1Scgd 2721.1ScgdDPADD Additional dependencies for the program. Usually used for 2731.1Scgd libraries. For example, to depend on the compatibility and 2741.1Scgd utility libraries use: 2751.1Scgd 2761.5Sjtc DPADD+=${LIBCOMPAT} ${LIBUTIL} 2771.1Scgd 2781.1Scgd The following libraries are predefined for DPADD: 2791.1Scgd 2801.1Scgd LIBC /lib/libc.a 2811.1Scgd LIBCOMPAT /usr/lib/libcompat.a 2821.3Scgd LIBCRYPT /usr/lib/libcrypt.a 2831.1Scgd LIBCURSES /usr/lib/libcurses.a 2841.1Scgd LIBDBM /usr/lib/libdbm.a 2851.1Scgd LIBDES /usr/lib/libdes.a 2861.1Scgd LIBL /usr/lib/libl.a 2871.1Scgd LIBKDB /usr/lib/libkdb.a 2881.1Scgd LIBKRB /usr/lib/libkrb.a 2891.6Scgd LIBKVM /usr/lib/libkvm.a 2901.1Scgd LIBM /usr/lib/libm.a 2911.1Scgd LIBMP /usr/lib/libmp.a 2921.1Scgd LIBPC /usr/lib/libpc.a 2931.1Scgd LIBPLOT /usr/lib/libplot.a 2941.1Scgd LIBRPC /usr/lib/sunrpc.a 2951.1Scgd LIBTERM /usr/lib/libterm.a 2961.1Scgd LIBUTIL /usr/lib/libutil.a 2971.1Scgd 2981.1ScgdSHAREDSTRINGS If defined, a new .c.o rule is used that results in shared 2991.12Schristos strings, using xstr(1). Note that this will not work with 3001.12Schristos parallel makes. 3011.1Scgd 3021.1ScgdSTRIP The flag passed to the install program to cause the binary 3031.1Scgd to be stripped. 3041.1Scgd 3051.1ScgdSUBDIR A list of subdirectories that should be built as well. 3061.1Scgd Each of the targets will execute the same target in the 3071.1Scgd subdirectories. 3081.1Scgd 3091.1ScgdThe include file <bsd.prog.mk> includes the file named "../Makefile.inc" 3101.1Scgdif it exists, as well as the include file <bsd.man.mk>. 3111.1Scgd 3121.1ScgdSome simple examples: 3131.1Scgd 3141.1ScgdTo build foo from foo.c with a manual page foo.1, use: 3151.1Scgd 3161.1Scgd PROG= foo 3171.1Scgd 3181.1Scgd .include <bsd.prog.mk> 3191.1Scgd 3201.1ScgdTo build foo from foo.c with a manual page foo.2, add the line: 3211.1Scgd 3221.9Scgd MAN= foo.2 3231.1Scgd 3241.1ScgdIf foo does not have a manual page at all, add the line: 3251.1Scgd 3261.1Scgd NOMAN= noman 3271.1Scgd 3281.1ScgdIf foo has multiple source files, add the line: 3291.1Scgd 3301.1Scgd SRCS= a.c b.c c.c d.c 3311.1Scgd 3321.1Scgd=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 3331.1Scgd 3341.1ScgdThe include file <bsd.subdir.mk> contains the default targets for building 3351.16Sjtcsubdirectories. It has the same eight targets as <bsd.prog.mk>: all, 3361.16Sjtcclean, cleandir, depend, includes, install, lint, and tags. For all of 3371.16Sjtcthe directories listed in the variable SUBDIRS, the specified directory 3381.16Sjtcwill be visited and the target made. There is also a default target which 3391.16Sjtcallows the command "make subdir" where subdir is any directory listed in 3401.16Sjtcthe variable SUBDIRS. 3411.13Schristos 3421.13Schristos=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 3431.13Schristos 3441.13SchristosThe include file <bsd.sys.mk> is used by <bsd.prog.mk> and 3451.14Scgd<bsd.lib.mk>. It contains overrides that are used when building 3461.14Scgdthe NetBSD source tree. For instance, if "PARALLEL" is defined by 3471.14Scgdthe program/library Makefile, it includes a set of rules for lex and 3481.14Scgdyacc that allow multiple lex and yacc targets to be built in parallel. 3491.1Scgd 3501.1Scgd=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 3511.1Scgd 3521.1ScgdThe include file <bsd.lib.mk> has support for building libraries. It has 3531.16Sjtcthe same eight targets as <bsd.prog.mk>: all, clean, cleandir, depend, 3541.16Sjtcincludes, install, lint, and tags. It has a limited number of suffixes, 3551.16Sjtcconsistent with the current needs of the BSD tree. 3561.1Scgd 3571.1ScgdIt sets/uses the following variables: 3581.10Scgd 3591.10ScgdLIB The name of the library to build. 3601.1Scgd 3611.1ScgdLIBDIR Target directory for libraries. 3621.1Scgd 3631.1ScgdLINTLIBDIR Target directory for lint libraries. 3641.1Scgd 3651.1ScgdLIBGRP Library group. 3661.1Scgd 3671.1ScgdLIBOWN Library owner. 3681.1Scgd 3691.1ScgdLIBMODE Library mode. 3701.1Scgd 3711.1ScgdLDADD Additional loader objects. 3721.1Scgd 3731.15ScgdMAN The manual pages to be installed (use a .1 - .9 suffix). 3741.1Scgd 3751.1ScgdSRCS List of source files to build the library. Suffix types 3761.1Scgd .s, .c, and .f are supported. Note, .s files are preferred 3771.1Scgd to .c files of the same name. (This is not the default for 3781.1Scgd versions of make.) 3791.1Scgd 3801.1ScgdThe include file <bsd.lib.mk> includes the file named "../Makefile.inc" 3811.1Scgdif it exists, as well as the include file <bsd.man.mk>. 3821.1Scgd 3831.1ScgdIt has rules for building profiled objects; profiled libraries are 3841.1Scgdbuilt by default. 3851.1Scgd 3861.4ScgdLibraries are ranlib'd when made. 387