[BACK]Return to Makefile CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src

Annotation of src/Makefile, Revision 1.194

1.194   ! lukem       1: #      $NetBSD: Makefile,v 1.193 2002/12/21 16:43:33 lukem Exp $
1.95      cjs         2:
1.193     lukem       3: #
1.95      cjs         4: # This is the top-level makefile for building NetBSD. For an outline of
                      5: # how to build a snapshot or release, as well as other release engineering
                      6: # information, see http://www.netbsd.org/developers/releng/index.html
                      7: #
                      8: # Not everything you can set or do is documented in this makefile. In
                      9: # particular, you should review the files in /usr/share/mk (especially
                     10: # bsd.README) for general information on building programs and writing
                     11: # Makefiles within this structure, and see the comments in src/etc/Makefile
                     12: # for further information on installation and release set options.
                     13: #
                     14: # Variables listed below can be set on the make command line (highest
                     15: # priority), in /etc/mk.conf (middle priority), or in the environment
                     16: # (lowest priority).
                     17: #
                     18: # Variables:
1.101     sommerfe   19: #   DESTDIR is the target directory for installation of the compiled
                     20: #      software. It defaults to /. Note that programs are built against
                     21: #      libraries installed in DESTDIR.
1.95      cjs        22: #   MKMAN, if set to `no', will prevent building of manual pages.
1.178     enami      23: #   MKOBJDIRS, if not set to `no', will build object directories at
1.101     sommerfe   24: #      an appropriate point in a build.
1.95      cjs        25: #   MKSHARE, if set to `no', will prevent building and installing
                     26: #      anything in /usr/share.
1.125     mrg        27: #   UPDATE, if defined, will avoid a `make cleandir' at the start of
1.178     enami      28: #      `make build', as well as having the effects listed in
                     29: #      /usr/share/mk/bsd.README.
1.125     mrg        30: #   NOCLEANDIR, if defined, will avoid a `make cleandir' at the start
1.178     enami      31: #      of the `make build'.
1.119     toddpw     32: #   NOINCLUDES will avoid the `make includes' usually done by `make build'.
1.95      cjs        33: #
                     34: # Targets:
1.137     tv         35: #   build:
                     36: #      Builds a full release of NetBSD in DESTDIR.  If BUILD_DONE is
1.110     jlam       37: #      set, this is an empty target.
1.137     tv         38: #   release:
                     39: #      Does a `make build,' and then tars up the DESTDIR files
1.95      cjs        40: #      into RELEASEDIR, in release(7) format. (See etc/Makefile for
                     41: #      more information on this.)
1.137     tv         42: #   regression-tests:
                     43: #      Runs the regression tests in "regress" on this host.
1.123     mrg        44: #
1.137     tv         45: # Targets invoked by `make build,' in order:
1.155     tv         46: #   cleandir:        cleans the tree.
1.137     tv         47: #   obj:             creates object directories.
1.152     tv         48: #   do-tools:        builds host toolchain.
1.131     tv         49: #   do-distrib-dirs: creates the distribution directories.
1.137     tv         50: #   includes:        installs include files.
1.168     tv         51: #   do-lib-csu:      builds and installs prerequisites from lib/csu.
1.186     thorpej    52: #   do-lib-libc:     builds and installs prerequisites from lib/libc.
1.143     tv         53: #   do-lib:          builds and installs prerequisites from lib.
                     54: #   do-gnu-lib:      builds and installs prerequisites from gnu/lib.
1.189     itohy      55: #   do-ld.so:        builds and installs prerequisites from libexec/ld.*_so.
1.137     tv         56: #   do-build:        builds and installs the entire system.
1.193     lukem      57: #
1.32      cgd        58:
1.146     tv         59: .if ${.MAKEFLAGS:M${.CURDIR}/share/mk} == ""
                     60: .MAKEFLAGS: -m ${.CURDIR}/share/mk
                     61: .endif
1.163     tv         62:
1.193     lukem      63: #
1.163     tv         64: # If _SRC_TOP_OBJ_ gets set here, we will end up with a directory that may
                     65: # not be the top level objdir, because "make obj" can happen in the *middle*
                     66: # of "make build" (long after <bsd.own.mk> is calculated it).  So, pre-set
                     67: # _SRC_TOP_OBJ_ here so it will not be added to ${.MAKEOVERRIDES}.
1.193     lukem      68: #
1.163     tv         69: _SRC_TOP_OBJ_=
1.148     jmc        70:
1.146     tv         71: .include <bsd.own.mk>
1.4       cgd        72:
1.193     lukem      73: #
1.137     tv         74: # Sanity check: make sure that "make build" is not invoked simultaneously
                     75: # with a standard recursive target.
