Annotation of src/share/mk/bsd.README, Revision 1.45
1.45 ! lukem 1: # $NetBSD: bsd.README,v 1.44 1998/11/07 09:40:35 erh Exp $
1.24 mikel 2: # @(#)bsd.README 8.2 (Berkeley) 4/2/94
1.1 cgd 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
1.11 jtc 6: convention, named with the suffix ".mk".
1.1 cgd 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
1.36 ross 45: the "obj" directory stuff work right, not because we switched to a new version
1.1 cgd 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
1.21 christos 59: object, and ".so" denotes a shared (position-independent) object.
60:
1.45 ! lukem 61: The following variables that control how things are made/installed that
! 62: are not set by default. These should not be set by Makefiles; they're
! 63: for the user to define in /etc/mk.conf or on the make(1) command line:
1.21 christos 64:
1.45 ! lukem 65: BUILD If defined, 'make install' checks that the targets in the
! 66: source directories are up-to-date and remakes them if they
1.21 christos 67: are out of date, instead of blindly trying to install
68: out of date or non-existant targets.
69:
1.45 ! lukem 70: UPDATE If defined, 'make install' only installs targets that are
! 71: more recently modified in the source directories that their
! 72: installed counterparts.
! 73:
! 74: MKCATPAGES If "no", don't build or install the catman pages.
! 75:
! 76: MKDOC If "no", don't build or install the documentation.
! 77:
! 78: MKLINKLIB If "no", act as "MKPICINSTALL=no MKPROFILE=no".
! 79: Also:
! 80: - don't install the .a libraries
! 81: - don't install _pic.a libraries on PIC systems
! 82: - don't build .a libraries on PIC systems
! 83: - don't install the .so symlink on ELF systems
! 84: I.e, only install the shared library (and the .so.major
! 85: symlink on ELF).
! 86:
! 87: MKLINT If "no", don't build or install the lint libraries.
! 88:
! 89: MKMAN If "no", don't build or install the man or catman pages.
! 90:
! 91: MKNLS If "no", don't build or install the NLS files.
! 92:
! 93: MKOBJ If "no", don't create objdirs.
! 94:
! 95: MKPIC If "no", don't build or install shared libraries.
! 96:
! 97: MKPICINSTALL If "no", don't install the *_pic.a libraries.
! 98:
! 99: MKPROFILE If "no", don't build or install the profiling libraries.
! 100:
! 101: MKSHARE If "no", act as "MKDOC=no MKMAN=no MKNLS=no".
! 102: I.e, don't build documentation, info pages, man pages,
! 103: NLS files, etc.
1.1 cgd 104:
105: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
106:
107: The include file <sys.mk> has the default rules for all makes, in the BSD
108: environment or otherwise. You probably don't want to touch this file.
109:
110: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
111:
112: The include file <bsd.man.mk> handles installing manual pages and their
113: links.
114:
1.21 christos 115: It has a two targets:
1.1 cgd 116:
117: maninstall:
1.21 christos 118: Install the manual page sources and their links.
119: catinstall:
120: Install the preformatted manual pages and their links.
1.1 cgd 121:
122: It sets/uses the following variables:
123:
124: MANDIR Base path for manual installation.
125:
126: MANGRP Manual group.
127:
128: MANOWN Manual owner.
129:
130: MANMODE Manual mode.
131:
132: MANSUBDIR Subdirectory under the manual page section, i.e. "/vax"
133: or "/tahoe" for machine specific manual pages.
134:
1.15 cgd 135: MAN The manual pages to be installed (use a .1 - .9 suffix).
1.1 cgd 136:
1.15 cgd 137: MLINKS List of manual page links (using a .1 - .9 suffix). The
1.1 cgd 138: linked-to file must come first, the linked file second,
139: and there may be multiple pairs. The files are soft-linked.
140:
141: The include file <bsd.man.mk> includes a file named "../Makefile.inc" if
142: it exists.
143:
144: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
145:
1.17 thorpej 146: The include file <bsd.own.mk> contains source tree configuration parameters,
147: such as the owners, groups, etc. for both manual pages and binaries, and
148: a few global "feature configuration" parameters.
1.1 cgd 149:
150: It has no targets.
151:
1.29 cjs 152: To get system-specific configuration parameters, bsd.own.mk will try to
153: include the file specified by the "MAKECONF" variable. If MAKECONF is not
154: set, or no such file exists, the system make configuration file, /etc/mk.conf
155: is included. These files may define any of the variables described below.
1.17 thorpej 156:
157: bsd.own.mk sets the following variables, if they are not already defined
158: (defaults are in brackets):
1.15 cgd 159:
1.21 christos 160:
161:
1.15 cgd 162: BSDSRCDIR The real path to the system sources, so that 'make obj'
163: will work correctly. [/usr/src]
164:
165: BSDOBJDIR The real path to the system 'obj' tree, so that 'make obj'
166: will work correctly. [/usr/obj]
167:
1.34 lukem 168: BINGRP Binary group. [wheel]
1.15 cgd 169:
1.34 lukem 170: BINOWN Binary owner. [root]
1.15 cgd 171:
172: BINMODE Binary mode. [555]
173:
174: NONBINMODE Mode for non-executable files. [444]
175:
176: MANDIR Base path for manual installation. [/usr/share/man/cat]
177:
1.34 lukem 178: MANGRP Manual group. [wheel]
1.15 cgd 179:
1.34 lukem 180: MANOWN Manual owner. [root]
1.15 cgd 181:
182: MANMODE Manual mode. [${NONBINMODE}]
183:
1.21 christos 184: MANINSTALL Manual installation type: maninstall, catinstall, or both
185:
1.15 cgd 186: LIBDIR Base path for library installation. [/usr/lib]
187:
188: LINTLIBDIR Base path for lint(1) library installation. [/usr/libdata/lint]
189:
190: LIBGRP Library group. [${BINGRP}]
191:
192: LIBOWN Library owner. [${BINOWN}]
193:
194: LIBMODE Library mode. [${NONBINMODE}]
195:
196: DOCDIR Base path for system documentation (e.g. PSD, USD, etc.)
197: installation. [/usr/share/doc]
198:
1.34 lukem 199: DOCGRP Documentation group. [wheel]
1.15 cgd 200:
1.34 lukem 201: DOCOWN Documentation owner. [root]
1.15 cgd 202:
203: DOCMODE Documentation mode. [${NONBINMODE}]
204:
205: NLSDIR Base path for National Language Support files installation.
206: [/usr/share/nls]
1.1 cgd 207:
1.34 lukem 208: NLSGRP National Language Support files group. [wheel]
1.1 cgd 209:
1.34 lukem 210: NLSOWN National Language Support files owner. [root]
1.1 cgd 211:
1.15 cgd 212: NLSMODE National Language Support files mode. [${NONBINMODE}]
1.1 cgd 213:
1.32 mikel 214: STRIPFLAG The flag passed to the install program to cause the binary
1.1 cgd 215: to be stripped. This is to be used when building your
216: own install script so that the entire system can be made
1.15 cgd 217: stripped/not-stripped using a single knob. [-s]
1.1 cgd 218:
1.2 cgd 219: COPY The flag passed to the install program to cause the binary
220: to be copied rather than moved. This is to be used when
221: building our own install script so that the entire system
222: can either be installed with copies, or with moves using
1.15 cgd 223: a single knob. [-c]
224:
1.17 thorpej 225: Additionally, the following variables may be set by bsd.own.mk or in a
226: make configuration file to modify the behaviour of the system build
227: process (default values are in brackets along with comments, if set by
228: bsd.own.mk):
1.15 cgd 229:
230: EXPORTABLE_SYSTEM
231: Do not build /usr/src/domestic, even if it is present.
1.2 cgd 232:
1.15 cgd 233: SKEY Compile in support for S/key authentication. [yes, set
234: unconditionally]
235:
236: KERBEROS Compile in support for Kerberos 4 authentication.
237:
238: KERBEROS5 Compile in support for Kerberos 5 authentication.
239:
240: MANZ Compress manual pages at installation time.
241:
242: SYS_INCLUDE Copy or symlink kernel include files into /usr/include.
243: Possible values are "symlinks" or "copies" (which is
244: the same as the variable being unset).
1.1 cgd 245:
1.15 cgd 246: NOPROFILE Do not build profiled versions of system libraries
1.1 cgd 247:
1.15 cgd 248: NOPIC Do not build PIC versions of system libraries, and
249: do not build shared libraries. [set if ${MACHINE_ARCH}
1.45 ! lukem 250: is "sparc64", unset otherwise.]
1.1 cgd 251:
1.40 perry 252: NOLINT Do not build lint libraries.
1.33 jonathan 253:
1.38 simonb 254: OBJECT_FMT Object file format. [set to "ELF" on ports that use
1.33 jonathan 255: ELF -- currently if ${MACHINE_ARCH} is "alpha", "mips"
256: or "powerpc" or set to "a.out" on other ports].
257:
1.1 cgd 258:
1.17 thorpej 259: bsd.own.mk is generally useful when building your own Makefiles so that
1.1 cgd 260: they use the same default owners etc. as the rest of the tree.
261:
262: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
263:
264: The include file <bsd.prog.mk> handles building programs from one or
265: more source files, along with their manual pages. It has a limited number
266: of suffixes, consistent with the current needs of the BSD tree.
267:
1.16 jtc 268: It has eight targets:
1.1 cgd 269:
270: all:
271: build the program and its manual page
272: clean:
273: remove the program, any object files and the files a.out,
1.24 mikel 274: Errs, errs, mklog, and ${PROG}.core.
1.1 cgd 275: cleandir:
276: remove all of the files removed by the target clean, as
277: well as .depend, tags, and any manual pages.
1.42 lukem 278: `distclean' is a synonym for `cleandir'.
1.1 cgd 279: depend:
280: make the dependencies for the source files, and store
281: them in the file .depend.
1.16 jtc 282: includes:
283: install any header files.
1.1 cgd 284: install:
285: install the program and its manual pages; if the Makefile
286: does not itself define the target install, the targets
287: beforeinstall and afterinstall may also be used to cause
288: actions immediately before and after the install target
289: is executed.
290: lint:
291: run lint on the source files
292: tags:
293: create a tags file for the source files.
294:
295: It sets/uses the following variables:
296:
297: BINGRP Binary group.
298:
299: BINOWN Binary owner.
300:
301: BINMODE Binary mode.
302:
303: CLEANFILES Additional files to remove for the clean and cleandir targets.
304:
305: COPTS Additional flags to the compiler when creating C objects.
1.35 lukem 306:
307: CPPFLAGS Additional flags to the C pre-processor
1.1 cgd 308:
309: LDADD Additional loader objects. Usually used for libraries.
310: For example, to load with the compatibility and utility
311: libraries, use:
312:
1.5 jtc 313: LDADD+=-lutil -lcompat
1.1 cgd 314:
315: LDFLAGS Additional loader flags.
316:
317: LINKS The list of binary links; should be full pathnames, the
318: linked-to file coming first, followed by the linked
319: file. The files are hard-linked. For example, to link
320: /bin/test and /bin/[, use:
321:
322: LINKS= ${DESTDIR}/bin/test ${DESTDIR}/bin/[
1.19 perry 323:
324: SYMLINKS The list of symbolic links; should be full pathnames.
1.20 perry 325: Syntax is identical to LINKS. Note that DESTDIR is not
326: automatically included in the link.
1.1 cgd 327:
1.15 cgd 328: MAN Manual pages (should end in .1 - .9). If no MAN variable is
1.8 cgd 329: defined, "MAN=${PROG}.1" is assumed.
1.1 cgd 330:
331: PROG The name of the program to build. If not supplied, nothing
332: is built.
333:
1.21 christos 334: PROGNAME The name that the above program will be installed as, if
335: different from ${PROG}.
336:
1.37 tv 337: SRCS List of source files to build the program. If SRCS is not
1.1 cgd 338: defined, it's assumed to be ${PROG}.c.
339:
340: DPADD Additional dependencies for the program. Usually used for
341: libraries. For example, to depend on the compatibility and
342: utility libraries use:
343:
1.5 jtc 344: DPADD+=${LIBCOMPAT} ${LIBUTIL}
1.1 cgd 345:
346: The following libraries are predefined for DPADD:
347:
1.21 christos 348: LIBCRT0?= ${DESTDIR}/usr/lib/crt0.o
349: LIBC?= ${DESTDIR}/usr/lib/libc.a
350: LIBC_PIC?= ${DESTDIR}/usr/lib/libc_pic.a
351: LIBCOMPAT?= ${DESTDIR}/usr/lib/libcompat.a
352: LIBCRYPT?= ${DESTDIR}/usr/lib/libcrypt.a
353: LIBCURSES?= ${DESTDIR}/usr/lib/libcurses.a
354: LIBDBM?= ${DESTDIR}/usr/lib/libdbm.a
355: LIBDES?= ${DESTDIR}/usr/lib/libdes.a
356: LIBEDIT?= ${DESTDIR}/usr/lib/libedit.a
357: LIBGCC?= ${DESTDIR}/usr/lib/libgcc.a
358: LIBGNUMALLOC?= ${DESTDIR}/usr/lib/libgnumalloc.a
359: LIBKDB?= ${DESTDIR}/usr/lib/libkdb.a
360: LIBKRB?= ${DESTDIR}/usr/lib/libkrb.a
361: LIBKVM?= ${DESTDIR}/usr/lib/libkvm.a
362: LIBL?= ${DESTDIR}/usr/lib/libl.a
363: LIBM?= ${DESTDIR}/usr/lib/libm.a
364: LIBMP?= ${DESTDIR}/usr/lib/libmp.a
1.25 christos 365: LIBNTP?= ${DESTDIR}/usr/lib/libntp.a
1.21 christos 366: LIBPC?= ${DESTDIR}/usr/lib/libpc.a
367: LIBPCAP?= ${DESTDIR}/usr/lib/libpcap.a
368: LIBPLOT?= ${DESTDIR}/usr/lib/libplot.a
1.26 kleink 369: LIBPOSIX?= ${DESTDIR}/usr/lib/libposix.a
1.21 christos 370: LIBRESOLV?= ${DESTDIR}/usr/lib/libresolv.a
371: LIBRPCSVC?= ${DESTDIR}/usr/lib/librpcsvc.a
372: LIBSKEY?= ${DESTDIR}/usr/lib/libskey.a
373: LIBTERMCAP?= ${DESTDIR}/usr/lib/libtermcap.a
374: LIBTELNET?= ${DESTDIR}/usr/lib/libtelnet.a
375: LIBUTIL?= ${DESTDIR}/usr/lib/libutil.a
376: LIBWRAP?= ${DESTDIR}/usr/lib/libwrap.a
377: LIBY?= ${DESTDIR}/usr/lib/liby.a
378: LIBZ?= ${DESTDIR}/usr/lib/libz.a
379:
1.1 cgd 380:
381: SHAREDSTRINGS If defined, a new .c.o rule is used that results in shared
1.12 christos 382: strings, using xstr(1). Note that this will not work with
383: parallel makes.
1.1 cgd 384:
385: STRIP The flag passed to the install program to cause the binary
386: to be stripped.
387:
388: SUBDIR A list of subdirectories that should be built as well.
389: Each of the targets will execute the same target in the
390: subdirectories.
391:
1.21 christos 392: SCRIPTS A list of interpreter scripts [file.{sh,csh,pl,awk,...}].
393: These are installed exactly like programs.
394:
395: SCRIPTSNAME The name that the above program will be installed as, if
396: different from ${SCRIPTS}. These can be further specialized
397: by setting SCRIPTSNAME_<script>.
398:
399: FILES A list of files to install. The installation is controlled
400: by the FILESNAME, FILESOWN, FILESGRP, FILESMODE, FILESDIR
401: variables that can be further specialized by FILES<VAR>_<file>
402:
1.1 cgd 403: The include file <bsd.prog.mk> includes the file named "../Makefile.inc"
404: if it exists, as well as the include file <bsd.man.mk>.
405:
406: Some simple examples:
407:
408: To build foo from foo.c with a manual page foo.1, use:
409:
410: PROG= foo
411:
412: .include <bsd.prog.mk>
413:
414: To build foo from foo.c with a manual page foo.2, add the line:
415:
1.9 cgd 416: MAN= foo.2
1.1 cgd 417:
418: If foo does not have a manual page at all, add the line:
419:
420: NOMAN= noman
421:
422: If foo has multiple source files, add the line:
423:
424: SRCS= a.c b.c c.c d.c
425:
426: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
427:
428: The include file <bsd.subdir.mk> contains the default targets for building
1.16 jtc 429: subdirectories. It has the same eight targets as <bsd.prog.mk>: all,
430: clean, cleandir, depend, includes, install, lint, and tags. For all of
431: the directories listed in the variable SUBDIRS, the specified directory
432: will be visited and the target made. There is also a default target which
433: allows the command "make subdir" where subdir is any directory listed in
434: the variable SUBDIRS.
1.21 christos 435:
436: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
437:
1.23 christos 438: The include file <bsd.links.mk> handles the LINKS and SYMLINKS variables
439: and is included from from bsd.lib.mk and bsd.prog.mk.
440:
441: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
442:
443: The include file <bsd.files.mk> handles the FILES variables and is included
444: from bsd.lib.mk and bsd.prog.mk.
1.21 christos 445:
446: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
447:
1.29 cjs 448: The include file <bsd.inc.mk> defines the includes target and uses two
449: variables:
1.21 christos 450:
1.29 cjs 451: INCS The list of include files
1.21 christos 452:
1.29 cjs 453: INCSDIR The location to install the include files.
1.39 cgd 454:
455: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
456:
457: The include file <bsd.kinc.mk> defines the many targets (includes,
458: subdirectories, etc.), and is used by kernel makefiles to handle
459: include file installation. It is intended to be included alone, by
460: kernel Makefiles. Please see bsd.kinc.mk for more details, and keep
461: the documentation in that file up to date.
1.13 christos 462:
463: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
464:
465: The include file <bsd.sys.mk> is used by <bsd.prog.mk> and
1.14 cgd 466: <bsd.lib.mk>. It contains overrides that are used when building
467: the NetBSD source tree. For instance, if "PARALLEL" is defined by
468: the program/library Makefile, it includes a set of rules for lex and
469: yacc that allow multiple lex and yacc targets to be built in parallel.
1.1 cgd 470:
471: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
472:
473: The include file <bsd.lib.mk> has support for building libraries. It has
1.16 jtc 474: the same eight targets as <bsd.prog.mk>: all, clean, cleandir, depend,
1.44 erh 475: includes, install, lint, and tags. Additionally, it has a checkver target
476: which checks for installed shared object libraries whose version is greater
477: that the version of the source. It has a limited number of suffixes,
1.16 jtc 478: consistent with the current needs of the BSD tree.
1.1 cgd 479:
480: It sets/uses the following variables:
1.10 cgd 481:
482: LIB The name of the library to build.
1.1 cgd 483:
484: LIBDIR Target directory for libraries.
485:
486: LINTLIBDIR Target directory for lint libraries.
487:
488: LIBGRP Library group.
489:
490: LIBOWN Library owner.
491:
492: LIBMODE Library mode.
493:
494: LDADD Additional loader objects.
495:
1.15 cgd 496: MAN The manual pages to be installed (use a .1 - .9 suffix).
1.44 erh 497:
498: NOCHECKVER_<library>
499: NOCHECKVER If set, disables checking for installed shared object
500: libraries with versions greater than the source. A
501: particular library name, without the "lib" prefix, may
502: be appended to the variable name to disable the check for
503: only that library.
1.1 cgd 504:
505: SRCS List of source files to build the library. Suffix types
506: .s, .c, and .f are supported. Note, .s files are preferred
507: to .c files of the same name. (This is not the default for
508: versions of make.)
509:
510: The include file <bsd.lib.mk> includes the file named "../Makefile.inc"
511: if it exists, as well as the include file <bsd.man.mk>.
512:
513: It has rules for building profiled objects; profiled libraries are
514: built by default.
515:
1.4 cgd 516: Libraries are ranlib'd when made.
1.30 agc 517:
518: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
CVSweb <webmaster@jp.NetBSD.org>