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

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

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