1.193     lukem      76: #
1.137     tv         77:
                     78: .if make(build) || make(release) || make(snapshot)
                     79: .for targ in ${TARGETS:Nobj:Ncleandir}
                     80: .if make(${targ}) && !target(.BEGIN)
                     81: .BEGIN:
                     82:        @echo 'BUILD ABORTED: "make build" and "make ${targ}" are mutually exclusive.'
                     83:        @false
                     84: .endif
                     85: .endfor
                     86: .endif
1.58      tv         87:
1.166     simonb     88: _SUBDIR=       tools lib include gnu bin games libexec sbin usr.bin
1.183     lukem      89: _SUBDIR+=      usr.sbin share rescue sys etc distrib regress
1.105     assar      90:
1.193     lukem      91: #
1.137     tv         92: # Weed out directories that don't exist.
1.193     lukem      93: #
1.36      explorer   94:
1.137     tv         95: .for dir in ${_SUBDIR}
1.154     tv         96: .if exists(${dir}/Makefile) && (${BUILD_${dir}:Uyes} != "no")
1.137     tv         97: SUBDIR+=       ${dir}
1.36      explorer   98: .endif
1.137     tv         99: .endfor
1.21      cgd       100:
1.13      brezak    101: .if exists(regress)
1.10      cgd       102: regression-tests:
                    103:        @echo Running regression tests...
1.152     tv        104:        @(cd ${.CURDIR}/regress && ${MAKE} regress)
1.13      brezak    105: .endif
1.20      cgd       106:
1.179     thorpej   107: .if defined(UNPRIVED)
                    108: NOPOSTINSTALL= # defined
                    109: .endif
                    110:
1.176     lukem     111: afterinstall:
1.137     tv        112: .if ${MKMAN} != "no"
1.152     tv        113:        (cd ${.CURDIR}/share/man && ${MAKE} makedb)
1.137     tv        114: .endif
1.159     perry     115: .if defined(UNPRIVED) && (${MKINFO} != "no")
1.164     jmc       116:        (cd ${.CURDIR}/gnu/usr.bin/texinfo/install-info && ${MAKE} infodir-meta)
1.176     lukem     117: .endif
1.179     thorpej   118: .if !defined(NOPOSTINSTALL)
1.180     drochner  119:        (cd ${.CURDIR} && ${MAKE} postinstall-check)
1.159     perry     120: .endif
1.170     lukem     121:
                    122: postinstall-check:
1.169     lukem     123:        @echo "   === Post installation checks ==="
1.175     lukem     124:        sh ${.CURDIR}/etc/postinstall -s ${.CURDIR} -d ${DESTDIR}/ check
1.171     lukem     125:        @echo "   ================================"
                    126:
                    127: postinstall-fix: .NOTMAIN
                    128:        @echo "   === Post installation fixes ==="
1.175     lukem     129:        sh ${.CURDIR}/etc/postinstall -s ${.CURDIR} -d ${DESTDIR}/ fix
1.169     lukem     130:        @echo "   ================================"
                    131:
1.108     erh       132:
1.193     lukem     133: #
1.137     tv        134: # Targets (in order!) called by "make build".
1.193     lukem     135: #
1.123     mrg       136:
1.156     tv        137: BUILDTARGETS+= check-tools
1.155     tv        138: .if !defined(UPDATE) && !defined(NOCLEANDIR)
                    139: BUILDTARGETS+= cleandir
                    140: .endif
1.149     tv        141: .if ${MKOBJDIRS} != "no"
1.137     tv        142: BUILDTARGETS+= obj
1.123     mrg       143: .endif
1.138     tv        144: .if ${USETOOLS} == "yes"
1.152     tv        145: BUILDTARGETS+= do-tools
1.131     tv        146: .endif
1.137     tv        147: .if !defined(NODISTRIBDIRS)
                    148: BUILDTARGETS+= do-distrib-dirs
1.131     tv        149: .endif
1.137     tv        150: .if !defined(NOINCLUDES)
                    151: BUILDTARGETS+= includes
1.131     tv        152: .endif
1.189     itohy     153: BUILDTARGETS+= do-lib-csu do-lib-libc do-lib do-gnu-lib do-ld.so do-build
1.131     tv        154:
1.193     lukem     155: #
1.137     tv        156: # Enforce proper ordering of some rules.
1.193     lukem     157: #
1.123     mrg       158:
1.137     tv        159: .ORDER:                ${BUILDTARGETS}
                    160: includes-lib:  includes-include includes-sys
                    161: includes-gnu:  includes-lib
