version 1.127, 2001/08/14 14:04:35 |
version 1.137, 2001/10/19 02:35:45 |
|
|
# NOCLEANDIR, if defined, will avoid a `make cleandir' at the start |
# NOCLEANDIR, if defined, will avoid a `make cleandir' at the start |
# of the `make build'. |
# of the `make build'. |
# NOINCLUDES will avoid the `make includes' usually done by `make build'. |
# NOINCLUDES will avoid the `make includes' usually done by `make build'. |
|
|
# |
# |
# Targets: |
# 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. |
# 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 |
# into RELEASEDIR, in release(7) format. (See etc/Makefile for |
# more information on this.) |
# 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: |
# Targets invoked by `make build,' in order: |
# buildstartmsg: displays the start time of the build. |
# obj: creates object directories. |
# beforeinstall: creates the distribution directories. |
# cleandir: cleans the tree. |
# do-force-domestic: check's that FORCE_DOMESTIC isn't set (deprecated.) |
# do-make-tools: builds host toolchain. |
# do-share-mk: installs /usr/share/mk files. |
# do-distrib-dirs: creates the distribution directories. |
# do-cleandir: cleans the tree. |
# includes: installs include files. |
# do-make-obj: creates object directories if required. |
# do-build: builds and installs the entire system. |
# do-make-tools: builds host toolchain. |
|
# do-make-includes: install include files. |
.include "${.CURDIR}/share/mk/bsd.own.mk" |
# do-lib-csu: build & install startup object files. |
|
# do-lib: build & install system libraries. |
# Sanity check: make sure that "make build" is not invoked simultaneously |
# do-gnu-lib: build & install gnu system libraries. |
# with a standard recursive target. |
# do-dependall: builds & install the entire system. |
|
# do-domestic: build & install the domestic tree (deprecated.) |
.if make(build) || make(release) || make(snapshot) |
# do-whatisdb: build & install the `whatis.db' man database. |
.for targ in ${TARGETS:Nobj:Ncleandir} |
# buildendmsg: displays the end time of the build. |
.if make(${targ}) && !target(.BEGIN) |
|
.BEGIN: |
.include <bsd.own.mk> |
@echo 'BUILD ABORTED: "make build" and "make ${targ}" are mutually exclusive.' |
|
@false |
.if defined(USE_NEW_TOOLCHAIN) |
.endif |
.include "${.CURDIR}/tools/Makefile.tools" |
.endfor |
.endif |
.endif |
|
|
MKOBJDIRS ?= no |
|
|
|
.if defined(NBUILDJOBS) |
.if defined(NBUILDJOBS) |
_J= -j${NBUILDJOBS} |
_J= -j${NBUILDJOBS} |
.endif |
.endif |
|
|
.if defined(DESTDIR) |
.if ${USETOOLS} != "no" |
_M=-m ${DESTDIR}/usr/share/mk |
_SUBDIR+= tools |
.endif |
.endif |
|
_SUBDIR+= lib include gnu bin games libexec sbin usr.bin \ |
|
usr.sbin share sys etc distrib regress |
|
|
# NOTE THAT etc *DOES NOT* BELONG IN THE LIST BELOW |
# Weed out directories that don't exist. |
|
|
SUBDIR+= lib include bin libexec sbin usr.bin usr.sbin share sys |
.for dir in ${_SUBDIR} |
.if make(cleandir) || make(obj) |
.if exists(${dir}/Makefile) |
SUBDIR+= distrib |
SUBDIR+= ${dir} |
.ifdef MAKEOBJDIRPREFIX |
|
SUBDIR+= etc |
|
.endif |
|
.endif |
.endif |
|
.endfor |
|
|
includes-lib: includes-include includes-sys |
.if exists(regress) |
|
regression-tests: |
|
@echo Running regression tests... |
|
@cd ${.CURDIR}/regress && ${MAKE} ${_M} regress |
|
.endif |
|
|
.if exists(games) |
.if ${MKMAN} != "no" |
SUBDIR+= games |
afterinstall: whatis.db |
|
whatis.db: |
|
cd ${.CURDIR}/share/man && ${MAKE} ${_M} makedb |
.endif |
.endif |
|
|
SUBDIR+= gnu |
# Targets (in order!) called by "make build". |
# This is needed for libstdc++ and gen-params. |
|
includes-gnu: includes-include includes-sys |
|
|
|
.if exists(regress) |
.if ${MKOBJDIRS:Uno} != "no" |
.ifmake !(install) |
BUILDTARGETS+= obj |
SUBDIR+= regress |
|
.endif |
.endif |
|
.if !defined(UPDATE) && !defined(NOCLEANDIR) |
regression-tests: |
BUILDTARGETS+= cleandir |
@echo Running regression tests... |
|
@(cd ${.CURDIR}/regress && ${MAKE} ${_M} regress) |
|
.endif |
.endif |
|
.if ${USETOOLS} != "no" |
buildstartmsg: |
BUILDTARGETS+= do-make-tools |
@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) |
|
.endif |
.endif |
.else |
.if !defined(NODISTRIBDIRS) |
(cd ${.CURDIR}/etc && ${MAKE} distrib-dirs) |
BUILDTARGETS+= do-distrib-dirs |
.endif |
.endif |
|
.if !defined(NOINCLUDES) |
|
BUILDTARGETS+= includes |
.endif |
.endif |
|
BUILDTARGETS+= do-build |
|
|
afterinstall: |
# Enforce proper ordering of some rules. |
.if ${MKMAN} != "no" && !defined(_BUILD) |
|
${MAKE} ${_M} whatis.db |
|
.endif |
|
|
|
whatis.db: |
.ORDER: ${BUILDTARGETS} |
(cd ${.CURDIR}/share/man && ${MAKE} ${_M} makedb) |
includes-lib: includes-include includes-sys |
|
includes-gnu: includes-lib |
|
|
# wrt info/dir below: It's safe to move this over top of /usr/share/info/dir, |
# Build the system and install into DESTDIR. |
# as the build will automatically remove/replace the non-pkg entries there. |
|
|
|
.if defined(BUILD_DONE) |
|
build: |
build: |
@echo "Build installed into ${DESTDIR}" |
.if defined(BUILD_DONE) |
|
@echo "Build already installed into ${DESTDIR}" |
.else |
.else |
build: |
@echo -n "Build started at: " && date |
@${MAKE} ${_M} buildstartmsg |
@${MAKE} ${_J} ${_M} ${BUILDTARGETS} |
@${MAKE} ${_M} beforeinstall |
@echo -n "Build finished at: " && date |
@${MAKE} ${_M} do-force-domestic |
|
@${MAKE} ${_M} do-share-mk |
|
@${MAKE} ${_M} do-cleandir |
|
@${MAKE} ${_M} do-make-obj |
|
@${MAKE} ${_M} do-make-tools |
|
@${MAKE} ${_M} do-make-includes |
|
@${MAKE} ${_M} do-lib-csu |
|
@${MAKE} ${_M} do-lib |
|
@${MAKE} ${_M} do-gnu-lib |
|
@${MAKE} ${_M} do-dependall |
|
@${MAKE} ${_M} do-domestic |
|
@${MAKE} ${_M} do-whatisdb |
|
@${MAKE} ${_M} buildendmsg |
|
.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 |
|
.endif |
.endif |
|
|
do-share-mk: |
# Build a release or snapshot (implies "make build"). |
.if ${MKSHARE} != "no" |
|
(cd ${.CURDIR}/share/mk && ${MAKE} install) |
|
.endif |
|
|
|
do-cleandir: |
release snapshot: build |
.if !defined(UPDATE) && !defined(NOCLEANDIR) |
cd ${.CURDIR}/etc && ${MAKE} ${_M} INSTALL_DONE=1 release |
${MAKE} ${_J} ${_M} cleandir |
|
.endif |
|
|
|
do-make-obj: |
# Special components of the "make build" process. |
.if ${MKOBJDIRS} != "no" |
|
${MAKE} ${_J} ${_M} obj |
|
.if defined(USE_NEW_TOOLCHAIN) |
|
cd ${.CURDIR}/tools && ${MAKE} ${_M} obj |
|
.endif |
|
.endif |
|
|
|
do-make-tools: |
do-make-tools: |
.if defined(USE_NEW_TOOLCHAIN) |
|
cd ${.CURDIR}/tools && ${MAKE} ${_M} build |
cd ${.CURDIR}/tools && ${MAKE} ${_M} build |
.endif |
|
|
|
do-make-includes: |
|
.if !defined(NOINCLUDES) |
|
${MAKE} ${_M} includes |
|
.endif |
|
|
|
do-lib-csu: |
|
(cd ${.CURDIR}/lib/csu && \ |
|
${MAKE} ${_M} ${_J} MKSHARE=no dependall && \ |
|
${MAKE} ${_M} MKSHARE=no install) |
|
|
|
do-lib: |
do-distrib-dirs: |
(cd ${.CURDIR}/lib && \ |
cd ${.CURDIR}/etc && ${MAKE} ${_M} DESTDIR=${DESTDIR} distrib-dirs |
${MAKE} ${_M} ${_J} MKSHARE=no dependall && \ |
|
${MAKE} ${_M} MKSHARE=no install) |
|
|
|
do-gnu-lib: |
do-build: |
(cd ${.CURDIR}/gnu/lib && \ |
.for dir in lib/csu lib gnu/lib |
${MAKE} ${_M} ${_J} MKSHARE=no dependall && \ |
.for targ in dependall install |
${MAKE} ${_M} MKSHARE=no install) |
cd ${.CURDIR}/${dir} && \ |
|
${MAKE} ${_M} ${_J} MKSHARE=no MKLINT=no ${targ} |
|
.endfor |
|
.endfor |
|
${MAKE} ${_M} ${_J} dependall |
|
${MAKE} ${_M} ${_J} install |
|
|
|
# Speedup stubs for some subtrees that don't need to run these rules. |
|
# (Tells <bsd.subdir.mk> not to recurse for them.) |
|
|
|
includes-bin includes-games includes-libexec includes-regress \ |
|
includes-sbin includes-usr.sbin includes-tools \ |
|
all-tools install-tools install-regress: |
|
@true |
|
|
do-dependall: |
.include "${.CURDIR}/share/mk/bsd.subdir.mk" |
${MAKE} ${_M} ${_J} dependall && ${MAKE} ${_M} _BUILD= install |
|
|
|
do-domestic: |
|
.if defined(DOMESTIC) && !defined(EXPORTABLE_SYSTEM) |
|
(cd ${.CURDIR}/${DOMESTIC} && ${MAKE} ${_M} ${_J} _SLAVE_BUILD= build) |
|
.endif |
|
|
|
do-whatisdb: |
|
${MAKE} ${_M} whatis.db |
|
|
|
release snapshot: build |
|
(cd ${.CURDIR}/etc && ${MAKE} ${_M} INSTALL_DONE=1 release) |
|
|
|
.include <bsd.subdir.mk> |
_M:= -m ${.CURDIR}/share/mk |