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