1.123     mrg       162:
1.193     lukem     163: #
1.137     tv        164: # Build the system and install into DESTDIR.
1.193     lukem     165: #
1.123     mrg       166:
1.191     lukem     167: START_TIME!=   date
                    168:
1.137     tv        169: build:
                    170: .if defined(BUILD_DONE)
                    171:        @echo "Build already installed into ${DESTDIR}"
                    172: .else
1.191     lukem     173:        @echo "Build started at: ${START_TIME}"
1.145     tv        174: .for tgt in ${BUILDTARGETS}
1.173     sommerfe  175:        @(cd ${.CURDIR} && ${MAKE} ${tgt})
1.145     tv        176: .endfor
1.191     lukem     177:        @echo   "Build started at:  ${START_TIME}"
1.172     bjh21     178:        @printf "Build finished at: " && date
1.71      mycroft   179: .endif
1.160     thorpej   180:
1.193     lukem     181: #
1.160     thorpej   182: # Build a full distribution, but not a release (i.e. no sets into
1.193     lukem     183: # ${RELEASEDIR}).  "buildworld" enforces a build to ${DESTDIR} != /
                    184: #
1.160     thorpej   185:
1.193     lukem     186: distribution buildworld:
1.194   ! lukem     187: .if make(buildworld) && \
        !           188:     (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/")
1.193     lukem     189:        @echo "Won't make ${.TARGET} with DESTDIR=/"
                    190:        @false
                    191: .endif
1.182     uwe       192:        (cd ${.CURDIR} && ${MAKE} NOPOSTINSTALL=1 build)
1.160     thorpej   193:        (cd ${.CURDIR}/etc && ${MAKE} INSTALL_DONE=1 distribution)
1.181     thorpej   194: .if defined(DESTDIR) && ${DESTDIR} != "" && ${DESTDIR} != "/"
                    195:        (cd ${.CURDIR}/distrib/sets && ${MAKE} checkflist)
                    196: .endif
1.192     lukem     197:        @echo   "make ${.TARGET} started at:  ${START_TIME}"
1.185     lukem     198:        @printf "make ${.TARGET} finished at: " && date
1.123     mrg       199:
1.193     lukem     200: #
                    201: # Install the distribution from $DESTDIR to $INSTALLWORLDDIR (defaults to `/')
                    202: # If installing to /, ensures that the host's operating system is NetBSD and
                    203: # the host's `uname -m` == ${MACHINE}.
                    204: #
                    205:
                    206: HOST_UNAME_S!= uname -s
                    207: HOST_UNAME_M!= uname -m
                    208:
                    209: installworld:
1.194   ! lukem     210: .if (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/")
1.193     lukem     211:        @echo "Can't make ${.TARGET} to DESTDIR=/"
                    212:        @false
                    213: .endif
                    214: .if !defined(INSTALLWORLDDIR) || \
                    215:     ${INSTALLWORLDDIR} == "" || ${INSTALLWORLDDIR} == "/"
                    216: .if (${HOST_UNAME_S} != "NetBSD")
                    217:        @echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_S} to NetBSD with INSTALLWORLDDIR=/"
                    218:        @false
                    219: .endif
                    220: .if (${HOST_UNAME_M} != ${MACHINE})
                    221:        @echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_M} to ${MACHINE} with INSTALLWORLDDIR=/"
                    222:        @false
                    223: .endif
                    224: .endif
                    225:        (cd ${.CURDIR}/distrib/sets && \
                    226:            ${MAKE} INSTALLDIR=${INSTALLWORLDDIR:U/} INSTALLSETS= installsets)
                    227:        (cd ${.CURDIR} && \
                    228:            ${MAKE} DESTDIR=${INSTALLWORLDDIR} postinstall-check)
                    229:        @echo   "make ${.TARGET} started at:  ${START_TIME}"
                    230:        @printf "make ${.TARGET} finished at: " && date
                    231:
                    232: #
1.181     thorpej   233: # Build a release or snapshot (implies "make build").  Note that
                    234: # in this case, the set lists will be checked before the tar files
                    235: # are made.
1.193     lukem     236: #
1.123     mrg       237:
1.179     thorpej   238: release snapshot:
                    239:        (cd ${.CURDIR} && ${MAKE} NOPOSTINSTALL=1 build)
