Makefile revision 1.130
11.130Stv#	$NetBSD: Makefile,v 1.130 2001/09/22 05:37:17 tv Exp $
21.95Scjs
31.95Scjs# This is the top-level makefile for building NetBSD. For an outline of
41.95Scjs# how to build a snapshot or release, as well as other release engineering
51.95Scjs# information, see http://www.netbsd.org/developers/releng/index.html
61.95Scjs#
71.95Scjs# Not everything you can set or do is documented in this makefile. In
81.95Scjs# particular, you should review the files in /usr/share/mk (especially
91.95Scjs# bsd.README) for general information on building programs and writing
101.95Scjs# Makefiles within this structure, and see the comments in src/etc/Makefile
111.95Scjs# for further information on installation and release set options.
121.95Scjs#
131.95Scjs# Variables listed below can be set on the make command line (highest
141.95Scjs# priority), in /etc/mk.conf (middle priority), or in the environment
151.95Scjs# (lowest priority).
161.95Scjs#
171.95Scjs# Variables:
181.101Ssommerfe#   DESTDIR is the target directory for installation of the compiled
191.101Ssommerfe#	software. It defaults to /. Note that programs are built against
201.101Ssommerfe#	libraries installed in DESTDIR.
211.95Scjs#   MKMAN, if set to `no', will prevent building of manual pages.
221.101Ssommerfe#   MKOBJDIRS, if not set to `no', will build object directories at 
231.101Ssommerfe#	an appropriate point in a build.
241.95Scjs#   MKSHARE, if set to `no', will prevent building and installing
251.95Scjs#	anything in /usr/share.
261.101Ssommerfe#   NBUILDJOBS is the number of jobs to start in parallel during a
271.127Stv#	`make build'. It defaults to 1.
281.125Smrg#   UPDATE, if defined, will avoid a `make cleandir' at the start of
291.125Smrg#     `make build', as well as having the effects listed in
301.125Smrg#     /usr/share/mk/bsd.README.
311.125Smrg#   NOCLEANDIR, if defined, will avoid a `make cleandir' at the start
321.125Smrg#     of the `make build'.
331.119Stoddpw#   NOINCLUDES will avoid the `make includes' usually done by `make build'.
341.125Smrg
351.95Scjs#
361.95Scjs# Targets:
371.110Sjlam#   build: builds a full release of netbsd in DESTDIR. If BUILD_DONE is
381.110Sjlam#	set, this is an empty target.
391.95Scjs#   release: does a `make build,' and then tars up the DESTDIR files
401.95Scjs#	into RELEASEDIR, in release(7) format. (See etc/Makefile for
411.95Scjs#	more information on this.)
421.95Scjs#   snapshot: a synonym for release.
431.123Smrg#
441.123Smrg# Sub targets of `make build,' in order:
451.123Smrg#   buildstartmsg: displays the start time of the build.
461.123Smrg#   beforeinstall: creates the distribution directories.
471.123Smrg#   do-force-domestic: check's that FORCE_DOMESTIC isn't set (deprecated.)
481.127Stv#   do-cleandir: cleans the tree.
491.127Stv#   do-make-obj: creates object directories if required.
501.127Stv#   do-make-tools: builds host toolchain.
511.123Smrg#   do-make-includes: install include files.
521.123Smrg#   do-lib-csu: build & install startup object files.
531.123Smrg#   do-lib: build & install system libraries.
541.123Smrg#   do-gnu-lib: build & install gnu system libraries.
551.123Smrg#   do-dependall: builds & install the entire system.
561.123Smrg#   do-domestic: build & install the domestic tree (deprecated.)
571.123Smrg#   do-whatisdb: build & install the `whatis.db' man database.
581.123Smrg#   buildendmsg: displays the end time of the build.
591.32Scgd
601.118Sthorpej.include <bsd.own.mk>
611.4Scgd
621.100SsommerfeMKOBJDIRS ?= no
631.58Stv
641.76Sbouyer.if defined(NBUILDJOBS)
651.76Sbouyer_J= -j${NBUILDJOBS}
661.76Sbouyer.endif
671.76Sbouyer
681.4Scgd# NOTE THAT etc *DOES NOT* BELONG IN THE LIST BELOW
691.2Scgd
701.52SmycroftSUBDIR+= lib include bin libexec sbin usr.bin usr.sbin share sys
711.120Sfredb.if make(cleandir) || make(obj)
721.109ScjsSUBDIR+= distrib
731.114Ssjg.ifdef MAKEOBJDIRPREFIX
741.114SsjgSUBDIR+= etc
751.114Ssjg.endif
761.109Scjs.endif
771.105Sassar
781.105Sassarincludes-lib: includes-include includes-sys
791.36Sexplorer
801.36Sexplorer.if exists(games)
811.36SexplorerSUBDIR+= games
821.36Sexplorer.endif
831.36Sexplorer
841.8ScgdSUBDIR+= gnu
851.52Smycroft# This is needed for libstdc++ and gen-params.
861.52Smycroftincludes-gnu: includes-include includes-sys
871.21Scgd
881.13Sbrezak.if exists(regress)
891.9Scgd.ifmake !(install)
901.9ScgdSUBDIR+= regress
911.9Scgd.endif
921.9Scgd
931.10Scgdregression-tests:
941.10Scgd	@echo Running regression tests...
951.112Smrg	@(cd ${.CURDIR}/regress && ${MAKE} ${_M} regress)
961.13Sbrezak.endif
971.20Scgd
981.123Smrgbuildstartmsg:
991.45Sperry	@echo -n "Build started at: "
1001.45Sperry	@date
1011.108Serh
1021.123Smrgbuildendmsg:
1031.123Smrg	@echo -n "Build finished at: "
1041.123Smrg	@date
1051.123Smrg
1061.108Serhbeforeinstall:
1071.112Smrg.ifndef NODISTRIBDIRS
1081.26Stls.ifndef DESTDIR
1091.130Stv	(cd ${.CURDIR}/etc && ${MAKE} ${_M} DESTDIR=/ distrib-dirs)
1101.121Sdeberg.else
1111.130Stv	(cd ${.CURDIR}/etc && ${MAKE} ${_M} DESTDIR=${DESTDIR} distrib-dirs)
1121.26Stls.endif
1131.112Smrg.endif
1141.15Scgd
1151.15Scgdafterinstall:
1161.86Slukem.if ${MKMAN} != "no" && !defined(_BUILD)
1171.112Smrg	${MAKE} ${_M} whatis.db
1181.81Sscottr.endif
1191.81Sscottr
1201.81Sscottrwhatis.db:
1211.112Smrg	(cd ${.CURDIR}/share/man && ${MAKE} ${_M} makedb)
1221.15Scgd
1231.84Stv# wrt info/dir below:  It's safe to move this over top of /usr/share/info/dir,
1241.84Stv# as the build will automatically remove/replace the non-pkg entries there.
1251.84Stv
1261.110Sjlam.if defined(BUILD_DONE)
1271.110Sjlambuild:
1281.110Sjlam	@echo "Build installed into ${DESTDIR}"
1291.110Sjlam.else
1301.124Smrgbuild:
1311.124Smrg	@${MAKE} ${_M} buildstartmsg
1321.124Smrg	@${MAKE} ${_M} beforeinstall
1331.124Smrg	@${MAKE} ${_M} do-force-domestic
1341.124Smrg	@${MAKE} ${_M} do-cleandir
1351.124Smrg	@${MAKE} ${_M} do-make-obj
1361.127Stv	@${MAKE} ${_M} do-make-tools
1371.124Smrg	@${MAKE} ${_M} do-make-includes
1381.124Smrg	@${MAKE} ${_M} do-lib-csu
1391.124Smrg	@${MAKE} ${_M} do-lib
1401.124Smrg	@${MAKE} ${_M} do-gnu-lib
1411.124Smrg	@${MAKE} ${_M} do-dependall
1421.124Smrg	@${MAKE} ${_M} do-domestic
1431.124Smrg	@${MAKE} ${_M} do-whatisdb
1441.124Smrg	@${MAKE} ${_M} buildendmsg
1451.123Smrg.endif
1461.123Smrg
1471.123Smrgdo-force-domestic:
1481.96Sscottr.if defined(FORCE_DOMESTIC)
1491.96Sscottr	@echo '*** CAPUTE!'
1501.96Sscottr	@echo '    The FORCE_DOMESTIC flag is not compatible with "make build".'
1511.96Sscottr	@echo '    Please correct the problem and try again.'
1521.96Sscottr	@false
1531.96Sscottr.endif
1541.123Smrg
1551.123Smrgdo-cleandir:
1561.112Smrg.if !defined(UPDATE) && !defined(NOCLEANDIR)
1571.117Smrg	${MAKE} ${_J} ${_M} cleandir
1581.39Schristos.endif
1591.123Smrg
1601.123Smrgdo-make-obj:
1611.103Ssimonb.if ${MKOBJDIRS} != "no"
1621.122Ssommerfe	${MAKE} ${_J} ${_M} obj
1631.127Stv	cd ${.CURDIR}/tools && ${MAKE} ${_M} obj
1641.127Stv.endif
1651.123Smrg
1661.127Stvdo-make-tools:
1671.127Stv	cd ${.CURDIR}/tools && ${MAKE} ${_M} build
1681.123Smrg
1691.123Smrgdo-make-includes:
1701.112Smrg.if !defined(NOINCLUDES)
1711.112Smrg	${MAKE} ${_M} includes
1721.71Smycroft.endif
1731.123Smrg
1741.123Smrgdo-lib-csu:
1751.61Smycroft	(cd ${.CURDIR}/lib/csu && \
1761.113Smrg	    ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \
1771.113Smrg	    ${MAKE} ${_M} MKSHARE=no install)
1781.123Smrg
1791.123Smrgdo-lib:
1801.61Smycroft	(cd ${.CURDIR}/lib && \
1811.113Smrg	    ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \
1821.113Smrg	    ${MAKE} ${_M} MKSHARE=no install)
1831.123Smrg
1841.123Smrgdo-gnu-lib:
1851.61Smycroft	(cd ${.CURDIR}/gnu/lib && \
1861.113Smrg	    ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \
1871.113Smrg	    ${MAKE} ${_M} MKSHARE=no install)
1881.123Smrg
1891.123Smrgdo-dependall:
1901.112Smrg	${MAKE} ${_M} ${_J} dependall && ${MAKE} ${_M} _BUILD= install
1911.123Smrg
1921.123Smrgdo-domestic:
1931.97Schristos.if defined(DOMESTIC) && !defined(EXPORTABLE_SYSTEM)
1941.112Smrg	(cd ${.CURDIR}/${DOMESTIC} && ${MAKE} ${_M} ${_J} _SLAVE_BUILD= build)
1951.49Slukem.endif
1961.123Smrg
1971.123Smrgdo-whatisdb:
1981.112Smrg	${MAKE} ${_M} whatis.db
1991.87Scjs
2001.87Scjsrelease snapshot: build
2011.112Smrg	(cd ${.CURDIR}/etc && ${MAKE} ${_M} INSTALL_DONE=1 release)
2021.129Stv
2031.129Stv# Speedup stubs for some subtrees that don't need to run these rules
2041.129Stvincludes-bin includes-games includes-libexec includes-regress \
2051.129Stvincludes-sbin includes-usr.sbin:
2061.129Stv	@${TRUE}
2071.1Scgd
2081.130Stv.if !exists(${.CURDIR}/share/mk)
2091.130Stv.BEGIN:
2101.130Stv	@echo 'BUILD ABORTED: share/mk does not exist, cannot run make.'
2111.130Stv	@false
2121.130Stv.endif
2131.130Stv
2141.1Scgd.include <bsd.subdir.mk>
2151.130Stv
2161.130Stv_M:=	-m ${.CURDIR}/share/mk
217