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

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

1.22    ! niklas      1: #      $OpenBSD: bsd.README,v 1.21 1999/11/26 21:47:09 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".
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:
1.18      millert   147: MANOWN         Manual owner. [root]
1.4       niklas    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:
1.18      millert   166: DOCOWN         Documentation owner. [root]
1.4       niklas    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.18      millert   175: NLSOWN         National Language Support files owner. [root]
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:
1.22    ! niklas    219: DEBUG          Add -g to assembly, C compiler and linking passes.  Also
        !           220:                doesn't set STRIP to -s per default if defined.
        !           221:
        !           222: DEBUGLIBS      Create libraries with -g debug information, and install
        !           223:                them in /usr/lib/debug.
1.19      millert   224:
                    225: SUDO           Command to run when doing "make install" portion of
                    226:                "make build".  If set to sudo, this allows one to run
                    227:                "make build" as a user other than root (assuming sudo
                    228:                is setup for that user).
                    229:
                    230: PIPE           If set to "-pipe" gcc will be given the -pipe option
                    231:                which can speed up compiles on machines with memory
                    232:                to spare.  Instead of using temp files, gcc uses pipes
                    233:                for the temporary data.
1.20      kstailey  234:
                    235: GLOBAL_AUTOCONF_CACHE
                    236:                Set to the name of a file that all cached GNU autoconf
                    237:                test results will be saved in.  Reduces redundant tests.
1.1       deraadt   238:
1.8       deraadt   239: bsd.own.mk is generally useful when building your own Makefiles so that
1.1       deraadt   240: they use the same default owners etc. as the rest of the tree.
                    241:
                    242: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                    243:
                    244: The include file <bsd.prog.mk> handles building programs from one or
                    245: more source files, along with their manual pages.  It has a limited number
                    246: of suffixes, consistent with the current needs of the BSD tree.
                    247:
1.8       deraadt   248: It has eight targets:
1.1       deraadt   249:
                    250:        all:
                    251:                build the program and its manual page
                    252:        clean:
                    253:                remove the program, any object files and the files a.out,
                    254:                Errs, errs, mklog, and core.
                    255:        cleandir:
                    256:                remove all of the files removed by the target clean, as
                    257:                well as .depend, tags, and any manual pages.
                    258:        depend:
                    259:                make the dependencies for the source files, and store
                    260:                them in the file .depend.
1.8       deraadt   261:        includes:
                    262:                install any header files.