1.152     tv        240:        (cd ${.CURDIR}/etc && ${MAKE} INSTALL_DONE=1 release)
1.192     lukem     241:        @echo   "make ${.TARGET} started at:  ${START_TIME}"
1.185     lukem     242:        @printf "make ${.TARGET} finished at: " && date
1.123     mrg       243:
1.193     lukem     244: #
1.137     tv        245: # Special components of the "make build" process.
1.193     lukem     246: #
1.156     tv        247:
                    248: check-tools:
1.187     thorpej   249: .if ${TOOLCHAIN_MISSING} == "yes" && !defined(EXTERNAL_TOOLCHAIN)
                    250:        @echo '*** WARNING:  Building on MACHINE=${MACHINE} with missing toolchain.'
                    251:        @echo '*** May result in a failed build or corrupt binaries!'
                    252: .elif defined(EXTERNAL_TOOLCHAIN)
                    253:        @echo '*** Using external toolchain rooted at ${EXTERNAL_TOOLCHAIN}.'
1.156     tv        254: .endif
1.173     sommerfe  255: .if defined(NBUILDJOBS)
                    256:        @echo '*** WARNING: NBUILDJOBS is obsolete; use -j directly instead!'
                    257: .endif
1.123     mrg       258:
1.137     tv        259: do-distrib-dirs:
1.147     jmc       260: .if !defined(DESTDIR) || ${DESTDIR} == ""
1.152     tv        261:        (cd ${.CURDIR}/etc && ${MAKE} DESTDIR=/ distrib-dirs)
1.147     jmc       262: .else
1.152     tv        263:        (cd ${.CURDIR}/etc && ${MAKE} DESTDIR=${DESTDIR} distrib-dirs)
1.147     jmc       264: .endif
1.190     lukem     265:
                    266: .for targ in cleandir obj includes
                    267: do-${targ}: ${targ}
                    268:        @true
                    269: .endfor
1.123     mrg       270:
1.186     thorpej   271: .for dir in tools lib/csu lib/libc lib gnu/lib
1.143     tv        272: do-${dir:S/\//-/}:
1.137     tv        273: .for targ in dependall install
1.173     sommerfe  274:        (cd ${.CURDIR}/${dir} && ${MAKE} ${targ})
1.137     tv        275: .endfor
1.184     lukem     276: .endfor
                    277:
1.189     itohy     278: do-ld.so:
1.184     lukem     279: .for targ in dependall install
1.189     itohy     280: .if (${OBJECT_FMT} == "a.out")
                    281:        (cd ${.CURDIR}/libexec/ld.aout_so && ${MAKE} ${targ})
                    282: .endif
                    283: .if (${OBJECT_FMT} == "ELF")
1.184     lukem     284:        (cd ${.CURDIR}/libexec/ld.elf_so && ${MAKE} ${targ})
1.189     itohy     285: .endif
1.137     tv        286: .endfor
1.143     tv        287:
                    288: do-build:
1.154     tv        289: .for targ in dependall install
1.173     sommerfe  290:        (cd ${.CURDIR} && ${MAKE} ${targ} BUILD_tools=no BUILD_lib=no)
1.154     tv        291: .endfor
1.87      cjs       292:
1.193     lukem     293: #
1.137     tv        294: # Speedup stubs for some subtrees that don't need to run these rules.
                    295: # (Tells <bsd.subdir.mk> not to recurse for them.)
1.193     lukem     296: #
1.129     tv        297:
1.152     tv        298: .for dir in bin etc distrib games libexec regress sbin usr.sbin tools
                    299: includes-${dir}:
                    300:        @true
                    301: .endfor
                    302: .for dir in etc distrib regress
                    303: install-${dir}:
                    304:        @true
                    305: .endfor
                    306:
1.193     lukem     307: #
1.152     tv        308: # XXX this needs to change when distrib Makefiles are recursion compliant
1.193     lukem     309: # XXX many distrib subdirs need "cd etc && make snap_pre snap_kern" first...
                    310: #
1.152     tv        311: dependall-distrib depend-distrib all-distrib:
1.136     nathanw   312:        @true
1.130     tv        313:
1.151     tv        314: .include <bsd.obj.mk>
1.146     tv        315: .include <bsd.subdir.mk>
1.144     tv        316:
1.150     tv        317: build-docs: ${.CURDIR}/BUILDING
1.188     lukem     318: ${.CURDIR}/BUILDING: doc/BUILDING.mdoc
1.150     tv        319:        groff -mdoc -Tascii -P-b -P-u -P-o $> >$@

CVSweb <webmaster@jp.NetBSD.org>