Makefile revision 1.124
11.124Smrg#	$NetBSD: Makefile,v 1.124 2001/06/10 13:12:32 mrg 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.101Ssommerfe#	'make build'. It defaults to 1.
281.95Scjs#   UPDATE will avoid a `make cleandir' at the start of `make build',
291.95Scjs#	as well as having the effects listed in /usr/share/mk/bsd.README.
301.119Stoddpw#   NOCLEANDIR will avoid a `make cleandir' at the start of `make build',
311.119Stoddpw#	but without having the effects listed in /usr/share/mk/bsd.README.
321.119Stoddpw#   NOINCLUDES will avoid the `make includes' usually done by `make build'.
331.95Scjs#
341.95Scjs# Targets:
351.110Sjlam#   build: builds a full release of netbsd in DESTDIR. If BUILD_DONE is
361.110Sjlam#	set, this is an empty target.
371.95Scjs#   release: does a `make build,' and then tars up the DESTDIR files
381.95Scjs#	into RELEASEDIR, in release(7) format. (See etc/Makefile for
391.95Scjs#	more information on this.)
401.95Scjs#   snapshot: a synonym for release.
411.123Smrg#
421.123Smrg# Sub targets of `make build,' in order:
431.123Smrg#   buildstartmsg: displays the start time of the build.
441.123Smrg#   beforeinstall: creates the distribution directories.
451.123Smrg#   do-force-domestic: check's that FORCE_DOMESTIC isn't set (deprecated.)
461.123Smrg#   do-share-mk: installs /usr/share/mk files.
471.123Smrg#   do-cleandir: clean's the tree.
481.123Smrg#   do-make-obj: create's object directories if required.
491.123Smrg#   do-check-egcs: check's that we have a modern enough compiler (deprecated.)
501.123Smrg#   do-make-includes: install include files.
511.123Smrg#   do-lib-csu: build & install startup object files.
521.123Smrg#   do-lib: build & install system libraries.
531.123Smrg#   do-gnu-lib: build & install gnu system libraries.
541.123Smrg#   do-dependall: builds & install the entire system.
551.123Smrg#   do-domestic: build & install the domestic tree (deprecated.)
561.123Smrg#   do-whatisdb: build & install the `whatis.db' man database.
571.123Smrg#   buildendmsg: displays the end time of the build.
581.32Scgd
591.118Sthorpej.include <bsd.own.mk>
601.4Scgd
611.100SsommerfeMKOBJDIRS ?= no
621.115SthorpejHAVE_EGCS!=	${CXX} --version | egrep "^(2\.[89]|egcs)" ; echo
631.58Stv
641.76Sbouyer.if defined(NBUILDJOBS)
651.76Sbouyer_J= -j${NBUILDJOBS}
661.76Sbouyer.endif
671.76Sbouyer
681.112Smrg.if defined(DESTDIR)
691.112Smrg_M=-m ${DESTDIR}/usr/share/mk
701.112Smrg.endif
711.112Smrg
721.4Scgd# NOTE THAT etc *DOES NOT* BELONG IN THE LIST BELOW
731.2Scgd
741.52SmycroftSUBDIR+= lib include bin libexec sbin usr.bin usr.sbin share sys
751.120Sfredb.if make(cleandir) || make(obj)
761.109ScjsSUBDIR+= distrib
771.114Ssjg.ifdef MAKEOBJDIRPREFIX
781.114SsjgSUBDIR+= etc
791.114Ssjg.endif
801.109Scjs.endif
811.105Sassar
821.105Sassarincludes-lib: includes-include includes-sys
831.36Sexplorer
841.36Sexplorer.if exists(games)
851.36SexplorerSUBDIR+= games
861.36Sexplorer.endif
871.36Sexplorer
881.8ScgdSUBDIR+= gnu
891.52Smycroft# This is needed for libstdc++ and gen-params.
901.52Smycroftincludes-gnu: includes-include includes-sys
911.21Scgd
921.13Sbrezak.if exists(regress)
931.9Scgd.ifmake !(install)
941.9ScgdSUBDIR+= regress
951.9Scgd.endif
961.9Scgd
971.10Scgdregression-tests:
981.10Scgd	@echo Running regression tests...
991.112Smrg	@(cd ${.CURDIR}/regress && ${MAKE} ${_M} regress)
1001.13Sbrezak.endif
1011.20Scgd
1021.123Smrgbuildstartmsg:
1031.45Sperry	@echo -n "Build started at: "
1041.45Sperry	@date
1051.108Serh
1061.123Smrgbuildendmsg:
1071.123Smrg	@echo -n "Build finished at: "
1081.123Smrg	@date
1091.123Smrg
1101.121Sdeberg# If sharesrc is around, use its share/mk files to bootstrap until the
1111.121Sdeberg# mk files are installed (first step of make build).  If installing to
1121.121Sdeberg# DESTDIR, don't bother, since the build will fail later on anyway.
1131.121Sdeberg
1141.108Serhbeforeinstall:
1151.112Smrg.ifndef NODISTRIBDIRS
1161.26Stls.ifndef DESTDIR
1171.121Sdeberg.if exists(share/mk)
1181.121Sdeberg	(cd ${.CURDIR}/etc && ${MAKE} -m ${.CURDIR}/share/mk DESTDIR=/ distrib-dirs)
1191.121Sdeberg.else
1201.26Stls	(cd ${.CURDIR}/etc && ${MAKE} DESTDIR=/ distrib-dirs)
1211.121Sdeberg.endif
1221.31Stls.else
1231.117Smrg	(cd ${.CURDIR}/etc && ${MAKE} distrib-dirs)
1241.26Stls.endif
1251.112Smrg.endif
1261.15Scgd
1271.15Scgdafterinstall:
1281.86Slukem.if ${MKMAN} != "no" && !defined(_BUILD)
1291.112Smrg	${MAKE} ${_M} whatis.db
1301.81Sscottr.endif
1311.81Sscottr
1321.81Sscottrwhatis.db:
1331.112Smrg	(cd ${.CURDIR}/share/man && ${MAKE} ${_M} makedb)
1341.15Scgd
1351.84Stv# wrt info/dir below:  It's safe to move this over top of /usr/share/info/dir,
1361.84Stv# as the build will automatically remove/replace the non-pkg entries there.
1371.84Stv
1381.110Sjlam.if defined(BUILD_DONE)
1391.110Sjlambuild:
1401.110Sjlam	@echo "Build installed into ${DESTDIR}"
1411.110Sjlam.else
1421.124Smrgbuild:
1431.124Smrg	@${MAKE} ${_M} buildstartmsg
1441.124Smrg	@${MAKE} ${_M} beforeinstall
1451.124Smrg	@${MAKE} ${_M} do-force-domestic
1461.124Smrg	@${MAKE} ${_M} do-share-mk
1471.124Smrg	@${MAKE} ${_M} do-cleandir
1481.124Smrg	@${MAKE} ${_M} do-make-obj
1491.124Smrg	@${MAKE} ${_M} do-check-egcs
1501.124Smrg	@${MAKE} ${_M} do-make-includes
1511.124Smrg	@${MAKE} ${_M} do-lib-csu
1521.124Smrg	@${MAKE} ${_M} do-lib
1531.124Smrg	@${MAKE} ${_M} do-gnu-lib
1541.124Smrg	@${MAKE} ${_M} do-dependall
1551.124Smrg	@${MAKE} ${_M} do-domestic
1561.124Smrg	@${MAKE} ${_M} do-whatisdb
1571.124Smrg	@${MAKE} ${_M} buildendmsg
1581.123Smrg.endif
1591.123Smrg
1601.123Smrgdo-force-domestic:
1611.96Sscottr.if defined(FORCE_DOMESTIC)
1621.96Sscottr	@echo '*** CAPUTE!'
1631.96Sscottr	@echo '    The FORCE_DOMESTIC flag is not compatible with "make build".'
1641.96Sscottr	@echo '    Please correct the problem and try again.'
1651.96Sscottr	@false
1661.96Sscottr.endif
1671.123Smrg
1681.123Smrgdo-share-mk:
1691.86Slukem.if ${MKSHARE} != "no"
1701.117Smrg	(cd ${.CURDIR}/share/mk && ${MAKE} install)
1711.68Slukem.endif
1721.123Smrg
1731.123Smrgdo-cleandir:
1741.112Smrg.if !defined(UPDATE) && !defined(NOCLEANDIR)
1751.117Smrg	${MAKE} ${_J} ${_M} cleandir
1761.39Schristos.endif
1771.123Smrg
1781.123Smrgdo-make-obj:
1791.103Ssimonb.if ${MKOBJDIRS} != "no"
1801.122Ssommerfe	${MAKE} ${_J} ${_M} obj
1811.103Ssimonb.endif
1821.123Smrg
1831.123Smrgdo-check-egcs:
1841.115Sthorpej.if empty(HAVE_EGCS)
1851.71Smycroft.if defined(DESTDIR)
1861.71Smycroft	@echo "*** CAPUTE!"
1871.84Stv	@echo "    You attempted to compile the world without egcs.  You must"
1881.71Smycroft	@echo "    first install a native egcs compiler."
1891.84Stv	@false
1901.71Smycroft.else
1911.71Smycroft	(cd ${.CURDIR}/gnu/usr.bin/egcs && \
1921.112Smrg	    ${MAKE} ${_M} ${_J} dependall MKMAN=no && \
1931.112Smrg	    ${MAKE} ${_M} MKMAN=no install && ${MAKE} ${_M} cleandir)
1941.112Smrg.endif
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