bsd.README revision 1.8
11.8Scgd# $NetBSD: bsd.README,v 1.8 1994/12/22 09:20:40 cgd 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.1Scgdconvention, named with the suffix ".mk". Each ".mk" file has a 71.1Scgdcorresponding ".rd" file which is an explanation of the ".mk" file. 81.1Scgd 91.1ScgdNote, this file is not intended to replace reading through the .mk 101.1Scgdfiles for anything tricky. 111.1Scgd 121.1Scgd=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 131.1Scgd 141.1ScgdRANDOM THINGS WORTH KNOWING: 151.1Scgd 161.1ScgdThe files are simply C-style #include files, and pretty much behave like 171.1Scgdyou'd expect. The syntax is slightly different in that a single '.' is 181.1Scgdused instead of the hash mark, i.e. ".include <bsd.prog.mk>". 191.1Scgd 201.1ScgdOne difference that will save you lots of debugging time is that inclusion 211.1Scgdof the file is normally done at the *end* of the Makefile. The reason for 221.1Scgdthis is because .mk files often modify variables and behavior based on the 231.1Scgdvalues of variables set in the Makefile. To make this work, remember that 241.1Scgdthe FIRST target found is the target that is used, i.e. if the Makefile has: 251.1Scgd 261.1Scgd a: 271.1Scgd echo a 281.1Scgd a: 291.1Scgd echo a number two 301.1Scgd 311.1Scgdthe command "make a" will echo "a". To make things confusing, the SECOND 321.1Scgdvariable assignment is the overriding one, i.e. if the Makefile has: 331.1Scgd 341.1Scgd a= foo 351.1Scgd a= bar 361.1Scgd 371.1Scgd b: 381.1Scgd echo ${a} 391.1Scgd 401.1Scgdthe command "make b" will echo "bar". This is for compatibility with the 411.1Scgdway the V7 make behaved. 421.1Scgd 431.1ScgdIt's fairly difficult to make the BSD .mk files work when you're building 441.1Scgdmultiple programs in a single directory. It's a lot easier split up the 451.1Scgdprograms than to deal with the problem. Most of the agony comes from making 461.1Scgdthe "obj" directory stuff work right, not because we switch to a new version 471.1Scgdof make. So, don't get mad at us, figure out a better way to handle multiple 481.1Scgdarchitectures so we can quit using the symbolic link stuff. (Imake doesn't 491.1Scgdcount.) 501.1Scgd 511.1ScgdThe file .depend in the source directory is expected to contain dependencies 521.1Scgdfor the source files. This file is read automatically by make after reading 531.1Scgdthe Makefile. 541.1Scgd 551.1ScgdThe variable DESTDIR works as before. It's not set anywhere but will change 561.1Scgdthe tree where the file gets installed. 571.1Scgd 581.1ScgdThe profiled libraries are no longer built in a different directory than 591.1Scgdthe regular libraries. A new suffix, ".po", is used to denote a profiled 601.1Scgdobject. 611.1Scgd 621.1Scgd=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 631.1Scgd 641.1ScgdThe include file <sys.mk> has the default rules for all makes, in the BSD 651.1Scgdenvironment or otherwise. You probably don't want to touch this file. 661.1Scgd 671.1Scgd=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 681.1Scgd 691.1ScgdThe include file <bsd.man.mk> handles installing manual pages and their 701.1Scgdlinks. 711.1Scgd 721.1ScgdIt has a single target: 731.1Scgd 741.1Scgd maninstall: 751.1Scgd Install the manual pages and their links. 761.1Scgd 771.1ScgdIt sets/uses the following variables: 781.1Scgd 791.1ScgdMANDIR Base path for manual installation. 801.1Scgd 811.1ScgdMANGRP Manual group. 821.1Scgd 831.1ScgdMANOWN Manual owner. 841.1Scgd 851.1ScgdMANMODE Manual mode. 861.1Scgd 871.1ScgdMANSUBDIR Subdirectory under the manual page section, i.e. "/vax" 881.1Scgd or "/tahoe" for machine specific manual pages. 891.1Scgd 901.8ScgdMAN The manual pages to be installed (use a .1 - .8 suffix). 911.1Scgd 921.1ScgdMLINKS List of manual page links (using a .1 - .8 suffix). The 931.1Scgd linked-to file must come first, the linked file second, 941.1Scgd and there may be multiple pairs. The files are soft-linked. 951.1Scgd 961.1ScgdThe include file <bsd.man.mk> includes a file named "../Makefile.inc" if 971.1Scgdit exists. 981.1Scgd 991.1Scgd=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 1001.1Scgd 1011.1ScgdThe include file <bsd.own.mk> contains the owners, groups, etc. for both 1021.1Scgdmanual pages and binaries. 1031.1Scgd 1041.1ScgdIt has no targets. 1051.1Scgd 1061.1ScgdIt sets/uses the following variables: 1071.1Scgd 1081.1ScgdBINGRP Binary group. 1091.1Scgd 1101.1ScgdBINOWN Binary owner. 1111.1Scgd 1121.1ScgdBINMODE Binary mode. 1131.1Scgd 1141.1ScgdSTRIP The flag passed to the install program to cause the binary 1151.1Scgd to be stripped. This is to be used when building your 1161.1Scgd own install script so that the entire system can be made 1171.1Scgd stripped/not-stripped using a single nob. 1181.1Scgd 1191.2ScgdCOPY The flag passed to the install program to cause the binary 1201.2Scgd to be copied rather than moved. This is to be used when 1211.2Scgd building our own install script so that the entire system 1221.2Scgd can either be installed with copies, or with moves using 1231.2Scgd a single nob. 1241.2Scgd 1251.1ScgdMANDIR Base path for manual installation. 1261.1Scgd 1271.1ScgdMANGRP Manual group. 1281.1Scgd 1291.1ScgdMANOWN Manual owner. 1301.1Scgd 1311.1ScgdMANMODE Manual mode. 1321.1Scgd 1331.1ScgdThis file is generally useful when building your own Makefiles so that 1341.1Scgdthey use the same default owners etc. as the rest of the tree. 1351.1Scgd 1361.1Scgd=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 1371.1Scgd 1381.1ScgdThe include file <bsd.prog.mk> handles building programs from one or 1391.1Scgdmore source files, along with their manual pages. It has a limited number 1401.1Scgdof suffixes, consistent with the current needs of the BSD tree. 1411.1Scgd 1421.1ScgdIt has seven targets: 1431.1Scgd 1441.1Scgd all: 1451.1Scgd build the program and its manual page 1461.1Scgd clean: 1471.1Scgd remove the program, any object files and the files a.out, 1481.1Scgd Errs, errs, mklog, and core. 1491.1Scgd cleandir: 1501.1Scgd remove all of the files removed by the target clean, as 1511.1Scgd well as .depend, tags, and any manual pages. 1521.1Scgd depend: 1531.1Scgd make the dependencies for the source files, and store 1541.1Scgd them in the file .depend. 1551.1Scgd install: 1561.1Scgd install the program and its manual pages; if the Makefile 1571.1Scgd does not itself define the target install, the targets 1581.1Scgd beforeinstall and afterinstall may also be used to cause 1591.1Scgd actions immediately before and after the install target 1601.1Scgd is executed. 1611.1Scgd lint: 1621.1Scgd run lint on the source files 1631.1Scgd tags: 1641.1Scgd create a tags file for the source files. 1651.1Scgd 1661.1ScgdIt sets/uses the following variables: 1671.1Scgd 1681.1ScgdBINGRP Binary group. 1691.1Scgd 1701.1ScgdBINOWN Binary owner. 1711.1Scgd 1721.1ScgdBINMODE Binary mode. 1731.1Scgd 1741.1ScgdCLEANFILES Additional files to remove for the clean and cleandir targets. 1751.1Scgd 1761.1ScgdCOPTS Additional flags to the compiler when creating C objects. 1771.1Scgd 1781.1ScgdHIDEGAME If HIDEGAME is defined, the binary is installed in 1791.1Scgd /usr/games/hide, and a symbolic link is created to 1801.1Scgd /usr/games/dm. 1811.1Scgd 1821.1ScgdLDADD Additional loader objects. Usually used for libraries. 1831.1Scgd For example, to load with the compatibility and utility 1841.1Scgd libraries, use: 1851.1Scgd 1861.5Sjtc LDADD+=-lutil -lcompat 1871.1Scgd 1881.1ScgdLDFLAGS Additional loader flags. 1891.1Scgd 1901.1ScgdLINKS The list of binary links; should be full pathnames, the 1911.1Scgd linked-to file coming first, followed by the linked 1921.1Scgd file. The files are hard-linked. For example, to link 1931.1Scgd /bin/test and /bin/[, use: 1941.1Scgd 1951.1Scgd LINKS= ${DESTDIR}/bin/test ${DESTDIR}/bin/[ 1961.1Scgd 1971.8ScgdMAN Manual pages (should end in .1 - .8). If no MAN variable is 1981.8Scgd defined, "MAN=${PROG}.1" is assumed. 1991.1Scgd 2001.1ScgdPROG The name of the program to build. If not supplied, nothing 2011.1Scgd is built. 2021.1Scgd 2031.1ScgdSRCS List of source files to build the program. If PROG is not 2041.1Scgd defined, it's assumed to be ${PROG}.c. 2051.1Scgd 2061.1ScgdDPADD Additional dependencies for the program. Usually used for 2071.1Scgd libraries. For example, to depend on the compatibility and 2081.1Scgd utility libraries use: 2091.1Scgd 2101.5Sjtc DPADD+=${LIBCOMPAT} ${LIBUTIL} 2111.1Scgd 2121.1Scgd The following libraries are predefined for DPADD: 2131.1Scgd 2141.1Scgd LIBC /lib/libc.a 2151.1Scgd LIBCOMPAT /usr/lib/libcompat.a 2161.3Scgd LIBCRYPT /usr/lib/libcrypt.a 2171.1Scgd LIBCURSES /usr/lib/libcurses.a 2181.1Scgd LIBDBM /usr/lib/libdbm.a 2191.1Scgd LIBDES /usr/lib/libdes.a 2201.1Scgd LIBL /usr/lib/libl.a 2211.1Scgd LIBKDB /usr/lib/libkdb.a 2221.1Scgd LIBKRB /usr/lib/libkrb.a 2231.6Scgd LIBKVM /usr/lib/libkvm.a 2241.1Scgd LIBM /usr/lib/libm.a 2251.1Scgd LIBMP /usr/lib/libmp.a 2261.1Scgd LIBPC /usr/lib/libpc.a 2271.1Scgd LIBPLOT /usr/lib/libplot.a 2281.1Scgd LIBRPC /usr/lib/sunrpc.a 2291.1Scgd LIBTERM /usr/lib/libterm.a 2301.1Scgd LIBUTIL /usr/lib/libutil.a 2311.1Scgd 2321.1ScgdSHAREDSTRINGS If defined, a new .c.o rule is used that results in shared 2331.1Scgd strings, using xstr(1). 2341.1Scgd 2351.1ScgdSTRIP The flag passed to the install program to cause the binary 2361.1Scgd to be stripped. 2371.1Scgd 2381.1ScgdSUBDIR A list of subdirectories that should be built as well. 2391.1Scgd Each of the targets will execute the same target in the 2401.1Scgd subdirectories. 2411.1Scgd 2421.1ScgdThe include file <bsd.prog.mk> includes the file named "../Makefile.inc" 2431.1Scgdif it exists, as well as the include file <bsd.man.mk>. 2441.1Scgd 2451.1ScgdSome simple examples: 2461.1Scgd 2471.1ScgdTo build foo from foo.c with a manual page foo.1, use: 2481.1Scgd 2491.1Scgd PROG= foo 2501.1Scgd 2511.1Scgd .include <bsd.prog.mk> 2521.1Scgd 2531.1ScgdTo build foo from foo.c with a manual page foo.2, add the line: 2541.1Scgd 2551.1Scgd MAN2= foo.0 2561.1Scgd 2571.1ScgdIf foo does not have a manual page at all, add the line: 2581.1Scgd 2591.1Scgd NOMAN= noman 2601.1Scgd 2611.1ScgdIf foo has multiple source files, add the line: 2621.1Scgd 2631.1Scgd SRCS= a.c b.c c.c d.c 2641.1Scgd 2651.1Scgd=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 2661.1Scgd 2671.1ScgdThe include file <bsd.subdir.mk> contains the default targets for building 2681.1Scgdsubdirectories. It has the same seven targets as <bsd.prog.mk>: all, clean, 2691.1Scgdcleandir, depend, install, lint, and tags. For all of the directories 2701.1Scgdlisted in the variable SUBDIRS, the specified directory will be visited 2711.1Scgdand the target made. There is also a default target which allows the 2721.1Scgdcommand "make subdir" where subdir is any directory listed in the variable 2731.1ScgdSUBDIRS. 2741.1Scgd 2751.1Scgd=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 2761.1Scgd 2771.1ScgdThe include file <bsd.lib.mk> has support for building libraries. It has 2781.1Scgdthe same seven targets as <bsd.prog.mk>: all, clean, cleandir, depend, 2791.1Scgdinstall, lint, and tags. It has a limited number of suffixes, consistent 2801.1Scgdwith the current needs of the BSD tree. 2811.1Scgd 2821.1ScgdIt sets/uses the following variables: 2831.1Scgd 2841.1ScgdLIBDIR Target directory for libraries. 2851.1Scgd 2861.1ScgdLINTLIBDIR Target directory for lint libraries. 2871.1Scgd 2881.1ScgdLIBGRP Library group. 2891.1Scgd 2901.1ScgdLIBOWN Library owner. 2911.1Scgd 2921.1ScgdLIBMODE Library mode. 2931.1Scgd 2941.1ScgdLDADD Additional loader objects. 2951.1Scgd 2961.8ScgdMAN The manual pages to be installed (use a .1 - .8 suffix). 2971.1Scgd 2981.1ScgdSRCS List of source files to build the library. Suffix types 2991.1Scgd .s, .c, and .f are supported. Note, .s files are preferred 3001.1Scgd to .c files of the same name. (This is not the default for 3011.1Scgd versions of make.) 3021.1Scgd 3031.1ScgdThe include file <bsd.lib.mk> includes the file named "../Makefile.inc" 3041.1Scgdif it exists, as well as the include file <bsd.man.mk>. 3051.1Scgd 3061.1ScgdIt has rules for building profiled objects; profiled libraries are 3071.1Scgdbuilt by default. 3081.1Scgd 3091.4ScgdLibraries are ranlib'd when made. 310