Annotation of src/share/mk/bsd.README, Revision 1.8
1.8 ! deraadt 1: # $OpenBSD: bsd.README,v 1.7 1996/03/05 11:12:34 mickey Exp $
! 2: # $NetBSD: bsd.README,v 1.17 1996/04/13 02:08:08 thorpej Exp $
1.1 deraadt 3: # @(#)bsd.README 5.1 (Berkeley) 5/11/90
4:
5: This is the README file for the new make "include" files for the BSD
6: source tree. The files are installed in /usr/share/mk, and are, by
7: convention, named with the suffix ".mk".
8:
9: Note, this file is not intended to replace reading through the .mk
10: files for anything tricky.
11:
12: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
13:
14: RANDOM THINGS WORTH KNOWING:
15:
16: The files are simply C-style #include files, and pretty much behave like
17: you'd expect. The syntax is slightly different in that a single '.' is
18: used instead of the hash mark, i.e. ".include <bsd.prog.mk>".
19:
20: One difference that will save you lots of debugging time is that inclusion
21: of the file is normally done at the *end* of the Makefile. The reason for
22: this is because .mk files often modify variables and behavior based on the
23: values of variables set in the Makefile. To make this work, remember that
24: the FIRST target found is the target that is used, i.e. if the Makefile has:
25:
26: a:
27: echo a
28: a:
29: echo a number two
30:
31: the command "make a" will echo "a". To make things confusing, the SECOND
32: variable assignment is the overriding one, i.e. if the Makefile has:
33:
34: a= foo
35: a= bar
36:
37: b:
38: echo ${a}
39:
40: the command "make b" will echo "bar". This is for compatibility with the
41: way the V7 make behaved.
42:
43: It's fairly difficult to make the BSD .mk files work when you're building
44: multiple programs in a single directory. It's a lot easier split up the
45: programs than to deal with the problem. Most of the agony comes from making
46: the "obj" directory stuff work right, not because we switch to a new version
47: of make. So, don't get mad at us, figure out a better way to handle multiple
48: architectures so we can quit using the symbolic link stuff. (Imake doesn't
49: count.)
50:
51: The file .depend in the source directory is expected to contain dependencies
52: for the source files. This file is read automatically by make after reading
53: the Makefile.
54:
55: The variable DESTDIR works as before. It's not set anywhere but will change
56: the tree where the file gets installed.
57:
58: The profiled libraries are no longer built in a different directory than
59: the regular libraries. A new suffix, ".po", is used to denote a profiled
60: object.
61:
62: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
63:
64: The include file <sys.mk> has the default rules for all makes, in the BSD
65: environment or otherwise. You probably don't want to touch this file.
66:
67: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
68:
69: The include file <bsd.man.mk> handles installing manual pages and their
70: links.
71:
72: It has a single target:
73:
74: maninstall:
75: Install the manual pages and their links.
76:
77: It sets/uses the following variables:
78:
79: MANDIR Base path for manual installation.
80:
81: MANGRP Manual group.
82:
83: MANOWN Manual owner.
84:
85: MANMODE Manual mode.
86:
87: MANSUBDIR Subdirectory under the manual page section, i.e. "/vax"
88: or "/tahoe" for machine specific manual pages.
89:
1.4 niklas 90: MAN The manual pages to be installed (use a .1 - .9 suffix).
1.1 deraadt 91:
1.4 niklas 92: MLINKS List of manual page links (using a .1 - .9 suffix). The
1.1 deraadt 93: linked-to file must come first, the linked file second,
94: and there may be multiple pairs. The files are soft-linked.
95:
96: The include file <bsd.man.mk> includes a file named "../Makefile.inc" if
97: it exists.
98:
99: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
100:
1.8 ! deraadt 101: The include file <bsd.own.mk> contains source tree configuration parameters,
! 102: such as the owners, groups, etc. for both manual pages and binaries, and
! 103: a few global "feature configuration" parameters.
1.1 deraadt 104:
105: It has no targets.
106:
1.8 ! deraadt 107: To get system-specific configuration parameters, bsd.own.mk will try to
! 108: include the file specified by the "MAKECONF" variable. If MAKECONF is not
! 109: set, or no such file exists, the system make configuration file, /etc/mk.conf
! 110: is included. These files may define any of the variables described below.
! 111:
! 112: bsd.own.mk sets the following variables, if they are not already defined
! 113: (defaults are in brackets):
1.4 niklas 114:
115: BSDSRCDIR The real path to the system sources, so that 'make obj'
116: will work correctly. [/usr/src]
117:
118: BSDOBJDIR The real path to the system 'obj' tree, so that 'make obj'
119: will work correctly. [/usr/obj]
120:
121: BINGRP Binary group. [bin]
122:
123: BINOWN Binary owner. [bin]
124:
125: BINMODE Binary mode. [555]
126:
127: NONBINMODE Mode for non-executable files. [444]
128:
129: MANDIR Base path for manual installation. [/usr/share/man/cat]
130:
131: MANGRP Manual group. [bin]
132:
133: MANOWN Manual owner. [bin]
134:
135: MANMODE Manual mode. [${NONBINMODE}]
136:
137: LIBDIR Base path for library installation. [/usr/lib]
138:
139: LINTLIBDIR Base path for lint(1) library installation. [/usr/libdata/lint]
140:
141: LIBGRP Library group. [${BINGRP}]
142:
143: LIBOWN Library owner. [${BINOWN}]
144:
145: LIBMODE Library mode. [${NONBINMODE}]
146:
147: DOCDIR Base path for system documentation (e.g. PSD, USD, etc.)
148: installation. [/usr/share/doc]
149:
150: DOCGRP Documentation group. [bin]
151:
152: DOCOWN Documentation owner. [bin]
153:
154: DOCMODE Documentation mode. [${NONBINMODE}]
155:
156: NLSDIR Base path for National Language Support files installation.
157: [/usr/share/nls]
1.1 deraadt 158:
1.4 niklas 159: NLSGRP National Language Support files group. [bin]
1.1 deraadt 160:
1.4 niklas 161: NLSOWN National Language Support files owner. [bin]
1.1 deraadt 162:
1.4 niklas 163: NLSMODE National Language Support files mode. [${NONBINMODE}]
1.1 deraadt 164:
165: STRIP The flag passed to the install program to cause the binary
166: to be stripped. This is to be used when building your
167: own install script so that the entire system can be made
1.4 niklas 168: stripped/not-stripped using a single knob. [-s]
1.1 deraadt 169:
170: COPY The flag passed to the install program to cause the binary
171: to be copied rather than moved. This is to be used when
172: building our own install script so that the entire system
173: can either be installed with copies, or with moves using
1.4 niklas 174: a single knob. [-c]
175:
1.8 ! deraadt 176: Additionally, the following variables may be set by bsd.own.mk or in a
! 177: make configuration file to modify the behaviour of the system build
! 178: process (default values are in brackets along with comments, if set by
! 179: bsd.own.mk):
1.4 niklas 180:
181: SKEY Compile in support for S/key authentication. [yes, set
182: unconditionally]
183:
184: KERBEROS Compile in support for Kerberos 4 authentication.
185:
186: KERBEROS5 Compile in support for Kerberos 5 authentication.
187:
188: MANZ Compress manual pages at installation time.
189:
190: SYS_INCLUDE Copy or symlink kernel include files into /usr/include.
191: Possible values are "symlinks" or "copies" (which is
192: the same as the variable being unset).
1.1 deraadt 193:
1.4 niklas 194: NOPROFILE Do not build profiled versions of system libraries
1.1 deraadt 195:
1.4 niklas 196: NOPIC Do not build PIC versions of system libraries, and
197: do not build shared libraries. [set if ${MACHINE_ARCH}
198: is "mips", "vax", or "alpha", unset otherwise.]
1.1 deraadt 199:
1.4 niklas 200: NOLINT Do not build lint libraries. [set, set unconditionally]
1.1 deraadt 201:
1.8 ! deraadt 202: bsd.own.mk is generally useful when building your own Makefiles so that
1.1 deraadt 203: they use the same default owners etc. as the rest of the tree.
204:
205: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
206:
207: The include file <bsd.prog.mk> handles building programs from one or
208: more source files, along with their manual pages. It has a limited number
209: of suffixes, consistent with the current needs of the BSD tree.
210:
1.8 ! deraadt 211: It has eight targets:
1.1 deraadt 212:
213: all:
214: build the program and its manual page
215: clean:
216: remove the program, any object files and the files a.out,
217: Errs, errs, mklog, and core.
218: cleandir:
219: remove all of the files removed by the target clean, as
220: well as .depend, tags, and any manual pages.
221: depend:
222: make the dependencies for the source files, and store
223: them in the file .depend.
1.8 ! deraadt 224: includes:
! 225: install any header files.
1.1 deraadt 226: install:
227: install the program and its manual pages; if the Makefile
228: does not itself define the target install, the targets
229: beforeinstall and afterinstall may also be used to cause
230: actions immediately before and after the install target
231: is executed.
232: lint:
233: run lint on the source files
234: tags:
235: create a tags file for the source files.
236:
237: It sets/uses the following variables:
238:
239: BINGRP Binary group.
240:
241: BINOWN Binary owner.
242:
243: BINMODE Binary mode.
244:
245: CLEANFILES Additional files to remove for the clean and cleandir targets.
246:
247: COPTS Additional flags to the compiler when creating C objects.
248:
249: HIDEGAME If HIDEGAME is defined, the binary is installed in
250: /usr/games/hide, and a symbolic link is created to
251: /usr/games/dm.
252:
253: LDADD Additional loader objects. Usually used for libraries.
254: For example, to load with the compatibility and utility
255: libraries, use:
256:
257: LDADD+=-lutil -lcompat
258:
259: LDFLAGS Additional loader flags.
260:
261: LINKS The list of binary links; should be full pathnames, the
262: linked-to file coming first, followed by the linked
263: file. The files are hard-linked. For example, to link
264: /bin/test and /bin/[, use:
265:
266: LINKS= ${DESTDIR}/bin/test ${DESTDIR}/bin/[
267:
1.4 niklas 268: MAN Manual pages (should end in .1 - .9). If no MAN variable is
1.1 deraadt 269: defined, "MAN=${PROG}.1" is assumed.
270:
271: PROG The name of the program to build. If not supplied, nothing
272: is built.
273:
1.6 mickey 274: SRCS List of source files to build the program. If it's not
1.1 deraadt 275: defined, it's assumed to be ${PROG}.c.
276:
277: DPADD Additional dependencies for the program. Usually used for
278: libraries. For example, to depend on the compatibility and
279: utility libraries use:
280:
281: DPADD+=${LIBCOMPAT} ${LIBUTIL}
282:
283: The following libraries are predefined for DPADD:
284:
285: LIBC /lib/libc.a
286: LIBCOMPAT /usr/lib/libcompat.a
287: LIBCRYPT /usr/lib/libcrypt.a
288: LIBCURSES /usr/lib/libcurses.a
289: LIBDBM /usr/lib/libdbm.a
290: LIBDES /usr/lib/libdes.a
291: LIBL /usr/lib/libl.a
292: LIBKDB /usr/lib/libkdb.a
293: LIBKRB /usr/lib/libkrb.a
294: LIBKVM /usr/lib/libkvm.a
295: LIBM /usr/lib/libm.a
296: LIBMP /usr/lib/libmp.a
297: LIBPC /usr/lib/libpc.a
298: LIBPLOT /usr/lib/libplot.a
299: LIBRPC /usr/lib/sunrpc.a
300: LIBTERM /usr/lib/libterm.a
301: LIBUTIL /usr/lib/libutil.a
302:
303: SHAREDSTRINGS If defined, a new .c.o rule is used that results in shared
304: strings, using xstr(1). Note that this will not work with
305: parallel makes.
306:
307: STRIP The flag passed to the install program to cause the binary
308: to be stripped.
309:
310: SUBDIR A list of subdirectories that should be built as well.
311: Each of the targets will execute the same target in the
312: subdirectories.
313:
314: The include file <bsd.prog.mk> includes the file named "../Makefile.inc"
315: if it exists, as well as the include file <bsd.man.mk>.
316:
317: Some simple examples:
318:
319: To build foo from foo.c with a manual page foo.1, use:
320:
321: PROG= foo
322:
323: .include <bsd.prog.mk>
324:
325: To build foo from foo.c with a manual page foo.2, add the line:
326:
327: MAN= foo.2
328:
329: If foo does not have a manual page at all, add the line:
330:
331: NOMAN= noman
332:
333: If foo has multiple source files, add the line:
334:
335: SRCS= a.c b.c c.c d.c
336:
337: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
338:
339: The include file <bsd.subdir.mk> contains the default targets for building
1.8 ! deraadt 340: subdirectories. It has the same eight targets as <bsd.prog.mk>: all,
! 341: clean, cleandir, depend, includes, install, lint, and tags. For all of
! 342: the directories listed in the variable SUBDIRS, the specified directory
! 343: will be visited and the target made. There is also a default target which
! 344: allows the command "make subdir" where subdir is any directory listed in
! 345: the variable SUBDIRS.
1.2 deraadt 346:
347: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
348:
349: The include file <bsd.sys.mk> is used by <bsd.prog.mk> and
1.3 deraadt 350: <bsd.lib.mk>. It contains overrides that are used when building
351: the NetBSD source tree. For instance, if "PARALLEL" is defined by
352: the program/library Makefile, it includes a set of rules for lex and
353: yacc that allow multiple lex and yacc targets to be built in parallel.
1.1 deraadt 354:
355: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
356:
357: The include file <bsd.lib.mk> has support for building libraries. It has
1.8 ! deraadt 358: the same eight targets as <bsd.prog.mk>: all, clean, cleandir, depend,
! 359: includes, install, lint, and tags. It has a limited number of suffixes,
! 360: consistent with the current needs of the BSD tree.
1.1 deraadt 361:
362: It sets/uses the following variables:
363:
364: LIB The name of the library to build.
365:
366: LIBDIR Target directory for libraries.
367:
368: LINTLIBDIR Target directory for lint libraries.
369:
370: LIBGRP Library group.
371:
372: LIBOWN Library owner.
373:
374: LIBMODE Library mode.
375:
376: LDADD Additional loader objects.
377:
1.4 niklas 378: MAN The manual pages to be installed (use a .1 - .9 suffix).
1.1 deraadt 379:
380: SRCS List of source files to build the library. Suffix types
381: .s, .c, and .f are supported. Note, .s files are preferred
382: to .c files of the same name. (This is not the default for
383: versions of make.)
384:
385: The include file <bsd.lib.mk> includes the file named "../Makefile.inc"
386: if it exists, as well as the include file <bsd.man.mk>.
387:
388: It has rules for building profiled objects; profiled libraries are
389: built by default.
390:
391: Libraries are ranlib'd when made.
1.6 mickey 392:
393: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
394:
395: The include file <bsd.lkm.mk> has support for building the LKM's. It has
396: the same seven targets as <bsd.prog.mk>: all, clean, cleandir, depend,
397: install, lint, and tags. In addition two targets are made available
398: that is specific to the LKM's: load, unload.
399:
400: It sets/uses the following variables (in addition to the <bsd.prog.mk>'s):
401:
402: LKM LKM name to build.
403:
404: LKMGRP Module group.
405:
406: LKMOWN Module owner.
407:
408: LKMMODE Module mode.
1.7 mickey 409:
410: POSTINSTALL Program to pass with '-p' flag to the modload.
411: If not defined,
412: POSTINSTALL=${LKM}install
413: is assumed.
1.6 mickey 414:
415: The include file <bsd.lkm.mk> includes the file named "../Makefile.inc"
416: if it exists, as well as the include file <bsd.man.mk>.
417: