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

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

1.17    ! espie       1: #      $OpenBSD: bsd.README,v 1.16 1998/07/15 22:18:05 espie 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:
                    147: MANOWN         Manual owner. [bin]
                    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:
                    166: DOCOWN         Documentation owner. [bin]
                    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.4       niklas    175: NLSOWN         National Language Support files owner. [bin]
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.1       deraadt   221:
1.8       deraadt   222: bsd.own.mk is generally useful when building your own Makefiles so that
1.1       deraadt   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.8       deraadt   231: It has eight targets:
1.1       deraadt   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,
                    237:                Errs, errs, mklog, and core.
                    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.8       deraadt   244:        includes:
                    245:                install any header files.
1.1       deraadt   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: HIDEGAME       If HIDEGAME is defined, the binary is installed in
                    270:                /usr/games/hide, and a symbolic link is created to
                    271:                /usr/games/dm.
                    272:
                    273: LDADD          Additional loader objects.  Usually used for libraries.
                    274:                For example, to load with the compatibility and utility
                    275:                libraries, use:
                    276:
                    277:                        LDADD+=-lutil -lcompat
                    278:
                    279: LDFLAGS                Additional loader flags.
                    280:
                    281: LINKS          The list of binary links; should be full pathnames, the
                    282:                linked-to file coming first, followed by the linked
                    283:                file.  The files are hard-linked.  For example, to link
                    284:                /bin/test and /bin/[, use:
                    285:
                    286:                        LINKS=  ${DESTDIR}/bin/test ${DESTDIR}/bin/[
                    287:
1.4       niklas    288: MAN            Manual pages (should end in .1 - .9).  If no MAN variable is
1.1       deraadt   289:                defined, "MAN=${PROG}.1" is assumed.
                    290:
                    291: PROG           The name of the program to build.  If not supplied, nothing
                    292:                is built.
                    293:
1.6       mickey    294: SRCS           List of source files to build the program.  If it's not
1.1       deraadt   295:                defined, it's assumed to be ${PROG}.c.
                    296:
                    297: DPADD          Additional dependencies for the program.  Usually used for
                    298:                libraries.  For example, to depend on the compatibility and
                    299:                utility libraries use:
                    300:
                    301:                        DPADD+=${LIBCOMPAT} ${LIBUTIL}
                    302:
                    303:                The following libraries are predefined for DPADD:
                    304:
                    305:                        LIBC            /lib/libc.a
                    306:                        LIBCOMPAT       /usr/lib/libcompat.a
                    307:                        LIBCURSES       /usr/lib/libcurses.a
                    308:                        LIBDBM          /usr/lib/libdbm.a
                    309:                        LIBDES          /usr/lib/libdes.a
                    310:                        LIBL            /usr/lib/libl.a
                    311:                        LIBKDB          /usr/lib/libkdb.a
                    312:                        LIBKRB          /usr/lib/libkrb.a
                    313:                        LIBKVM          /usr/lib/libkvm.a
1.9       tholo     314:                        LIBOLDCURSES    /usr/lib/libocurses.a
1.1       deraadt   315:                        LIBM            /usr/lib/libm.a
                    316:                        LIBMP           /usr/lib/libmp.a
                    317:                        LIBPC           /usr/lib/libpc.a
                    318:                        LIBPLOT         /usr/lib/libplot.a
                    319:                        LIBRPC          /usr/lib/sunrpc.a
1.9       tholo     320:                        LIBTERMCAP      /usr/lib/libtermcap.a
                    321:                        LIBTERMLIB      /usr/lib/libtermlib.a
1.1       deraadt   322:                        LIBUTIL         /usr/lib/libutil.a
1.13      deraadt   323:                        LIBZ            /usr/lib/libz.a
1.1       deraadt   324:
                    325: SHAREDSTRINGS  If defined, a new .c.o rule is used that results in shared
                    326:                strings, using xstr(1). Note that this will not work with
                    327:                parallel makes.
                    328:
                    329: STRIP          The flag passed to the install program to cause the binary
                    330:                to be stripped.
                    331:
                    332: SUBDIR         A list of subdirectories that should be built as well.
                    333:                Each of the targets will execute the same target in the
                    334:                subdirectories.
                    335:
                    336: The include file <bsd.prog.mk> includes the file named "../Makefile.inc"
                    337: if it exists, as well as the include file <bsd.man.mk>.
                    338:
                    339: Some simple examples:
                    340:
                    341: To build foo from foo.c with a manual page foo.1, use:
                    342:
                    343:        PROG=   foo
                    344:
                    345:        .include <bsd.prog.mk>
                    346:
                    347: To build foo from foo.c with a manual page foo.2, add the line:
                    348:
                    349:        MAN=    foo.2
                    350:
                    351: If foo does not have a manual page at all, add the line:
                    352:
                    353:        NOMAN=  noman
                    354:
                    355: If foo has multiple source files, add the line:
                    356:
                    357:        SRCS=   a.c b.c c.c d.c
                    358:
                    359: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                    360:
                    361: The include file <bsd.subdir.mk> contains the default targets for building
1.8       deraadt   362: subdirectories.  It has the same eight targets as <bsd.prog.mk>: all,
                    363: clean, cleandir, depend, includes, install, lint, and tags.  For all of
                    364: the directories listed in the variable SUBDIRS, the specified directory
                    365: will be visited and the target made.  There is also a default target which
                    366: allows the command "make subdir" where subdir is any directory listed in
                    367: the variable SUBDIRS.
1.2       deraadt   368:
                    369: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                    370:
                    371: The include file <bsd.sys.mk> is used by <bsd.prog.mk> and
1.3       deraadt   372: <bsd.lib.mk>.  It contains overrides that are used when building
1.14      millert   373: the OpenBSD source tree.  For instance, if "PARALLEL" is defined by
1.3       deraadt   374: the program/library Makefile, it includes a set of rules for lex and
                    375: yacc that allow multiple lex and yacc targets to be built in parallel.
1.1       deraadt   376:
                    377: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                    378:
                    379: The include file <bsd.lib.mk> has support for building libraries.  It has
1.8       deraadt   380: the same eight targets as <bsd.prog.mk>: all, clean, cleandir, depend,
                    381: includes, install, lint, and tags.  It has a limited number of suffixes,
                    382: consistent with the current needs of the BSD tree.
1.1       deraadt   383:
                    384: It sets/uses the following variables:
                    385:
                    386: LIB            The name of the library to build.
                    387:
                    388: LIBDIR         Target directory for libraries.
                    389:
                    390: LINTLIBDIR     Target directory for lint libraries.
                    391:
                    392: LIBGRP         Library group.
                    393:
                    394: LIBOWN         Library owner.
                    395:
                    396: LIBMODE                Library mode.
                    397:
                    398: LDADD          Additional loader objects.
                    399:
1.4       niklas    400: MAN            The manual pages to be installed (use a .1 - .9 suffix).
1.1       deraadt   401:
                    402: SRCS           List of source files to build the library.  Suffix types
                    403:                .s, .c, and .f are supported.  Note, .s files are preferred
                    404:                to .c files of the same name.  (This is not the default for
                    405:                versions of make.)
                    406:
                    407: The include file <bsd.lib.mk> includes the file named "../Makefile.inc"
                    408: if it exists, as well as the include file <bsd.man.mk>.
                    409:
                    410: It has rules for building profiled objects; profiled libraries are
                    411: built by default.
                    412:
                    413: Libraries are ranlib'd when made.
1.6       mickey    414:
                    415: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                    416:
                    417: The include file <bsd.lkm.mk> has support for building the LKM's. It has
                    418: the same seven targets as <bsd.prog.mk>: all, clean, cleandir, depend,
                    419: install, lint, and tags. In addition two targets are made available
                    420: that is specific to the LKM's: load, unload.
                    421:
                    422: It sets/uses the following variables (in addition to the <bsd.prog.mk>'s):
                    423:
                    424: LKM            LKM name to build.
                    425:
                    426: LKMGRP         Module group.
                    427:
                    428: LKMOWN         Module owner.
                    429:
                    430: LKMMODE                Module mode.
1.7       mickey    431:
                    432: POSTINSTALL    Program to pass with '-p' flag to the modload.
                    433:                If not defined,
                    434:                        POSTINSTALL=${LKM}install
                    435:                is assumed.
1.6       mickey    436:
                    437: The include file <bsd.lkm.mk> includes the file named "../Makefile.inc"
                    438: if it exists, as well as the include file <bsd.man.mk>.
                    439: