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

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

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