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