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

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

1.36    ! jolan       1: #      $OpenBSD: bsd.README,v 1.35 2003/08/11 17:31:51 jakob 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
1.30      provos     20: bsd.regress.mk         - regression tests
                     21: bsd.subdir.mk          - targets for building subdirectories
1.17      espie      22: bsd.sys.mk             - building bsd from the source tree
1.1       deraadt    23:
                     24: Note, this file is not intended to replace reading through the .mk
                     25: files for anything tricky.
                     26:
                     27: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                     28:
                     29: RANDOM THINGS WORTH KNOWING:
                     30:
                     31: The files are simply C-style #include files, and pretty much behave like
                     32: you'd expect.  The syntax is slightly different in that a single '.' is
                     33: used instead of the hash mark, i.e. ".include <bsd.prog.mk>".
                     34:
                     35: One difference that will save you lots of debugging time is that inclusion
                     36: of the file is normally done at the *end* of the Makefile.  The reason for
                     37: this is because .mk files often modify variables and behavior based on the
                     38: values of variables set in the Makefile.  To make this work, remember that
                     39: the FIRST target found is the target that is used, i.e. if the Makefile has:
                     40:
                     41:        a:
                     42:                echo a
                     43:        a:
                     44:                echo a number two
                     45:
                     46: the command "make a" will echo "a".  To make things confusing, the SECOND
                     47: variable assignment is the overriding one, i.e. if the Makefile has:
                     48:
                     49:        a=      foo
                     50:        a=      bar
                     51:
                     52:        b:
                     53:                echo ${a}
                     54:
                     55: the command "make b" will echo "bar".  This is for compatibility with the
                     56: way the V7 make behaved.
                     57:
1.23      espie      58: To make things even more confusing, make uses lazy evaluation. All
                     59: variables are expanded only when needed. Which means that, in
                     60:
                     61:        a=      foo
                     62:
                     63:        b: $(a)
                     64:                echo $(.ALLSRC)
                     65:                echo $(a)
                     66:
                     67:        foo:
                     68:                touch foo
                     69:
                     70:        a=      bar
                     71:
                     72: the command "make b" will echo "foo"; echo "bar".  The first $(a) means
                     73: "foo", because it's needed to generate the dependency rule when it's read,
                     74: but the second $(a) is only expanded when needed, at which point a contains
                     75: bar.
                     76:
1.1       deraadt    77: It's fairly difficult to make the BSD .mk files work when you're building
1.16      espie      78: multiple programs in a single directory.  It's a lot easier to split up the
1.1       deraadt    79: programs than to deal with the problem.  Most of the agony comes from making
1.16      espie      80: the "obj" directory stuff work right, not because we switched to a new version
1.1       deraadt    81: of make.  So, don't get mad at us, figure out a better way to handle multiple
                     82: architectures so we can quit using the symbolic link stuff.  (Imake doesn't
                     83: count.)
                     84:
                     85: The file .depend in the source directory is expected to contain dependencies
                     86: for the source files.  This file is read automatically by make after reading
                     87: the Makefile.
                     88:
                     89: The variable DESTDIR works as before.  It's not set anywhere but will change
                     90: the tree where the file gets installed.
                     91:
                     92: The profiled libraries are no longer built in a different directory than
                     93: the regular libraries.  A new suffix, ".po", is used to denote a profiled
                     94: object.
                     95:
                     96: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                     97:
                     98: The include file <sys.mk> has the default rules for all makes, in the BSD
                     99: environment or otherwise.  You probably don't want to touch this file.
                    100:
                    101: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                    102:
                    103: The include file <bsd.man.mk> handles installing manual pages and their
                    104: links.
                    105:
                    106: It has a single target:
                    107:
                    108:        maninstall:
                    109:                Install the manual pages and their links.
                    110:
                    111: It sets/uses the following variables:
                    112:
                    113: MANDIR         Base path for manual installation.
                    114:
                    115: MANGRP         Manual group.
                    116:
                    117: MANOWN         Manual owner.
                    118:
                    119: MANMODE                Manual mode.
                    120:
1.24      mpech     121: MANSUBDIR      Subdirectory under the manual page section, i.e. "vax"
                    122:                or "tahoe" for machine specific manual pages.
1.1       deraadt   123:
1.4       niklas    124: MAN            The manual pages to be installed (use a .1 - .9 suffix).
1.1       deraadt   125:
1.4       niklas    126: MLINKS         List of manual page links (using a .1 - .9 suffix).  The
1.1       deraadt   127:                linked-to file must come first, the linked file second,
                    128:                and there may be multiple pairs.  The files are soft-linked.
                    129:
                    130: The include file <bsd.man.mk> includes a file named "../Makefile.inc" if
                    131: it exists.
                    132:
                    133: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                    134:
