Makefile revision 1.127
11.127Stv#	$NetBSD: Makefile,v 1.127 2001/08/14 14:04:35 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.123Smrg#   do-share-mk: installs /usr/share/mk files.
491.127Stv#   do-cleandir: cleans the tree.
501.127Stv#   do-make-obj: creates object directories if required.
511.127Stv#   do-make-tools: builds host toolchain.
521.123Smrg#   do-make-includes: install include files.
531.123Smrg#   do-lib-csu: build & install startup object files.
541.123Smrg#   do-lib: build & install system libraries.
551.123Smrg#   do-gnu-lib: build & install gnu system libraries.
561.123Smrg#   do-dependall: builds & install the entire system.
571.123Smrg#   do-domestic: build & install the domestic tree (deprecated.)
581.123Smrg#   do-whatisdb: build & install the `whatis.db' man database.
591.123Smrg#   buildendmsg: displays the end time of the build.
601.32Scgd
611.118Sthorpej.include <bsd.own.mk>
621.4Scgd
631.127Stv.if defined(USE_NEW_TOOLCHAIN)
641.127Stv.include "${.CURDIR}/tools/Makefile.tools"
651.127Stv.endif
661.127Stv
671.100SsommerfeMKOBJDIRS ?= no
681.58Stv
691.76Sbouyer.if defined(NBUILDJOBS)
701.76Sbouyer_J= -j${NBUILDJOBS}
711.76Sbouyer.endif
721.76Sbouyer
731.112Smrg.if defined(DESTDIR)
741.112Smrg_M=-m ${DESTDIR}/usr/share/mk
751.112Smrg.endif
761.112Smrg
771.4Scgd# NOTE THAT etc *DOES NOT* BELONG IN THE LIST BELOW
781.2Scgd
791.52SmycroftSUBDIR+= lib include bin libexec sbin usr.bin usr.sbin share sys
801.120Sfredb.if make(cleandir) || make(obj)
811.109ScjsSUBDIR+= distrib
821.114Ssjg.ifdef MAKEOBJDIRPREFIX
831.114SsjgSUBDIR+= etc
841.114Ssjg.endif
851.109Scjs.endif
861.105Sassar
871.105Sassarincludes-lib: includes-include includes-sys
881.36Sexplorer
891.36Sexplorer.if exists(games)
901.36SexplorerSUBDIR+= games
911.36Sexplorer.endif
921.36Sexplorer
931.8ScgdSUBDIR+= gnu
941.52Smycroft# This is needed for libstdc++ and gen-params.
951.52Smycroftincludes-gnu: includes-include includes-sys
961.21Scgd
971.13Sbrezak.if exists(regress)
981.9Scgd.ifmake !(install)
991.9ScgdSUBDIR+= regress
1001.9Scgd.endif
1011.9Scgd
1021.10Scgdregression-tests:
1031.10Scgd	@echo Running regression tests...
1041.112Smrg	@(cd ${.CURDIR}/regress && ${MAKE} ${_M} regress)
1051.13Sbrezak.endif
1061.20Scgd
1071.123Smrgbuildstartmsg:
1081.45Sperry	@echo -n "Build started at: "
1091.45Sperry	@date
1101.108Serh
1111.123Smrgbuildendmsg:
1121.123Smrg	@echo -n "Build finished at: "
1131.123Smrg	@date
1141.123Smrg
1151.121Sdeberg# If sharesrc is around, use its share/mk files to bootstrap until the
1161.121Sdeberg# mk files are installed (first step of make build).  If installing to
1171.121Sdeberg# DESTDIR, don't bother, since the build will fail later on anyway.
1181.121Sdeberg
1191.108Serhbeforeinstall:
1201.112Smrg.ifndef NODISTRIBDIRS
1211.26Stls.ifndef DESTDIR
1221.121Sdeberg.if exists(share/mk)
1231.126Senami	(cd ${.CURDIR}/etc && \
1241.126Senami	    ${MAKE} -m ${.CURDIR}/share/mk DESTDIR=/ distrib-dirs)
1251.121Sdeberg.else
1261.26Stls	(cd ${.CURDIR}/etc && ${MAKE} DESTDIR=/ distrib-dirs)
1271.121Sdeberg.endif
1281.31Stls.else
1291.117Smrg	(cd ${.CURDIR}/etc && ${MAKE} distrib-dirs)
1301.26Stls.endif
1311.112Smrg.endif
1321.15Scgd
1331.15Scgdafterinstall:
1341.86Slukem.if ${MKMAN} != "no" && !defined(_BUILD)
1351.112Smrg	${MAKE} ${_M} whatis.db
1361.81Sscottr.endif
1371.81Sscottr
1381.81Sscottrwhatis.db:
1391.112Smrg	(cd ${.CURDIR}/share/man && ${MAKE} ${_M} makedb)
1401.15Scgd
1411.84Stv# wrt info/dir below:  It's safe to move this over top of /usr/share/info/dir,
1421.84Stv# as the build will automatically remove/replace the non-pkg entries there.
1431.84Stv
1441.110Sjlam.if defined(BUILD_DONE)
1451.110Sjlambuild:
1461.110Sjlam	@echo "Build installed into ${DESTDIR}"
1471.110Sjlam.else
1481.124Smrgbuild:
1491.124Smrg	@${MAKE} ${_M} buildstartmsg
1501.124Smrg	@${MAKE} ${_M} beforeinstall
1511.124Smrg	@${MAKE} ${_M} do-force-domestic
1521.124Smrg	@${MAKE} ${_M} do-share-mk
1531.124Smrg	@${MAKE} ${_M} do-cleandir
1541.124Smrg	@${MAKE} ${_M} do-make-obj
1551.127Stv	@${MAKE} ${_M} do-make-tools
1561.124Smrg	@${MAKE} ${_M} do-make-includes
1571.124Smrg	@${MAKE} ${_M} do-lib-csu
1581.124Smrg	@${MAKE} ${_M} do-lib
1591.124Smrg	@${MAKE} ${_M} do-gnu-lib
1601.124Smrg	@${MAKE} ${_M} do-dependall
1611.124Smrg	@${MAKE} ${_M} do-domestic
1621.124Smrg	@${MAKE} ${_M} do-whatisdb
1631.124Smrg	@${MAKE} ${_M} buildendmsg
1641.123Smrg.endif
1651.123Smrg
1661.123Smrgdo-force-domestic:
1671.96Sscottr.if defined(FORCE_DOMESTIC)
1681.96Sscottr	@echo '*** CAPUTE!'
1691.96Sscottr	@echo '    The FORCE_DOMESTIC flag is not compatible with "make build".'
1701.96Sscottr	@echo '    Please correct the problem and try again.'
1711.96Sscottr	@false
1721.96Sscottr.endif
1731.123Smrg
1741.123Smrgdo-share-mk:
1751.86Slukem.if ${MKSHARE} != "no"
1761.117Smrg	(cd ${.CURDIR}/share/mk && ${MAKE} install)
1771.68Slukem.endif
1781.123Smrg
1791.123Smrgdo-cleandir:
1801.112Smrg.if !defined(UPDATE) && !defined(NOCLEANDIR)
1811.117Smrg	${MAKE} ${_J} ${_M} cleandir
1821.39Schristos.endif
1831.123Smrg
1841.123Smrgdo-make-obj:
1851.103Ssimonb.if ${MKOBJDIRS} != "no"
1861.122Ssommerfe	${MAKE} ${_J} ${_M} obj
1871.127Stv.if defined(USE_NEW_TOOLCHAIN)
1881.127Stv	cd ${.CURDIR}/tools && ${MAKE} ${_M} obj
1891.127Stv.endif
1901.103Ssimonb.endif
1911.123Smrg
1921.127Stvdo-make-tools:
1931.127Stv.if defined(USE_NEW_TOOLCHAIN)
1941.127Stv	cd ${.CURDIR}/tools && ${MAKE} ${_M} build
1951.71Smycroft.endif
1961.123Smrg
1971.123Smrgdo-make-includes:
1981.112Smrg.if !defined(NOINCLUDES)
1991.112Smrg	${MAKE} ${_M} includes
2001.71Smycroft.endif
2011.123Smrg
2021.123Smrgdo-lib-csu:
2031.61Smycroft	(cd ${.CURDIR}/lib/csu && \
2041.113Smrg	    ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \
2051.113Smrg	    ${MAKE} ${_M} MKSHARE=no install)
2061.123Smrg
2071.123Smrgdo-lib:
2081.61Smycroft	(cd ${.CURDIR}/lib && \
2091.113Smrg	    ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \
2101.113Smrg	    ${MAKE} ${_M} MKSHARE=no install)
2111.123Smrg
2121.123Smrgdo-gnu-lib:
2131.61Smycroft	(cd ${.CURDIR}/gnu/lib && \
2141.113Smrg	    ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \
2151.113Smrg	    ${MAKE} ${_M} MKSHARE=no install)
2161.123Smrg
2171.123Smrgdo-dependall:
2181.112Smrg	${MAKE} ${_M} ${_J} dependall && ${MAKE} ${_M} _BUILD= install
2191.123Smrg
2201.123Smrgdo-domestic:
2211.97Schristos.if defined(DOMESTIC) && !defined(EXPORTABLE_SYSTEM)
2221.112Smrg	(cd ${.CURDIR}/${DOMESTIC} && ${MAKE} ${_M} ${_J} _SLAVE_BUILD= build)
2231.49Slukem.endif
2241.123Smrg
2251.123Smrgdo-whatisdb:
2261.112Smrg	${MAKE} ${_M} whatis.db
2271.87Scjs
2281.87Scjsrelease snapshot: build
2291.112Smrg	(cd ${.CURDIR}/etc && ${MAKE} ${_M} INSTALL_DONE=1 release)
2301.1Scgd
2311.1Scgd.include <bsd.subdir.mk>
232