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

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

1.7     ! mickey      1: #      $OpenBSD$
        !             2: #      $NetBSD: bsd.README,v 1.15 1996/01/22 22:46:06 cgd 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:
                    101: The include file <bsd.own.mk> contains the owners, groups, etc. for both
                    102: manual pages and binaries.
                    103:
                    104: It has no targets.
                    105:
1.4       niklas    106: It sets the following variables, if they are not already defined (defaults
                    107: are in brackets):
                    108:
                    109: BSDSRCDIR      The real path to the system sources, so that 'make obj'
                    110:                will work correctly. [/usr/src]
                    111:
                    112: BSDOBJDIR      The real path to the system 'obj' tree, so that 'make obj'
                    113:                will work correctly. [/usr/obj]
                    114:
                    115: BINGRP         Binary group. [bin]
                    116:
                    117: BINOWN         Binary owner. [bin]
                    118:
                    119: BINMODE                Binary mode. [555]
                    120:
                    121: NONBINMODE     Mode for non-executable files. [444]
                    122:
                    123: MANDIR         Base path for manual installation. [/usr/share/man/cat]
                    124:
                    125: MANGRP         Manual group. [bin]
                    126:
                    127: MANOWN         Manual owner. [bin]
                    128:
                    129: MANMODE                Manual mode. [${NONBINMODE}]
                    130:
                    131: LIBDIR         Base path for library installation. [/usr/lib]
                    132:
                    133: LINTLIBDIR     Base path for lint(1) library installation. [/usr/libdata/lint]
                    134:
                    135: LIBGRP         Library group. [${BINGRP}]
                    136:
                    137: LIBOWN         Library owner. [${BINOWN}]
                    138:
                    139: LIBMODE                Library mode. [${NONBINMODE}]
                    140:
                    141: DOCDIR         Base path for system documentation (e.g. PSD, USD, etc.)
                    142:                installation. [/usr/share/doc]
                    143:
                    144: DOCGRP         Documentation group. [bin]
                    145:
                    146: DOCOWN         Documentation owner. [bin]
                    147:
                    148: DOCMODE                Documentation mode. [${NONBINMODE}]
                    149:
                    150: NLSDIR         Base path for National Language Support files installation.
                    151:                [/usr/share/nls]
1.1       deraadt   152:
1.4       niklas    153: NLSGRP         National Language Support files group. [bin]
1.1       deraadt   154:
1.4       niklas    155: NLSOWN         National Language Support files owner. [bin]
1.1       deraadt   156:
1.4       niklas    157: NLSMODE                National Language Support files mode. [${NONBINMODE}]
1.1       deraadt   158:
                    159: STRIP          The flag passed to the install program to cause the binary
                    160:                to be stripped.  This is to be used when building your
                    161:                own install script so that the entire system can be made
1.4       niklas    162:                stripped/not-stripped using a single knob. [-s]
1.1       deraadt   163:
                    164: COPY           The flag passed to the install program to cause the binary
                    165:                to be copied rather than moved.  This is to be used when
                    166:                building our own install script so that the entire system
                    167:                can either be installed with copies, or with moves using
1.4       niklas    168:                a single knob. [-c]
                    169:
                    170: Additionally, the following variables may be set to modify the behaviour
                    171: of the system build process (default values are in brackets along with
                    172: comments, if set by bsd.own.mk):
                    173:
                    174: SKEY           Compile in support for S/key authentication. [yes, set
                    175:                unconditionally]
                    176:
                    177: KERBEROS       Compile in support for Kerberos 4 authentication.
                    178:
                    179: KERBEROS5      Compile in support for Kerberos 5 authentication.
                    180:
                    181: MANZ           Compress manual pages at installation time.
                    182:
                    183: SYS_INCLUDE    Copy or symlink kernel include files into /usr/include.
                    184:                Possible values are "symlinks" or "copies" (which is
                    185:                the same as the variable being unset).
1.1       deraadt   186:
1.4       niklas    187: NOPROFILE      Do not build profiled versions of system libraries
1.1       deraadt   188:
1.4       niklas    189: NOPIC          Do not build PIC versions of system libraries, and
                    190:                do not build shared libraries.  [set if ${MACHINE_ARCH}
                    191:                is "mips", "vax", or "alpha", unset otherwise.]
