[BACK]Return to bsd.README CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / share / mk

Annotation of src/share/mk/bsd.README, Revision 1.25

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

CVSweb <webmaster@jp.NetBSD.org>