1.8       deraadt   135: The include file <bsd.own.mk> contains source tree configuration parameters,
                    136: such as the owners, groups, etc. for both manual pages and binaries, and
                    137: a few global "feature configuration" parameters.
1.1       deraadt   138:
                    139: It has no targets.
                    140:
1.8       deraadt   141: To get system-specific configuration parameters, bsd.own.mk will try to
                    142: include the file specified by the "MAKECONF" variable.  If MAKECONF is not
                    143: set, or no such file exists, the system make configuration file, /etc/mk.conf
                    144: is included.  These files may define any of the variables described below.
                    145:
                    146: bsd.own.mk sets the following variables, if they are not already defined
                    147: (defaults are in brackets):
1.4       niklas    148:
                    149: BSDSRCDIR      The real path to the system sources, so that 'make obj'
                    150:                will work correctly. [/usr/src]
                    151:
                    152: BSDOBJDIR      The real path to the system 'obj' tree, so that 'make obj'
                    153:                will work correctly. [/usr/obj]
                    154:
                    155: BINGRP         Binary group. [bin]
                    156:
1.10      deraadt   157: BINOWN         Binary owner. [root]
1.4       niklas    158:
                    159: BINMODE                Binary mode. [555]
                    160:
                    161: NONBINMODE     Mode for non-executable files. [444]
                    162:
1.23      espie     163: DIRMODE                Mode for new directories. [755]
                    164:
1.4       niklas    165: MANDIR         Base path for manual installation. [/usr/share/man/cat]
                    166:
                    167: MANGRP         Manual group. [bin]
                    168:
1.18      millert   169: MANOWN         Manual owner. [root]
1.4       niklas    170:
                    171: MANMODE                Manual mode. [${NONBINMODE}]
                    172:
                    173: LIBDIR         Base path for library installation. [/usr/lib]
                    174:
                    175: LINTLIBDIR     Base path for lint(1) library installation. [/usr/libdata/lint]
                    176:
                    177: LIBGRP         Library group. [${BINGRP}]
                    178:
                    179: LIBOWN         Library owner. [${BINOWN}]
                    180:
                    181: LIBMODE                Library mode. [${NONBINMODE}]
                    182:
                    183: DOCDIR         Base path for system documentation (e.g. PSD, USD, etc.)
                    184:                installation. [/usr/share/doc]
                    185:
                    186: DOCGRP         Documentation group. [bin]
                    187:
1.18      millert   188: DOCOWN         Documentation owner. [root]
1.4       niklas    189:
                    190: DOCMODE                Documentation mode. [${NONBINMODE}]
                    191:
                    192: NLSDIR         Base path for National Language Support files installation.
                    193:                [/usr/share/nls]
1.1       deraadt   194:
1.4       niklas    195: NLSGRP         National Language Support files group. [bin]
1.1       deraadt   196:
1.18      millert   197: NLSOWN         National Language Support files owner. [root]
1.1       deraadt   198:
1.4       niklas    199: NLSMODE                National Language Support files mode. [${NONBINMODE}]
1.1       deraadt   200:
1.15      millert   201: INSTALL_STRIP  The flag passed to the install program to cause the binary
1.1       deraadt   202:                to be stripped.  This is to be used when building your
                    203:                own install script so that the entire system can be made
1.15      millert   204:                stripped/not-stripped using a single knob.  Note that
                    205:                INSTALL_STRIP is not set if ${DEBUG} is defined. [-s]
1.1       deraadt   206:
1.15      millert   207: INSTALL_COPY   The old usage of this flag is obsolescent since install(1)
                    208:                now copies by default.  However, it can also be used to
                    209:                specify that a file not be copied unless it is different
                    210:                (via the -p option).  See install(1) for details.  This
                    211:                is to be used when building our own install script so
                    212:                that the entire system can either be installed with copies,
                    213:                or copy-if-different using a single knob. [-c]
1.4       niklas    214:
1.8       deraadt   215: Additionally, the following variables may be set by bsd.own.mk or in a
                    216: make configuration file to modify the behaviour of the system build
                    217: process (default values are in brackets along with comments, if set by
                    218: bsd.own.mk):
1.4       niklas    219:
1.23      espie     220: AFS            Compile support for AFS.
                    221:
1.4       niklas    222: SKEY           Compile in support for S/key authentication. [yes, set
                    223:                unconditionally]
                    224:
                    225: KERBEROS5      Compile in support for Kerberos 5 authentication.
                    226:
                    227: MANZ           Compress manual pages at installation time.
                    228:
1.23      espie     229: MANPS          Define to have PostScript manual pages generated.
                    230:
1.4       niklas    231: SYS_INCLUDE    Copy or symlink kernel include files into /usr/include.
                    232:                Possible values are "symlinks" or "copies" (which is
                    233:                the same as the variable being unset).
1.1       deraadt   234:
1.28      brad      235: NOPROFILE      Do not build profiled versions of system libraries.
1.1       deraadt   236:
1.4       niklas    237: NOPIC          Do not build PIC versions of system libraries, and
1.28      brad      238:                do not build shared libraries.
1.1       deraadt   239:
1.4       niklas    240: NOLINT         Do not build lint libraries. [set, set unconditionally]
1.11      niklas    241:
1.22      niklas    242: DEBUG          Add -g to assembly, C compiler and linking passes.  Also
                    243:                doesn't set STRIP to -s per default if defined.
                    244:
                    245: DEBUGLIBS      Create libraries with -g debug information, and install
                    246:                them in /usr/lib/debug.
1.27      espie     247:
                    248: WARNINGS       Adds appropriate warning flags (defined in CDIAGFLAGS,
                    249:                e.g., -Wall...) to compiles. [no]
1.19      millert   250:
                    251: SUDO           Command to run when doing "make install" portion of
                    252:                "make build".  If set to sudo, this allows one to run
                    253:                "make build" as a user other than root (assuming sudo
                    254:                is setup for that user).
                    255:
                    256: PIPE           If set to "-pipe" gcc will be given the -pipe option
                    257:                which can speed up compiles on machines with memory
                    258:                to spare.  Instead of using temp files, gcc uses pipes
                    259:                for the temporary data.
1.20      kstailey  260:
                    261: GLOBAL_AUTOCONF_CACHE
                    262:                Set to the name of a file that all cached GNU autoconf
                    263:                test results will be saved in.  Reduces redundant tests.
1.23      espie     264:                Be careful!  Redundant tests may not be redundant if you
                    265:                are installing substantially updated gnu programs.
1.1       deraadt   266:
1.8       deraadt   267: bsd.own.mk is generally useful when building your own Makefiles so that
1.1       deraadt   268: they use the same default owners etc. as the rest of the tree.
                    269:
                    270: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                    271:
                    272: The include file <bsd.prog.mk> handles building programs from one or
                    273: more source files, along with their manual pages.  It has a limited number
                    274: of suffixes, consistent with the current needs of the BSD tree.
                    275:
1.8       deraadt   276: It has eight targets:
1.1       deraadt   277:
                    278:        all:
                    279:                build the program and its manual page
                    280:        clean:
                    281:                remove the program, any object files and the files a.out,
                    282:                Errs, errs, mklog, and core.
                    283:        cleandir:
                    284:                remove all of the files removed by the target clean, as
                    285:                well as .depend, tags, and any manual pages.
                    286:        depend:
                    287:                make the dependencies for the source files, and store
                    288:                them in the file .depend.
1.8       deraadt   289:        includes:
                    290:                install any header files.