1.1       deraadt   192:
1.4       niklas    193: NOLINT         Do not build lint libraries. [set, set unconditionally]
1.1       deraadt   194:
                    195: This file is generally useful when building your own Makefiles so that
                    196: they use the same default owners etc. as the rest of the tree.
                    197:
                    198: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                    199:
                    200: The include file <bsd.prog.mk> handles building programs from one or
                    201: more source files, along with their manual pages.  It has a limited number
                    202: of suffixes, consistent with the current needs of the BSD tree.
                    203:
                    204: It has seven targets:
                    205:
                    206:        all:
                    207:                build the program and its manual page
                    208:        clean:
                    209:                remove the program, any object files and the files a.out,
                    210:                Errs, errs, mklog, and core.
                    211:        cleandir:
                    212:                remove all of the files removed by the target clean, as
                    213:                well as .depend, tags, and any manual pages.
                    214:        depend:
                    215:                make the dependencies for the source files, and store
                    216:                them in the file .depend.
                    217:        install:
                    218:                install the program and its manual pages; if the Makefile
                    219:                does not itself define the target install, the targets
                    220:                beforeinstall and afterinstall may also be used to cause
                    221:                actions immediately before and after the install target
                    222:                is executed.
                    223:        lint:
                    224:                run lint on the source files
                    225:        tags:
                    226:                create a tags file for the source files.
                    227:
                    228: It sets/uses the following variables:
                    229:
                    230: BINGRP         Binary group.
                    231:
                    232: BINOWN         Binary owner.
                    233:
                    234: BINMODE                Binary mode.
                    235:
                    236: CLEANFILES     Additional files to remove for the clean and cleandir targets.
                    237:
                    238: COPTS          Additional flags to the compiler when creating C objects.
                    239:
                    240: HIDEGAME       If HIDEGAME is defined, the binary is installed in
                    241:                /usr/games/hide, and a symbolic link is created to
                    242:                /usr/games/dm.
                    243:
                    244: LDADD          Additional loader objects.  Usually used for libraries.
                    245:                For example, to load with the compatibility and utility
                    246:                libraries, use:
                    247:
                    248:                        LDADD+=-lutil -lcompat
                    249:
                    250: LDFLAGS                Additional loader flags.
                    251:
                    252: LINKS          The list of binary links; should be full pathnames, the
                    253:                linked-to file coming first, followed by the linked
                    254:                file.  The files are hard-linked.  For example, to link
                    255:                /bin/test and /bin/[, use:
                    256:
                    257:                        LINKS=  ${DESTDIR}/bin/test ${DESTDIR}/bin/[
                    258:
1.4       niklas    259: MAN            Manual pages (should end in .1 - .9).  If no MAN variable is
1.1       deraadt   260:                defined, "MAN=${PROG}.1" is assumed.
                    261:
                    262: PROG           The name of the program to build.  If not supplied, nothing
                    263:                is built.
                    264:
1.6       mickey    265: SRCS           List of source files to build the program.  If it's not
1.1       deraadt   266:                defined, it's assumed to be ${PROG}.c.
                    267:
                    268: DPADD          Additional dependencies for the program.  Usually used for
                    269:                libraries.  For example, to depend on the compatibility and
                    270:                utility libraries use:
                    271:
                    272:                        DPADD+=${LIBCOMPAT} ${LIBUTIL}
                    273:
                    274:                The following libraries are predefined for DPADD:
                    275:
                    276:                        LIBC            /lib/libc.a
                    277:                        LIBCOMPAT       /usr/lib/libcompat.a
                    278:                        LIBCRYPT        /usr/lib/libcrypt.a
                    279:                        LIBCURSES       /usr/lib/libcurses.a
                    280:                        LIBDBM          /usr/lib/libdbm.a
                    281:                        LIBDES          /usr/lib/libdes.a
                    282:                        LIBL            /usr/lib/libl.a
                    283:                        LIBKDB          /usr/lib/libkdb.a
                    284:                        LIBKRB          /usr/lib/libkrb.a
                    285:                        LIBKVM          /usr/lib/libkvm.a
                    286:                        LIBM            /usr/lib/libm.a
                    287:                        LIBMP           /usr/lib/libmp.a
                    288:                        LIBPC           /usr/lib/libpc.a
                    289:                        LIBPLOT         /usr/lib/libplot.a
                    290:                        LIBRPC          /usr/lib/sunrpc.a
                    291:                        LIBTERM         /usr/lib/libterm.a
                    292:                        LIBUTIL         /usr/lib/libutil.a
                    293:
                    294: SHAREDSTRINGS  If defined, a new .c.o rule is used that results in shared
                    295:                strings, using xstr(1). Note that this will not work with
                    296:                parallel makes.
                    297:
                    298: STRIP          The flag passed to the install program to cause the binary
                    299:                to be stripped.
                    300:
                    301: SUBDIR         A list of subdirectories that should be built as well.
                    302:                Each of the targets will execute the same target in the
                    303:                subdirectories.
                    304:
                    305: The include file <bsd.prog.mk> includes the file named "../Makefile.inc"
                    306: if it exists, as well as the include file <bsd.man.mk>.
                    307:
                    308: Some simple examples:
                    309:
                    310: To build foo from foo.c with a manual page foo.1, use:
                    311:
                    312:        PROG=   foo
                    313:
                    314:        .include <bsd.prog.mk>
                    315:
                    316: To build foo from foo.c with a manual page foo.2, add the line:
                    317:
                    318:        MAN=    foo.2
                    319:
                    320: If foo does not have a manual page at all, add the line:
                    321:
                    322:        NOMAN=  noman
                    323:
                    324: If foo has multiple source files, add the line:
                    325:
                    326:        SRCS=   a.c b.c c.c d.c
                    327:
                    328: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                    329:
                    330: The include file <bsd.subdir.mk> contains the default targets for building
                    331: subdirectories.  It has the same seven targets as <bsd.prog.mk>: all, clean,
                    332: cleandir, depend, install, lint, and tags.  For all of the directories
                    333: listed in the variable SUBDIRS, the specified directory will be visited
                    334: and the target made.  There is also a default target which allows the
                    335: command "make subdir" where subdir is any directory listed in the variable
                    336: SUBDIRS.
1.2       deraadt   337:
                    338: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                    339:
                    340: The include file <bsd.sys.mk> is used by <bsd.prog.mk> and
1.3       deraadt   341: <bsd.lib.mk>.  It contains overrides that are used when building
                    342: the NetBSD source tree.  For instance, if "PARALLEL" is defined by
                    343: the program/library Makefile, it includes a set of rules for lex and
                    344: yacc that allow multiple lex and yacc targets to be built in parallel.
1.1       deraadt   345:
                    346: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                    347:
                    348: The include file <bsd.lib.mk> has support for building libraries.  It has
                    349: the same seven targets as <bsd.prog.mk>: all, clean, cleandir, depend,
                    350: install, lint, and tags.  It has a limited number of suffixes, consistent
                    351: with the current needs of the BSD tree.
                    352:
                    353: It sets/uses the following variables:
                    354:
                    355: LIB            The name of the library to build.
                    356:
                    357: LIBDIR         Target directory for libraries.
                    358:
                    359: LINTLIBDIR     Target directory for lint libraries.
                    360:
                    361: LIBGRP         Library group.
                    362:
                    363: LIBOWN         Library owner.
                    364:
                    365: LIBMODE                Library mode.
                    366:
                    367: LDADD          Additional loader objects.
                    368:
1.4       niklas    369: MAN            The manual pages to be installed (use a .1 - .9 suffix).
1.1       deraadt   370:
                    371: SRCS           List of source files to build the library.  Suffix types
                    372:                .s, .c, and .f are supported.  Note, .s files are preferred
                    373:                to .c files of the same name.  (This is not the default for
                    374:                versions of make.)
                    375:
                    376: The include file <bsd.lib.mk> includes the file named "../Makefile.inc"
                    377: if it exists, as well as the include file <bsd.man.mk>.
                    378:
                    379: It has rules for building profiled objects; profiled libraries are
                    380: built by default.
                    381:
                    382: Libraries are ranlib'd when made.
1.6       mickey    383:
                    384: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                    385:
                    386: The include file <bsd.lkm.mk> has support for building the LKM's. It has
                    387: the same seven targets as <bsd.prog.mk>: all, clean, cleandir, depend,
                    388: install, lint, and tags. In addition two targets are made available
                    389: that is specific to the LKM's: load, unload.
                    390:
                    391: It sets/uses the following variables (in addition to the <bsd.prog.mk>'s):
                    392:
                    393: LKM            LKM name to build.
                    394:
                    395: LKMGRP         Module group.
                    396:
                    397: LKMOWN         Module owner.
                    398:
                    399: LKMMODE                Module mode.
1.7     ! mickey    400:
        !           401: POSTINSTALL    Program to pass with '-p' flag to the modload.
        !           402:                If not defined,
        !           403:                        POSTINSTALL=${LKM}install
        !           404:                is assumed.
1.6       mickey    405:
                    406: The include file <bsd.lkm.mk> includes the file named "../Makefile.inc"
                    407: if it exists, as well as the include file <bsd.man.mk>.
                    408: