Makefile revision 1.131
11.131Stv#	$NetBSD: Makefile,v 1.131 2001/09/22 12:30:13 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.131Stv#   do-make-tools: builds host toolchain.
471.131Stv#   do-distrib-dirs: creates the distribution directories.
481.123Smrg#   do-force-domestic: check's that FORCE_DOMESTIC isn't set (deprecated.)
491.127Stv#   do-cleandir: cleans the tree.
501.127Stv#   do-make-obj: creates object directories if required.
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.15Scgdafterinstall:
1071.86Slukem.if ${MKMAN} != "no" && !defined(_BUILD)
1081.112Smrg	${MAKE} ${_M} whatis.db
1091.81Sscottr.endif
1101.81Sscottr
1111.81Sscottrwhatis.db:
1121.112Smrg	(cd ${.CURDIR}/share/man && ${MAKE} ${_M} makedb)
1131.15Scgd
1141.84Stv# wrt info/dir below:  It's safe to move this over top of /usr/share/info/dir,
1151.84Stv# as the build will automatically remove/replace the non-pkg entries there.
1161.84Stv
1171.110Sjlam.if defined(BUILD_DONE)
1181.110Sjlambuild:
1191.110Sjlam	@echo "Build installed into ${DESTDIR}"
1201.110Sjlam.else
1211.124Smrgbuild:
1221.124Smrg	@${MAKE} ${_M} buildstartmsg
1231.131Stv	@${MAKE} ${_M} do-make-tools
1241.131Stv	@${MAKE} ${_M} do-distrib-dirs
1251.124Smrg	@${MAKE} ${_M} do-force-domestic
1261.124Smrg	@${MAKE} ${_M} do-cleandir
1271.124Smrg	@${MAKE} ${_M} do-make-obj
1281.124Smrg	@${MAKE} ${_M} do-make-includes
1291.124Smrg	@${MAKE} ${_M} do-lib-csu
1301.124Smrg	@${MAKE} ${_M} do-lib
1311.124Smrg	@${MAKE} ${_M} do-gnu-lib
1321.124Smrg	@${MAKE} ${_M} do-dependall
1331.124Smrg	@${MAKE} ${_M} do-domestic
1341.124Smrg	@${MAKE} ${_M} do-whatisdb
1351.124Smrg	@${MAKE} ${_M} buildendmsg
1361.123Smrg.endif
1371.123Smrg
1381.131Stvdo-make-tools:
1391.131Stv.if ${MKOBJDIRS} != "no"
1401.131Stv	cd ${.CURDIR}/tools && ${MAKE} ${_M} obj
1411.131Stv.endif
1421.131Stv	cd ${.CURDIR}/tools && ${MAKE} ${_M} build
1431.131Stv
1441.131Stvdo-distrib-dirs:
1451.131Stv.ifndef NODISTRIBDIRS
1461.131Stv.ifndef DESTDIR
1471.131Stv	(cd ${.CURDIR}/etc && ${MAKE} ${_M} DESTDIR=/ distrib-dirs)
1481.131Stv.else
1491.131Stv	(cd ${.CURDIR}/etc && ${MAKE} ${_M} DESTDIR=${DESTDIR} distrib-dirs)
1501.131Stv.endif
1511.131Stv.endif
1521.131Stv
1531.123Smrgdo-force-domestic:
1541.96Sscottr.if defined(FORCE_DOMESTIC)
1551.96Sscottr	@echo '*** CAPUTE!'
1561.96Sscottr	@echo '    The FORCE_DOMESTIC flag is not compatible with "make build".'
1571.96Sscottr	@echo '    Please correct the problem and try again.'
1581.96Sscottr	@false
1591.96Sscottr.endif
1601.123Smrg
1611.123Smrgdo-cleandir:
1621.112Smrg.if !defined(UPDATE) && !defined(NOCLEANDIR)
1631.117Smrg	${MAKE} ${_J} ${_M} cleandir
1641.39Schristos.endif
1651.123Smrg
1661.123Smrgdo-make-obj:
1671.103Ssimonb.if ${MKOBJDIRS} != "no"
1681.122Ssommerfe	${MAKE} ${_J} ${_M} obj
1691.127Stv.endif
1701.123Smrg
1711.123Smrgdo-make-includes:
1721.112Smrg.if !defined(NOINCLUDES)
1731.112Smrg	${MAKE} ${_M} includes
1741.71Smycroft.endif
1751.123Smrg
1761.123Smrgdo-lib-csu:
1771.61Smycroft	(cd ${.CURDIR}/lib/csu && \
1781.113Smrg	    ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \
1791.113Smrg	    ${MAKE} ${_M} MKSHARE=no install)
1801.123Smrg
1811.123Smrgdo-lib:
1821.61Smycroft	(cd ${.CURDIR}/lib && \
1831.113Smrg	    ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \
1841.113Smrg	    ${MAKE} ${_M} MKSHARE=no install)
1851.123Smrg
1861.123Smrgdo-gnu-lib:
1871.61Smycroft	(cd ${.CURDIR}/gnu/lib && \
1881.113Smrg	    ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \
1891.113Smrg	    ${MAKE} ${_M} MKSHARE=no install)
1901.123Smrg
1911.123Smrgdo-dependall:
1921.112Smrg	${MAKE} ${_M} ${_J} dependall && ${MAKE} ${_M} _BUILD= install
1931.123Smrg
1941.123Smrgdo-domestic:
1951.97Schristos.if defined(DOMESTIC) && !defined(EXPORTABLE_SYSTEM)
1961.112Smrg	(cd ${.CURDIR}/${DOMESTIC} && ${MAKE} ${_M} ${_J} _SLAVE_BUILD= build)
1971.49Slukem.endif
1981.123Smrg
1991.123Smrgdo-whatisdb:
2001.112Smrg	${MAKE} ${_M} whatis.db
2011.87Scjs
2021.87Scjsrelease snapshot: build
2031.112Smrg	(cd ${.CURDIR}/etc && ${MAKE} ${_M} INSTALL_DONE=1 release)
2041.129Stv
2051.129Stv# Speedup stubs for some subtrees that don't need to run these rules
2061.129Stvincludes-bin includes-games includes-libexec includes-regress \
2071.129Stvincludes-sbin includes-usr.sbin:
2081.129Stv	@${TRUE}
2091.1Scgd
2101.130Stv.if !exists(${.CURDIR}/share/mk)
2111.130Stv.BEGIN:
2121.130Stv	@echo 'BUILD ABORTED: share/mk does not exist, cannot run make.'
2131.130Stv	@false
2141.130Stv.endif
2151.130Stv
2161.1Scgd.include <bsd.subdir.mk>
2171.130Stv
2181.130Stv_M:=	-m ${.CURDIR}/share/mk
219