Makefile revision 1.123
11.123Smrg#	$NetBSD: Makefile,v 1.123 2001/06/10 13:02:54 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.123Smrgbuild: buildstartmsg beforeinstall do-force-domestic do-share-mk do-cleandir do-make-obj do-check-egcs do-make-includes do-lib-csu do-lib do-gnu-lib do-dependall do-domestic do-whatisdb buildendmsg
1431.123Smrg.endif
1441.123Smrg
1451.123Smrgdo-force-domestic:
1461.96Sscottr.if defined(FORCE_DOMESTIC)
1471.96Sscottr	@echo '*** CAPUTE!'
1481.96Sscottr	@echo '    The FORCE_DOMESTIC flag is not compatible with "make build".'
1491.96Sscottr	@echo '    Please correct the problem and try again.'
1501.96Sscottr	@false
1511.96Sscottr.endif
1521.123Smrg
1531.123Smrgdo-share-mk:
1541.86Slukem.if ${MKSHARE} != "no"
1551.117Smrg	(cd ${.CURDIR}/share/mk && ${MAKE} install)
1561.68Slukem.endif
1571.123Smrg
1581.123Smrgdo-cleandir:
1591.112Smrg.if !defined(UPDATE) && !defined(NOCLEANDIR)
1601.117Smrg	${MAKE} ${_J} ${_M} cleandir
1611.39Schristos.endif
1621.123Smrg
1631.123Smrgdo-make-obj:
1641.103Ssimonb.if ${MKOBJDIRS} != "no"
1651.122Ssommerfe	${MAKE} ${_J} ${_M} obj
1661.103Ssimonb.endif
1671.123Smrg
1681.123Smrgdo-check-egcs:
1691.115Sthorpej.if empty(HAVE_EGCS)
1701.71Smycroft.if defined(DESTDIR)
1711.71Smycroft	@echo "*** CAPUTE!"
1721.84Stv	@echo "    You attempted to compile the world without egcs.  You must"
1731.71Smycroft	@echo "    first install a native egcs compiler."
1741.84Stv	@false
1751.71Smycroft.else
1761.71Smycroft	(cd ${.CURDIR}/gnu/usr.bin/egcs && \
1771.112Smrg	    ${MAKE} ${_M} ${_J} dependall MKMAN=no && \
1781.112Smrg	    ${MAKE} ${_M} MKMAN=no install && ${MAKE} ${_M} cleandir)
1791.112Smrg.endif
1801.71Smycroft.endif
1811.123Smrg
1821.123Smrgdo-make-includes:
1831.112Smrg.if !defined(NOINCLUDES)
1841.112Smrg	${MAKE} ${_M} includes
1851.71Smycroft.endif
1861.123Smrg
1871.123Smrgdo-lib-csu:
1881.61Smycroft	(cd ${.CURDIR}/lib/csu && \
1891.113Smrg	    ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \
1901.113Smrg	    ${MAKE} ${_M} MKSHARE=no install)
1911.123Smrg
1921.123Smrgdo-lib:
1931.61Smycroft	(cd ${.CURDIR}/lib && \
1941.113Smrg	    ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \
1951.113Smrg	    ${MAKE} ${_M} MKSHARE=no install)
1961.123Smrg
1971.123Smrgdo-gnu-lib:
1981.61Smycroft	(cd ${.CURDIR}/gnu/lib && \
1991.113Smrg	    ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \
2001.113Smrg	    ${MAKE} ${_M} MKSHARE=no install)
2011.123Smrg
2021.123Smrgdo-dependall:
2031.112Smrg	${MAKE} ${_M} ${_J} dependall && ${MAKE} ${_M} _BUILD= install
2041.123Smrg
2051.123Smrgdo-domestic:
2061.97Schristos.if defined(DOMESTIC) && !defined(EXPORTABLE_SYSTEM)
2071.112Smrg	(cd ${.CURDIR}/${DOMESTIC} && ${MAKE} ${_M} ${_J} _SLAVE_BUILD= build)
2081.49Slukem.endif
2091.123Smrg
2101.123Smrgdo-whatisdb:
2111.112Smrg	${MAKE} ${_M} whatis.db
2121.87Scjs
2131.87Scjsrelease snapshot: build
2141.112Smrg	(cd ${.CURDIR}/etc && ${MAKE} ${_M} INSTALL_DONE=1 release)
2151.1Scgd
2161.1Scgd.include <bsd.subdir.mk>
217