1.1       deraadt   291:        install:
                    292:                install the program and its manual pages; if the Makefile
                    293:                does not itself define the target install, the targets
                    294:                beforeinstall and afterinstall may also be used to cause
                    295:                actions immediately before and after the install target
                    296:                is executed.
                    297:        lint:
                    298:                run lint on the source files
                    299:        tags:
                    300:                create a tags file for the source files.
                    301:
                    302: It sets/uses the following variables:
                    303:
                    304: BINGRP         Binary group.
                    305:
                    306: BINOWN         Binary owner.
                    307:
                    308: BINMODE                Binary mode.
                    309:
                    310: CLEANFILES     Additional files to remove for the clean and cleandir targets.
                    311:
                    312: COPTS          Additional flags to the compiler when creating C objects.
                    313:
                    314: LDADD          Additional loader objects.  Usually used for libraries.
                    315:                For example, to load with the compatibility and utility
                    316:                libraries, use:
                    317:
                    318:                        LDADD+=-lutil -lcompat
                    319:
                    320: LDFLAGS                Additional loader flags.
                    321:
                    322: LINKS          The list of binary links; should be full pathnames, the
                    323:                linked-to file coming first, followed by the linked
                    324:                file.  The files are hard-linked.  For example, to link
                    325:                /bin/test and /bin/[, use:
                    326:
                    327:                        LINKS=  ${DESTDIR}/bin/test ${DESTDIR}/bin/[
                    328:
1.4       niklas    329: MAN            Manual pages (should end in .1 - .9).  If no MAN variable is
1.1       deraadt   330:                defined, "MAN=${PROG}.1" is assumed.
                    331:
                    332: PROG           The name of the program to build.  If not supplied, nothing
                    333:                is built.
                    334:
1.6       mickey    335: SRCS           List of source files to build the program.  If it's not
1.1       deraadt   336:                defined, it's assumed to be ${PROG}.c.
                    337:
                    338: DPADD          Additional dependencies for the program.  Usually used for
                    339:                libraries.  For example, to depend on the compatibility and
                    340:                utility libraries use:
                    341:
                    342:                        DPADD+=${LIBCOMPAT} ${LIBUTIL}
                    343:
                    344:                The following libraries are predefined for DPADD:
                    345:
1.31      espie     346:                        LIB45           /usr/lib/lib45.a
                    347:                        LIBASN1         /usr/lib/libasn1.a
                    348:                        LIBC            /usr/lib/libc.a
1.1       deraadt   349:                        LIBCOMPAT       /usr/lib/libcompat.a
1.31      espie     350:                        LIBCRYPTO       /usr/lib/libcrypto.a
1.1       deraadt   351:                        LIBCURSES       /usr/lib/libcurses.a
                    352:                        LIBDES          /usr/lib/libdes.a
1.26      millert   353:                        LIBEDIT         /usr/lib/libedit.a
1.32      millert   354:                        LIBEVENT        /usr/lib/libevent.a
1.26      millert   355:                        LIBGCC          /usr/lib/libgcc.a
1.35      jakob     356:                        LIBGSSAPI       /usr/lib/libgssapi.a
1.31      espie     357:                        LIBHDB          /usr/lib/libhdb.a
                    358:                        LIBKADM         /usr/lib/libkadm.a
                    359:                        LIBKADM5CLNT    /usr/lib/libkadm5clnt.a
                    360:                        LIBKADM5SRV     /usr/lib/libkadm5srv.a
                    361:                        LIBKAFS         /usr/lib/libkafs.a
1.26      millert   362:                        LIBKDB          /usr/lib/libkdb.a
                    363:                        LIBKEYNOTE      /usr/lib/libkeynote.a
1.1       deraadt   364:                        LIBKRB          /usr/lib/libkrb.a
1.31      espie     365:                        LIBKRB5         /usr/lib/libkrb5.a
1.1       deraadt   366:                        LIBKVM          /usr/lib/libkvm.a
1.26      millert   367:                        LIBL            /usr/lib/libl.a
1.1       deraadt   368:                        LIBM            /usr/lib/libm.a
1.26      millert   369:                        LIBOLDCURSES    /usr/lib/libocurses.a
1.31      espie     370:                        LIBPCAP         /usr/lib/libpcap.a
1.21      millert   371:                        LIBPERL         /usr/lib/libperl.a
1.26      millert   372:                        LIBRPCSVC       /usr/lib/librpcsvc.a
1.31      espie     373:                        LIBSECTOK       /usr/lib/libsectok.a
1.26      millert   374:                        LIBSKEY         /usr/lib/libskey.a
                    375:                        LIBSSL          /usr/lib/libssl.a
                    376:                        LIBTELNET       /usr/lib/libtelnet.a
1.9       tholo     377:                        LIBTERMCAP      /usr/lib/libtermcap.a
                    378:                        LIBTERMLIB      /usr/lib/libtermlib.a
1.31      espie     379:                        LIBUSB          /usr/lib/libusbhid.a
1.1       deraadt   380:                        LIBUTIL         /usr/lib/libutil.a
1.26      millert   381:                        LIBWRAP         /usr/lib/libwrap.a
1.31      espie     382:                        LIBY            /usr/lib/liby.a
1.13      deraadt   383:                        LIBZ            /usr/lib/libz.a
1.31      espie     384:                        LIBARCH         arch-dependent stuff
1.1       deraadt   385:
                    386: SHAREDSTRINGS  If defined, a new .c.o rule is used that results in shared
                    387:                strings, using xstr(1). Note that this will not work with
                    388:                parallel makes.
                    389:
                    390: STRIP          The flag passed to the install program to cause the binary
                    391:                to be stripped.
                    392:
                    393: SUBDIR         A list of subdirectories that should be built as well.
                    394:                Each of the targets will execute the same target in the
                    395:                subdirectories.
                    396:
                    397: The include file <bsd.prog.mk> includes the file named "../Makefile.inc"
                    398: if it exists, as well as the include file <bsd.man.mk>.
                    399:
                    400: Some simple examples:
                    401:
                    402: To build foo from foo.c with a manual page foo.1, use:
                    403:
                    404:        PROG=   foo
                    405:
                    406:        .include <bsd.prog.mk>
                    407:
                    408: To build foo from foo.c with a manual page foo.2, add the line:
                    409:
                    410:        MAN=    foo.2
                    411:
                    412: If foo does not have a manual page at all, add the line:
                    413:
                    414:        NOMAN=  noman
                    415:
                    416: If foo has multiple source files, add the line:
                    417:
                    418:        SRCS=   a.c b.c c.c d.c
                    419:
                    420: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                    421:
                    422: The include file <bsd.subdir.mk> contains the default targets for building
1.8       deraadt   423: subdirectories.  It has the same eight targets as <bsd.prog.mk>: all,
                    424: clean, cleandir, depend, includes, install, lint, and tags.  For all of
                    425: the directories listed in the variable SUBDIRS, the specified directory
                    426: will be visited and the target made.  There is also a default target which
                    427: allows the command "make subdir" where subdir is any directory listed in
                    428: the variable SUBDIRS.
1.2       deraadt   429:
                    430: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                    431:
                    432: The include file <bsd.sys.mk> is used by <bsd.prog.mk> and
1.3       deraadt   433: <bsd.lib.mk>.  It contains overrides that are used when building
1.14      millert   434: the OpenBSD source tree.  For instance, if "PARALLEL" is defined by
1.3       deraadt   435: the program/library Makefile, it includes a set of rules for lex and
                    436: yacc that allow multiple lex and yacc targets to be built in parallel.
1.1       deraadt   437:
                    438: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                    439:
                    440: The include file <bsd.lib.mk> has support for building libraries.  It has
1.8       deraadt   441: the same eight targets as <bsd.prog.mk>: all, clean, cleandir, depend,
                    442: includes, install, lint, and tags.  It has a limited number of suffixes,
                    443: consistent with the current needs of the BSD tree.
1.1       deraadt   444:
                    445: It sets/uses the following variables:
                    446:
                    447: LIB            The name of the library to build.
                    448:
                    449: LIBDIR         Target directory for libraries.
                    450:
                    451: LINTLIBDIR     Target directory for lint libraries.
                    452:
                    453: LIBGRP         Library group.
                    454:
                    455: LIBOWN         Library owner.
                    456:
                    457: LIBMODE                Library mode.
                    458:
                    459: LDADD          Additional loader objects.
                    460:
1.4       niklas    461: MAN            The manual pages to be installed (use a .1 - .9 suffix).
1.1       deraadt   462:
                    463: SRCS           List of source files to build the library.  Suffix types
                    464:                .s, .c, and .f are supported.  Note, .s files are preferred
                    465:                to .c files of the same name.  (This is not the default for
                    466:                versions of make.)
                    467:
                    468: The include file <bsd.lib.mk> includes the file named "../Makefile.inc"
                    469: if it exists, as well as the include file <bsd.man.mk>.
                    470:
                    471: It has rules for building profiled objects; profiled libraries are
                    472: built by default.
                    473:
                    474: Libraries are ranlib'd when made.
1.6       mickey    475:
                    476: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                    477:
                    478: The include file <bsd.lkm.mk> has support for building the LKM's. It has
                    479: the same seven targets as <bsd.prog.mk>: all, clean, cleandir, depend,
                    480: install, lint, and tags. In addition two targets are made available
                    481: that is specific to the LKM's: load, unload.
                    482:
                    483: It sets/uses the following variables (in addition to the <bsd.prog.mk>'s):
                    484:
                    485: LKM            LKM name to build.
                    486:
                    487: LKMGRP         Module group.
                    488:
                    489: LKMOWN         Module owner.
                    490:
                    491: LKMMODE                Module mode.
1.7       mickey    492:
                    493: POSTINSTALL    Program to pass with '-p' flag to the modload.
                    494:                If not defined,
                    495:                        POSTINSTALL=${LKM}install
                    496:                is assumed.
1.6       mickey    497:
                    498: The include file <bsd.lkm.mk> includes the file named "../Makefile.inc"
                    499: if it exists, as well as the include file <bsd.man.mk>.