Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/Makefile,v rcsdiff: /ftp/cvs/cvsroot/src/Makefile,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.123 retrieving revision 1.138 diff -u -p -r1.123 -r1.138 --- src/Makefile 2001/06/10 13:02:54 1.123 +++ src/Makefile 2001/10/19 03:19:01 1.138 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.123 2001/06/10 13:02:54 mrg Exp $ +# $NetBSD: Makefile,v 1.138 2001/10/19 03:19:01 tv Exp $ # This is the top-level makefile for building NetBSD. For an outline of # how to build a snapshot or release, as well as other release engineering @@ -24,193 +24,145 @@ # MKSHARE, if set to `no', will prevent building and installing # anything in /usr/share. # NBUILDJOBS is the number of jobs to start in parallel during a -# 'make build'. It defaults to 1. -# UPDATE will avoid a `make cleandir' at the start of `make build', -# as well as having the effects listed in /usr/share/mk/bsd.README. -# NOCLEANDIR will avoid a `make cleandir' at the start of `make build', -# but without having the effects listed in /usr/share/mk/bsd.README. +# `make build'. It defaults to 1. +# UPDATE, if defined, will avoid a `make cleandir' at the start of +# `make build', as well as having the effects listed in +# /usr/share/mk/bsd.README. +# NOCLEANDIR, if defined, will avoid a `make cleandir' at the start +# of the `make build'. # NOINCLUDES will avoid the `make includes' usually done by `make build'. # # Targets: -# build: builds a full release of netbsd in DESTDIR. If BUILD_DONE is +# build: +# Builds a full release of NetBSD in DESTDIR. If BUILD_DONE is # set, this is an empty target. -# release: does a `make build,' and then tars up the DESTDIR files +# release: +# Does a `make build,' and then tars up the DESTDIR files # into RELEASEDIR, in release(7) format. (See etc/Makefile for # more information on this.) -# snapshot: a synonym for release. +# regression-tests: +# Runs the regression tests in "regress" on this host. # -# Sub targets of `make build,' in order: -# buildstartmsg: displays the start time of the build. -# beforeinstall: creates the distribution directories. -# do-force-domestic: check's that FORCE_DOMESTIC isn't set (deprecated.) -# do-share-mk: installs /usr/share/mk files. -# do-cleandir: clean's the tree. -# do-make-obj: create's object directories if required. -# do-check-egcs: check's that we have a modern enough compiler (deprecated.) -# do-make-includes: install include files. -# do-lib-csu: build & install startup object files. -# do-lib: build & install system libraries. -# do-gnu-lib: build & install gnu system libraries. -# do-dependall: builds & install the entire system. -# do-domestic: build & install the domestic tree (deprecated.) -# do-whatisdb: build & install the `whatis.db' man database. -# buildendmsg: displays the end time of the build. - -.include - -MKOBJDIRS ?= no -HAVE_EGCS!= ${CXX} --version | egrep "^(2\.[89]|egcs)" ; echo - -.if defined(NBUILDJOBS) -_J= -j${NBUILDJOBS} +# Targets invoked by `make build,' in order: +# obj: creates object directories. +# cleandir: cleans the tree. +# do-make-tools: builds host toolchain. +# do-distrib-dirs: creates the distribution directories. +# includes: installs include files. +# do-build: builds and installs the entire system. + +.include "${.CURDIR}/share/mk/bsd.own.mk" + +# Sanity check: make sure that "make build" is not invoked simultaneously +# with a standard recursive target. + +.if make(build) || make(release) || make(snapshot) +.for targ in ${TARGETS:Nobj:Ncleandir} +.if make(${targ}) && !target(.BEGIN) +.BEGIN: + @echo 'BUILD ABORTED: "make build" and "make ${targ}" are mutually exclusive.' + @false .endif - -.if defined(DESTDIR) -_M=-m ${DESTDIR}/usr/share/mk +.endfor .endif -# NOTE THAT etc *DOES NOT* BELONG IN THE LIST BELOW - -SUBDIR+= lib include bin libexec sbin usr.bin usr.sbin share sys -.if make(cleandir) || make(obj) -SUBDIR+= distrib -.ifdef MAKEOBJDIRPREFIX -SUBDIR+= etc -.endif +.if defined(NBUILDJOBS) +_J= -j${NBUILDJOBS} .endif -includes-lib: includes-include includes-sys - -.if exists(games) -SUBDIR+= games +.if ${USETOOLS} == "yes" +_SUBDIR+= tools .endif +_SUBDIR+= lib include gnu bin games libexec sbin usr.bin \ + usr.sbin share sys etc distrib regress -SUBDIR+= gnu -# This is needed for libstdc++ and gen-params. -includes-gnu: includes-include includes-sys +# Weed out directories that don't exist. -.if exists(regress) -.ifmake !(install) -SUBDIR+= regress +.for dir in ${_SUBDIR} +.if exists(${dir}/Makefile) +SUBDIR+= ${dir} .endif +.endfor +.if exists(regress) regression-tests: @echo Running regression tests... - @(cd ${.CURDIR}/regress && ${MAKE} ${_M} regress) + @cd ${.CURDIR}/regress && ${MAKE} ${_M} regress .endif -buildstartmsg: - @echo -n "Build started at: " - @date - -buildendmsg: - @echo -n "Build finished at: " - @date - -# If sharesrc is around, use its share/mk files to bootstrap until the -# mk files are installed (first step of make build). If installing to -# DESTDIR, don't bother, since the build will fail later on anyway. - -beforeinstall: -.ifndef NODISTRIBDIRS -.ifndef DESTDIR -.if exists(share/mk) - (cd ${.CURDIR}/etc && ${MAKE} -m ${.CURDIR}/share/mk DESTDIR=/ distrib-dirs) -.else - (cd ${.CURDIR}/etc && ${MAKE} DESTDIR=/ distrib-dirs) +.if ${MKMAN} != "no" +afterinstall: whatis.db +whatis.db: + cd ${.CURDIR}/share/man && ${MAKE} ${_M} makedb .endif -.else - (cd ${.CURDIR}/etc && ${MAKE} distrib-dirs) + +# Targets (in order!) called by "make build". + +.if ${MKOBJDIRS:Uno} != "no" +BUILDTARGETS+= obj .endif +.if !defined(UPDATE) && !defined(NOCLEANDIR) +BUILDTARGETS+= cleandir .endif - -afterinstall: -.if ${MKMAN} != "no" && !defined(_BUILD) - ${MAKE} ${_M} whatis.db +.if ${USETOOLS} == "yes" +BUILDTARGETS+= do-make-tools .endif - -whatis.db: - (cd ${.CURDIR}/share/man && ${MAKE} ${_M} makedb) - -# wrt info/dir below: It's safe to move this over top of /usr/share/info/dir, -# as the build will automatically remove/replace the non-pkg entries there. - -.if defined(BUILD_DONE) -build: - @echo "Build installed into ${DESTDIR}" -.else -build: buildstartmsg beforeinstall do-force-domestic do-share-mk do-cleandir do-make-obj do-check-egcs do-make-includes do-lib-csu do-lib do-gnu-lib do-dependall do-domestic do-whatisdb buildendmsg +.if !defined(NODISTRIBDIRS) +BUILDTARGETS+= do-distrib-dirs .endif - -do-force-domestic: -.if defined(FORCE_DOMESTIC) - @echo '*** CAPUTE!' - @echo ' The FORCE_DOMESTIC flag is not compatible with "make build".' - @echo ' Please correct the problem and try again.' - @false +.if !defined(NOINCLUDES) +BUILDTARGETS+= includes .endif +BUILDTARGETS+= do-build -do-share-mk: -.if ${MKSHARE} != "no" - (cd ${.CURDIR}/share/mk && ${MAKE} install) -.endif +# Enforce proper ordering of some rules. -do-cleandir: -.if !defined(UPDATE) && !defined(NOCLEANDIR) - ${MAKE} ${_J} ${_M} cleandir -.endif +.ORDER: ${BUILDTARGETS} +includes-lib: includes-include includes-sys +includes-gnu: includes-lib -do-make-obj: -.if ${MKOBJDIRS} != "no" - ${MAKE} ${_J} ${_M} obj -.endif +# Build the system and install into DESTDIR. -do-check-egcs: -.if empty(HAVE_EGCS) -.if defined(DESTDIR) - @echo "*** CAPUTE!" - @echo " You attempted to compile the world without egcs. You must" - @echo " first install a native egcs compiler." - @false +build: +.if defined(BUILD_DONE) + @echo "Build already installed into ${DESTDIR}" .else - (cd ${.CURDIR}/gnu/usr.bin/egcs && \ - ${MAKE} ${_M} ${_J} dependall MKMAN=no && \ - ${MAKE} ${_M} MKMAN=no install && ${MAKE} ${_M} cleandir) -.endif + @echo -n "Build started at: " && date + @${MAKE} ${_J} ${_M} ${BUILDTARGETS} + @echo -n "Build finished at: " && date .endif -do-make-includes: -.if !defined(NOINCLUDES) - ${MAKE} ${_M} includes -.endif +# Build a release or snapshot (implies "make build"). -do-lib-csu: - (cd ${.CURDIR}/lib/csu && \ - ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \ - ${MAKE} ${_M} MKSHARE=no install) +release snapshot: build + cd ${.CURDIR}/etc && ${MAKE} ${_M} INSTALL_DONE=1 release -do-lib: - (cd ${.CURDIR}/lib && \ - ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \ - ${MAKE} ${_M} MKSHARE=no install) +# Special components of the "make build" process. -do-gnu-lib: - (cd ${.CURDIR}/gnu/lib && \ - ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \ - ${MAKE} ${_M} MKSHARE=no install) +do-make-tools: + cd ${.CURDIR}/tools && ${MAKE} ${_M} build -do-dependall: - ${MAKE} ${_M} ${_J} dependall && ${MAKE} ${_M} _BUILD= install +do-distrib-dirs: + cd ${.CURDIR}/etc && ${MAKE} ${_M} DESTDIR=${DESTDIR} distrib-dirs -do-domestic: -.if defined(DOMESTIC) && !defined(EXPORTABLE_SYSTEM) - (cd ${.CURDIR}/${DOMESTIC} && ${MAKE} ${_M} ${_J} _SLAVE_BUILD= build) -.endif +do-build: +.for dir in lib/csu lib gnu/lib +.for targ in dependall install + cd ${.CURDIR}/${dir} && \ + ${MAKE} ${_M} ${_J} MKSHARE=no MKLINT=no ${targ} +.endfor +.endfor + ${MAKE} ${_M} ${_J} dependall + ${MAKE} ${_M} ${_J} install -do-whatisdb: - ${MAKE} ${_M} whatis.db +# Speedup stubs for some subtrees that don't need to run these rules. +# (Tells not to recurse for them.) -release snapshot: build - (cd ${.CURDIR}/etc && ${MAKE} ${_M} INSTALL_DONE=1 release) +includes-bin includes-games includes-libexec includes-regress \ +includes-sbin includes-usr.sbin includes-tools \ +all-tools install-tools install-regress: + @true + +.include "${.CURDIR}/share/mk/bsd.subdir.mk" -.include +_M:= -m ${.CURDIR}/share/mk