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

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

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