1246149Ssjg# $Id: README,v 1.1 1997/03/11 07:27:15 sjg Exp $ 2246149Ssjg 3246149SsjgThis directory contains some macro's derrived from the NetBSD bsd.*.mk 4246149Ssjgmacros. They have the same names but without the bsd., separate macro 5246149Ssjgfiles are needed to ensure we can make them do what we want for 6246149Ssjgbuiling things outside of /usr/src. Nearly all the comments below 7246149Ssjgapply. 8246149Ssjg 9246149Ssjg# $NetBSD: bsd.README,v 1.18 1997/01/13 00:54:23 mark Exp $ 10246149Ssjg# @(#)bsd.README 5.1 (Berkeley) 5/11/90 11246149Ssjg 12246149SsjgThis is the README file for the new make "include" files for the BSD 13246149Ssjgsource tree. The files are installed in /usr/share/mk, and are, by 14246149Ssjgconvention, named with the suffix ".mk". 15246149Ssjg 16246149SsjgNote, this file is not intended to replace reading through the .mk 17246149Ssjgfiles for anything tricky. 18246149Ssjg 19246149Ssjg=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 20246149Ssjg 21246149SsjgRANDOM THINGS WORTH KNOWING: 22246149Ssjg 23246149SsjgThe files are simply C-style #include files, and pretty much behave like 24246149Ssjgyou'd expect. The syntax is slightly different in that a single '.' is 25246149Ssjgused instead of the hash mark, i.e. ".include <bsd.prog.mk>". 26246149Ssjg 27246149SsjgOne difference that will save you lots of debugging time is that inclusion 28246149Ssjgof the file is normally done at the *end* of the Makefile. The reason for 29246149Ssjgthis is because .mk files often modify variables and behavior based on the 30246149Ssjgvalues of variables set in the Makefile. To make this work, remember that 31246149Ssjgthe FIRST target found is the target that is used, i.e. if the Makefile has: 32246149Ssjg 33246149Ssjg a: 34246149Ssjg echo a 35246149Ssjg a: 36246149Ssjg echo a number two 37246149Ssjg 38246149Ssjgthe command "make a" will echo "a". To make things confusing, the SECOND 39246149Ssjgvariable assignment is the overriding one, i.e. if the Makefile has: 40246149Ssjg 41246149Ssjg a= foo 42246149Ssjg a= bar 43246149Ssjg 44246149Ssjg b: 45246149Ssjg echo ${a} 46246149Ssjg 47246149Ssjgthe command "make b" will echo "bar". This is for compatibility with the 48246149Ssjgway the V7 make behaved. 49246149Ssjg 50246149SsjgIt's fairly difficult to make the BSD .mk files work when you're building 51246149Ssjgmultiple programs in a single directory. It's a lot easier split up the 52246149Ssjgprograms than to deal with the problem. Most of the agony comes from making 53246149Ssjgthe "obj" directory stuff work right, not because we switch to a new version 54246149Ssjgof make. So, don't get mad at us, figure out a better way to handle multiple 55246149Ssjgarchitectures so we can quit using the symbolic link stuff. (Imake doesn't 56246149Ssjgcount.) 57246149Ssjg 58246149SsjgThe file .depend in the source directory is expected to contain dependencies 59246149Ssjgfor the source files. This file is read automatically by make after reading 60246149Ssjgthe Makefile. 61246149Ssjg 62246149SsjgThe variable DESTDIR works as before. It's not set anywhere but will change 63246149Ssjgthe tree where the file gets installed. 64246149Ssjg 65246149SsjgThe profiled libraries are no longer built in a different directory than 66246149Ssjgthe regular libraries. A new suffix, ".po", is used to denote a profiled 67246149Ssjgobject. 68246149Ssjg 69246149Ssjg=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 70246149Ssjg 71246149SsjgThe include file <sys.mk> has the default rules for all makes, in the BSD 72246149Ssjgenvironment or otherwise. You probably don't want to touch this file. 73246149Ssjg 74246149Ssjg=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 75246149Ssjg 76246149SsjgThe include file <bsd.man.mk> handles installing manual pages and their 77246149Ssjglinks. 78246149Ssjg 79246149SsjgIt has a single target: 80246149Ssjg 81246149Ssjg maninstall: 82246149Ssjg Install the manual pages and their links. 83246149Ssjg 84246149SsjgIt sets/uses the following variables: 85246149Ssjg 86246149SsjgMANDIR Base path for manual installation. 87246149Ssjg 88246149SsjgMANGRP Manual group. 89246149Ssjg 90246149SsjgMANOWN Manual owner. 91246149Ssjg 92246149SsjgMANMODE Manual mode. 93246149Ssjg 94246149SsjgMANSUBDIR Subdirectory under the manual page section, i.e. "/vax" 95246149Ssjg or "/tahoe" for machine specific manual pages. 96246149Ssjg 97246149SsjgMAN The manual pages to be installed (use a .1 - .9 suffix). 98246149Ssjg 99246149SsjgMLINKS List of manual page links (using a .1 - .9 suffix). The 100246149Ssjg linked-to file must come first, the linked file second, 101246149Ssjg and there may be multiple pairs. The files are soft-linked. 102246149Ssjg 103246149SsjgThe include file <bsd.man.mk> includes a file named "../Makefile.inc" if 104246149Ssjgit exists. 105246149Ssjg 106246149Ssjg=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 107246149Ssjg 108246149SsjgThe include file <bsd.own.mk> contains source tree configuration parameters, 109246149Ssjgsuch as the owners, groups, etc. for both manual pages and binaries, and 110246149Ssjga few global "feature configuration" parameters. 111246149Ssjg 112246149SsjgIt has no targets. 113246149Ssjg 114246149SsjgTo get system-specific configuration parameters, bsd.own.mk will try to 115246149Ssjginclude the file specified by the "MAKECONF" variable. If MAKECONF is not 116246149Ssjgset, or no such file exists, the system make configuration file, /etc/mk.conf 117246149Ssjgis included. These files may define any of the variables described below. 118246149Ssjg 119246149Ssjgbsd.own.mk sets the following variables, if they are not already defined 120246149Ssjg(defaults are in brackets): 121246149Ssjg 122246149SsjgBSDSRCDIR The real path to the system sources, so that 'make obj' 123246149Ssjg will work correctly. [/usr/src] 124246149Ssjg 125246149SsjgBSDOBJDIR The real path to the system 'obj' tree, so that 'make obj' 126246149Ssjg will work correctly. [/usr/obj] 127246149Ssjg 128246149SsjgBINGRP Binary group. [bin] 129246149Ssjg 130246149SsjgBINOWN Binary owner. [bin] 131246149Ssjg 132246149SsjgBINMODE Binary mode. [555] 133246149Ssjg 134246149SsjgNONBINMODE Mode for non-executable files. [444] 135246149Ssjg 136246149SsjgMANDIR Base path for manual installation. [/usr/share/man/cat] 137246149Ssjg 138246149SsjgMANGRP Manual group. [bin] 139246149Ssjg 140246149SsjgMANOWN Manual owner. [bin] 141246149Ssjg 142246149SsjgMANMODE Manual mode. [${NONBINMODE}] 143246149Ssjg 144246149SsjgLIBDIR Base path for library installation. [/usr/lib] 145246149Ssjg 146246149SsjgLINTLIBDIR Base path for lint(1) library installation. [/usr/libdata/lint] 147246149Ssjg 148246149SsjgLIBGRP Library group. [${BINGRP}] 149246149Ssjg 150246149SsjgLIBOWN Library owner. [${BINOWN}] 151246149Ssjg 152246149SsjgLIBMODE Library mode. [${NONBINMODE}] 153246149Ssjg 154246149SsjgDOCDIR Base path for system documentation (e.g. PSD, USD, etc.) 155246149Ssjg installation. [/usr/share/doc] 156246149Ssjg 157246149SsjgDOCGRP Documentation group. [bin] 158246149Ssjg 159246149SsjgDOCOWN Documentation owner. [bin] 160246149Ssjg 161246149SsjgDOCMODE Documentation mode. [${NONBINMODE}] 162246149Ssjg 163246149SsjgNLSDIR Base path for National Language Support files installation. 164246149Ssjg [/usr/share/nls] 165246149Ssjg 166246149SsjgNLSGRP National Language Support files group. [bin] 167246149Ssjg 168246149SsjgNLSOWN National Language Support files owner. [bin] 169246149Ssjg 170246149SsjgNLSMODE National Language Support files mode. [${NONBINMODE}] 171246149Ssjg 172246149SsjgSTRIP The flag passed to the install program to cause the binary 173246149Ssjg to be stripped. This is to be used when building your 174246149Ssjg own install script so that the entire system can be made 175246149Ssjg stripped/not-stripped using a single knob. [-s] 176246149Ssjg 177246149SsjgCOPY The flag passed to the install program to cause the binary 178246149Ssjg to be copied rather than moved. This is to be used when 179246149Ssjg building our own install script so that the entire system 180246149Ssjg can either be installed with copies, or with moves using 181246149Ssjg a single knob. [-c] 182246149Ssjg 183246149SsjgAdditionally, the following variables may be set by bsd.own.mk or in a 184246149Ssjgmake configuration file to modify the behaviour of the system build 185246149Ssjgprocess (default values are in brackets along with comments, if set by 186246149Ssjgbsd.own.mk): 187246149Ssjg 188246149SsjgEXPORTABLE_SYSTEM 189246149Ssjg Do not build /usr/src/domestic, even if it is present. 190246149Ssjg 191246149SsjgSKEY Compile in support for S/key authentication. [yes, set 192246149Ssjg unconditionally] 193246149Ssjg 194246149SsjgKERBEROS Compile in support for Kerberos 4 authentication. 195246149Ssjg 196246149SsjgKERBEROS5 Compile in support for Kerberos 5 authentication. 197246149Ssjg 198246149SsjgMANZ Compress manual pages at installation time. 199246149Ssjg 200246149SsjgSYS_INCLUDE Copy or symlink kernel include files into /usr/include. 201246149Ssjg Possible values are "symlinks" or "copies" (which is 202246149Ssjg the same as the variable being unset). 203246149Ssjg 204246149SsjgNOPROFILE Do not build profiled versions of system libraries 205246149Ssjg 206246149SsjgNOPIC Do not build PIC versions of system libraries, and 207246149Ssjg do not build shared libraries. [set if ${MACHINE_ARCH} 208246149Ssjg is "mips", "vax", "alpha" or "arm32", unset otherwise.] 209246149Ssjg 210246149SsjgNOLINT Do not build lint libraries. [set, set unconditionally] 211246149Ssjg 212246149Ssjgbsd.own.mk is generally useful when building your own Makefiles so that 213246149Ssjgthey use the same default owners etc. as the rest of the tree. 214246149Ssjg 215246149Ssjg=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 216246149Ssjg 217246149SsjgThe include file <bsd.prog.mk> handles building programs from one or 218246149Ssjgmore source files, along with their manual pages. It has a limited number 219246149Ssjgof suffixes, consistent with the current needs of the BSD tree. 220246149Ssjg 221246149SsjgIt has eight targets: 222246149Ssjg 223246149Ssjg all: 224246149Ssjg build the program and its manual page 225246149Ssjg clean: 226246149Ssjg remove the program, any object files and the files a.out, 227246149Ssjg Errs, errs, mklog, and core. 228246149Ssjg cleandir: 229246149Ssjg remove all of the files removed by the target clean, as 230246149Ssjg well as .depend, tags, and any manual pages. 231246149Ssjg depend: 232246149Ssjg make the dependencies for the source files, and store 233246149Ssjg them in the file .depend. 234246149Ssjg includes: 235246149Ssjg install any header files. 236246149Ssjg install: 237246149Ssjg install the program and its manual pages; if the Makefile 238246149Ssjg does not itself define the target install, the targets 239246149Ssjg beforeinstall and afterinstall may also be used to cause 240246149Ssjg actions immediately before and after the install target 241246149Ssjg is executed. 242246149Ssjg lint: 243246149Ssjg run lint on the source files 244246149Ssjg tags: 245246149Ssjg create a tags file for the source files. 246246149Ssjg 247246149SsjgIt sets/uses the following variables: 248246149Ssjg 249246149SsjgBINGRP Binary group. 250246149Ssjg 251246149SsjgBINOWN Binary owner. 252246149Ssjg 253246149SsjgBINMODE Binary mode. 254246149Ssjg 255246149SsjgCLEANFILES Additional files to remove for the clean and cleandir targets. 256246149Ssjg 257246149SsjgCOPTS Additional flags to the compiler when creating C objects. 258246149Ssjg 259246149SsjgHIDEGAME If HIDEGAME is defined, the binary is installed in 260246149Ssjg /usr/games/hide, and a symbolic link is created to 261246149Ssjg /usr/games/dm. 262246149Ssjg 263246149SsjgLDADD Additional loader objects. Usually used for libraries. 264246149Ssjg For example, to load with the compatibility and utility 265246149Ssjg libraries, use: 266246149Ssjg 267246149Ssjg LDADD+=-lutil -lcompat 268246149Ssjg 269246149SsjgLDFLAGS Additional loader flags. 270246149Ssjg 271246149SsjgLINKS The list of binary links; should be full pathnames, the 272246149Ssjg linked-to file coming first, followed by the linked 273246149Ssjg file. The files are hard-linked. For example, to link 274246149Ssjg /bin/test and /bin/[, use: 275246149Ssjg 276246149Ssjg LINKS= ${DESTDIR}/bin/test ${DESTDIR}/bin/[ 277246149Ssjg 278246149SsjgMAN Manual pages (should end in .1 - .9). If no MAN variable is 279246149Ssjg defined, "MAN=${PROG}.1" is assumed. 280246149Ssjg 281246149SsjgPROG The name of the program to build. If not supplied, nothing 282246149Ssjg is built. 283246149Ssjg 284246149SsjgSRCS List of source files to build the program. If PROG is not 285246149Ssjg defined, it's assumed to be ${PROG}.c. 286246149Ssjg 287246149SsjgDPADD Additional dependencies for the program. Usually used for 288246149Ssjg libraries. For example, to depend on the compatibility and 289246149Ssjg utility libraries use: 290246149Ssjg 291246149Ssjg DPADD+=${LIBCOMPAT} ${LIBUTIL} 292246149Ssjg 293246149Ssjg The following libraries are predefined for DPADD: 294246149Ssjg 295246149Ssjg LIBC /lib/libc.a 296246149Ssjg LIBCOMPAT /usr/lib/libcompat.a 297246149Ssjg LIBCRYPT /usr/lib/libcrypt.a 298246149Ssjg LIBCURSES /usr/lib/libcurses.a 299246149Ssjg LIBDBM /usr/lib/libdbm.a 300246149Ssjg LIBDES /usr/lib/libdes.a 301246149Ssjg LIBL /usr/lib/libl.a 302246149Ssjg LIBKDB /usr/lib/libkdb.a 303246149Ssjg LIBKRB /usr/lib/libkrb.a 304246149Ssjg LIBKVM /usr/lib/libkvm.a 305246149Ssjg LIBM /usr/lib/libm.a 306246149Ssjg LIBMP /usr/lib/libmp.a 307246149Ssjg LIBPC /usr/lib/libpc.a 308246149Ssjg LIBPLOT /usr/lib/libplot.a 309246149Ssjg LIBRPC /usr/lib/sunrpc.a 310246149Ssjg LIBTERM /usr/lib/libterm.a 311246149Ssjg LIBUTIL /usr/lib/libutil.a 312246149Ssjg 313246149SsjgSHAREDSTRINGS If defined, a new .c.o rule is used that results in shared 314246149Ssjg strings, using xstr(1). Note that this will not work with 315246149Ssjg parallel makes. 316246149Ssjg 317246149SsjgSTRIP The flag passed to the install program to cause the binary 318246149Ssjg to be stripped. 319246149Ssjg 320246149SsjgSUBDIR A list of subdirectories that should be built as well. 321246149Ssjg Each of the targets will execute the same target in the 322246149Ssjg subdirectories. 323246149Ssjg 324246149SsjgThe include file <bsd.prog.mk> includes the file named "../Makefile.inc" 325246149Ssjgif it exists, as well as the include file <bsd.man.mk>. 326246149Ssjg 327246149SsjgSome simple examples: 328246149Ssjg 329246149SsjgTo build foo from foo.c with a manual page foo.1, use: 330246149Ssjg 331246149Ssjg PROG= foo 332246149Ssjg 333246149Ssjg .include <bsd.prog.mk> 334246149Ssjg 335246149SsjgTo build foo from foo.c with a manual page foo.2, add the line: 336246149Ssjg 337246149Ssjg MAN= foo.2 338246149Ssjg 339246149SsjgIf foo does not have a manual page at all, add the line: 340246149Ssjg 341246149Ssjg NOMAN= noman 342246149Ssjg 343246149SsjgIf foo has multiple source files, add the line: 344246149Ssjg 345246149Ssjg SRCS= a.c b.c c.c d.c 346246149Ssjg 347246149Ssjg=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 348246149Ssjg 349246149SsjgThe include file <bsd.subdir.mk> contains the default targets for building 350246149Ssjgsubdirectories. It has the same eight targets as <bsd.prog.mk>: all, 351246149Ssjgclean, cleandir, depend, includes, install, lint, and tags. For all of 352246149Ssjgthe directories listed in the variable SUBDIRS, the specified directory 353246149Ssjgwill be visited and the target made. There is also a default target which 354246149Ssjgallows the command "make subdir" where subdir is any directory listed in 355246149Ssjgthe variable SUBDIRS. 356246149Ssjg 357246149Ssjg=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 358246149Ssjg 359246149SsjgThe include file <bsd.sys.mk> is used by <bsd.prog.mk> and 360246149Ssjg<bsd.lib.mk>. It contains overrides that are used when building 361246149Ssjgthe NetBSD source tree. For instance, if "PARALLEL" is defined by 362246149Ssjgthe program/library Makefile, it includes a set of rules for lex and 363246149Ssjgyacc that allow multiple lex and yacc targets to be built in parallel. 364246149Ssjg 365246149Ssjg=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 366246149Ssjg 367246149SsjgThe include file <bsd.lib.mk> has support for building libraries. It has 368246149Ssjgthe same eight targets as <bsd.prog.mk>: all, clean, cleandir, depend, 369246149Ssjgincludes, install, lint, and tags. It has a limited number of suffixes, 370246149Ssjgconsistent with the current needs of the BSD tree. 371246149Ssjg 372246149SsjgIt sets/uses the following variables: 373246149Ssjg 374246149SsjgLIB The name of the library to build. 375246149Ssjg 376246149SsjgLIBDIR Target directory for libraries. 377246149Ssjg 378246149SsjgLINTLIBDIR Target directory for lint libraries. 379246149Ssjg 380246149SsjgLIBGRP Library group. 381246149Ssjg 382246149SsjgLIBOWN Library owner. 383246149Ssjg 384246149SsjgLIBMODE Library mode. 385246149Ssjg 386246149SsjgLDADD Additional loader objects. 387246149Ssjg 388246149SsjgMAN The manual pages to be installed (use a .1 - .9 suffix). 389246149Ssjg 390246149SsjgSRCS List of source files to build the library. Suffix types 391246149Ssjg .s, .c, and .f are supported. Note, .s files are preferred 392246149Ssjg to .c files of the same name. (This is not the default for 393246149Ssjg versions of make.) 394246149Ssjg 395246149SsjgThe include file <bsd.lib.mk> includes the file named "../Makefile.inc" 396246149Ssjgif it exists, as well as the include file <bsd.man.mk>. 397246149Ssjg 398246149SsjgIt has rules for building profiled objects; profiled libraries are 399246149Ssjgbuilt by default. 400246149Ssjg 401246149SsjgLibraries are ranlib'd when made. 402