1.1       deraadt   263:        install:
                    264:                install the program and its manual pages; if the Makefile
                    265:                does not itself define the target install, the targets
                    266:                beforeinstall and afterinstall may also be used to cause
                    267:                actions immediately before and after the install target
                    268:                is executed.
                    269:        lint:
                    270:                run lint on the source files
                    271:        tags:
                    272:                create a tags file for the source files.
                    273:
                    274: It sets/uses the following variables:
                    275:
                    276: BINGRP         Binary group.
                    277:
                    278: BINOWN         Binary owner.
                    279:
                    280: BINMODE                Binary mode.
                    281:
                    282: CLEANFILES     Additional files to remove for the clean and cleandir targets.
                    283:
                    284: COPTS          Additional flags to the compiler when creating C objects.
                    285:
                    286: HIDEGAME       If HIDEGAME is defined, the binary is installed in
                    287:                /usr/games/hide, and a symbolic link is created to
                    288:                /usr/games/dm.
                    289:
                    290: LDADD          Additional loader objects.  Usually used for libraries.
                    291:                For example, to load with the compatibility and utility
                    292:                libraries, use:
                    293:
                    294:                        LDADD+=-lutil -lcompat
                    295:
                    296: LDFLAGS                Additional loader flags.
                    297:
                    298: LINKS          The list of binary links; should be full pathnames, the
                    299:                linked-to file coming first, followed by the linked
                    300:                file.  The files are hard-linked.  For example, to link
                    301:                /bin/test and /bin/[, use:
                    302:
                    303:                        LINKS=  ${DESTDIR}/bin/test ${DESTDIR}/bin/[
                    304:
1.4       niklas    305: MAN            Manual pages (should end in .1 - .9).  If no MAN variable is
1.1       deraadt   306:                defined, "MAN=${PROG}.1" is assumed.
                    307:
                    308: PROG           The name of the program to build.  If not supplied, nothing
                    309:                is built.
                    310:
1.6       mickey    311: SRCS           List of source files to build the program.  If it's not
1.1       deraadt   312:                defined, it's assumed to be ${PROG}.c.
                    313:
                    314: DPADD          Additional dependencies for the program.  Usually used for
                    315:                libraries.  For example, to depend on the compatibility and
                    316:                utility libraries use:
                    317:
                    318:                        DPADD+=${LIBCOMPAT} ${LIBUTIL}
                    319:
                    320:                The following libraries are predefined for DPADD:
                    321:
                    322:                        LIBC            /lib/libc.a
                    323:                        LIBCOMPAT       /usr/lib/libcompat.a
                    324:                        LIBCURSES       /usr/lib/libcurses.a
                    325:                        LIBDBM          /usr/lib/libdbm.a
                    326:                        LIBDES          /usr/lib/libdes.a
                    327:                        LIBL            /usr/lib/libl.a
                    328:                        LIBKDB          /usr/lib/libkdb.a
                    329:                        LIBKRB          /usr/lib/libkrb.a
                    330:                        LIBKVM          /usr/lib/libkvm.a
1.9       tholo     331:                        LIBOLDCURSES    /usr/lib/libocurses.a
1.1       deraadt   332:                        LIBM            /usr/lib/libm.a
                    333:                        LIBMP           /usr/lib/libmp.a
1.21      millert   334:                        LIBPERL         /usr/lib/libperl.a
1.1       deraadt   335:                        LIBPC           /usr/lib/libpc.a
                    336:                        LIBPLOT         /usr/lib/libplot.a
                    337:                        LIBRPC          /usr/lib/sunrpc.a
1.9       tholo     338:                        LIBTERMCAP      /usr/lib/libtermcap.a
                    339:                        LIBTERMLIB      /usr/lib/libtermlib.a
1.1       deraadt   340:                        LIBUTIL         /usr/lib/libutil.a
1.13      deraadt   341:                        LIBZ            /usr/lib/libz.a
1.1       deraadt   342:
                    343: SHAREDSTRINGS  If defined, a new .c.o rule is used that results in shared
                    344:                strings, using xstr(1). Note that this will not work with
                    345:                parallel makes.
                    346:
                    347: STRIP          The flag passed to the install program to cause the binary
                    348:                to be stripped.
                    349:
                    350: SUBDIR         A list of subdirectories that should be built as well.
                    351:                Each of the targets will execute the same target in the
                    352:                subdirectories.
                    353:
                    354: The include file <bsd.prog.mk> includes the file named "../Makefile.inc"
                    355: if it exists, as well as the include file <bsd.man.mk>.
                    356:
                    357: Some simple examples:
                    358:
                    359: To build foo from foo.c with a manual page foo.1, use:
                    360:
                    361:        PROG=   foo
                    362:
                    363:        .include <bsd.prog.mk>
                    364:
                    365: To build foo from foo.c with a manual page foo.2, add the line:
                    366:
                    367:        MAN=    foo.2
                    368:
                    369: If foo does not have a manual page at all, add the line:
                    370:
                    371:        NOMAN=  noman
                    372:
                    373: If foo has multiple source files, add the line:
                    374:
                    375:        SRCS=   a.c b.c c.c d.c
                    376:
                    377: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                    378:
                    379: The include file <bsd.subdir.mk> contains the default targets for building
1.8       deraadt   380: subdirectories.  It has the same eight targets as <bsd.prog.mk>: all,
                    381: clean, cleandir, depend, includes, install, lint, and tags.  For all of
                    382: the directories listed in the variable SUBDIRS, the specified directory
                    383: will be visited and the target made.  There is also a default target which
                    384: allows the command "make subdir" where subdir is any directory listed in
                    385: the variable SUBDIRS.
1.2       deraadt   386:
                    387: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                    388:
                    389: The include file <bsd.sys.mk> is used by <bsd.prog.mk> and
1.3       deraadt   390: <bsd.lib.mk>.  It contains overrides that are used when building
1.14      millert   391: the OpenBSD source tree.  For instance, if "PARALLEL" is defined by
1.3       deraadt   392: the program/library Makefile, it includes a set of rules for lex and
                    393: yacc that allow multiple lex and yacc targets to be built in parallel.
1.1       deraadt   394:
                    395: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                    396:
                    397: The include file <bsd.lib.mk> has support for building libraries.  It has
1.8       deraadt   398: the same eight targets as <bsd.prog.mk>: all, clean, cleandir, depend,
                    399: includes, install, lint, and tags.  It has a limited number of suffixes,
                    400: consistent with the current needs of the BSD tree.
1.1       deraadt   401:
                    402: It sets/uses the following variables:
                    403:
                    404: LIB            The name of the library to build.
                    405:
                    406: LIBDIR         Target directory for libraries.
                    407:
                    408: LINTLIBDIR     Target directory for lint libraries.
                    409:
                    410: LIBGRP         Library group.
                    411:
                    412: LIBOWN         Library owner.
                    413:
                    414: LIBMODE                Library mode.
                    415:
                    416: LDADD          Additional loader objects.
                    417:
1.4       niklas    418: MAN            The manual pages to be installed (use a .1 - .9 suffix).
1.1       deraadt   419:
                    420: SRCS           List of source files to build the library.  Suffix types
                    421:                .s, .c, and .f are supported.  Note, .s files are preferred
                    422:                to .c files of the same name.  (This is not the default for
                    423:                versions of make.)
                    424:
                    425: The include file <bsd.lib.mk> includes the file named "../Makefile.inc"
                    426: if it exists, as well as the include file <bsd.man.mk>.
                    427:
                    428: It has rules for building profiled objects; profiled libraries are
                    429: built by default.
                    430:
                    431: Libraries are ranlib'd when made.
1.6       mickey    432:
                    433: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                    434:
                    435: The include file <bsd.lkm.mk> has support for building the LKM's. It has
                    436: the same seven targets as <bsd.prog.mk>: all, clean, cleandir, depend,
                    437: install, lint, and tags. In addition two targets are made available
                    438: that is specific to the LKM's: load, unload.
                    439:
                    440: It sets/uses the following variables (in addition to the <bsd.prog.mk>'s):
                    441:
                    442: LKM            LKM name to build.
                    443:
                    444: LKMGRP         Module group.
                    445:
                    446: LKMOWN         Module owner.
                    447:
                    448: LKMMODE                Module mode.
1.7       mickey    449:
                    450: POSTINSTALL    Program to pass with '-p' flag to the modload.
                    451:                If not defined,
                    452:                        POSTINSTALL=${LKM}install
                    453:                is assumed.
1.6       mickey    454:
                    455: The include file <bsd.lkm.mk> includes the file named "../Makefile.inc"
                    456: if it exists, as well as the include file <bsd.man.mk>.
                    457: