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