Makefile revision 1.121
11.121Sdeberg#	$NetBSD: Makefile,v 1.121 2000/10/07 17:18:17 deberg 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.32Scgd
421.118Sthorpej.include <bsd.own.mk>
431.4Scgd
441.100SsommerfeMKOBJDIRS ?= no
451.115SthorpejHAVE_EGCS!=	${CXX} --version | egrep "^(2\.[89]|egcs)" ; echo
461.58Stv
471.76Sbouyer.if defined(NBUILDJOBS)
481.76Sbouyer_J= -j${NBUILDJOBS}
491.76Sbouyer.endif
501.76Sbouyer
511.112Smrg.if defined(DESTDIR)
521.112Smrg_M=-m ${DESTDIR}/usr/share/mk
531.112Smrg.endif
541.112Smrg
551.4Scgd# NOTE THAT etc *DOES NOT* BELONG IN THE LIST BELOW
561.2Scgd
571.52SmycroftSUBDIR+= lib include bin libexec sbin usr.bin usr.sbin share sys
581.120Sfredb.if make(cleandir) || make(obj)
591.109ScjsSUBDIR+= distrib
601.114Ssjg.ifdef MAKEOBJDIRPREFIX
611.114SsjgSUBDIR+= etc
621.114Ssjg.endif
631.109Scjs.endif
641.105Sassar
651.105Sassarincludes-lib: includes-include includes-sys
661.36Sexplorer
671.36Sexplorer.if exists(games)
681.36SexplorerSUBDIR+= games
691.36Sexplorer.endif
701.36Sexplorer
711.8ScgdSUBDIR+= gnu
721.52Smycroft# This is needed for libstdc++ and gen-params.
731.52Smycroftincludes-gnu: includes-include includes-sys
741.21Scgd
751.13Sbrezak.if exists(regress)
761.9Scgd.ifmake !(install)
771.9ScgdSUBDIR+= regress
781.9Scgd.endif
791.9Scgd
801.10Scgdregression-tests:
811.10Scgd	@echo Running regression tests...
821.112Smrg	@(cd ${.CURDIR}/regress && ${MAKE} ${_M} regress)
831.13Sbrezak.endif
841.20Scgd
851.108Serhbuildmsg:
861.45Sperry	@echo -n "Build started at: "
871.45Sperry	@date
881.108Serh
891.121Sdeberg# If sharesrc is around, use its share/mk files to bootstrap until the
901.121Sdeberg# mk files are installed (first step of make build).  If installing to
911.121Sdeberg# DESTDIR, don't bother, since the build will fail later on anyway.
921.121Sdeberg
931.108Serhbeforeinstall:
941.112Smrg.ifndef NODISTRIBDIRS
951.26Stls.ifndef DESTDIR
961.121Sdeberg.if exists(share/mk)
971.121Sdeberg	(cd ${.CURDIR}/etc && ${MAKE} -m ${.CURDIR}/share/mk DESTDIR=/ distrib-dirs)
981.121Sdeberg.else
991.26Stls	(cd ${.CURDIR}/etc && ${MAKE} DESTDIR=/ distrib-dirs)
1001.121Sdeberg.endif
1011.31Stls.else
1021.117Smrg	(cd ${.CURDIR}/etc && ${MAKE} distrib-dirs)
1031.26Stls.endif
1041.112Smrg.endif
1051.15Scgd
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.108Serhbuild: buildmsg beforeinstall
1221.96Sscottr.if defined(FORCE_DOMESTIC)
1231.96Sscottr	@echo '*** CAPUTE!'
1241.96Sscottr	@echo '    The FORCE_DOMESTIC flag is not compatible with "make build".'
1251.96Sscottr	@echo '    Please correct the problem and try again.'
1261.96Sscottr	@false
1271.96Sscottr.endif
1281.86Slukem.if ${MKSHARE} != "no"
1291.117Smrg	(cd ${.CURDIR}/share/mk && ${MAKE} install)
1301.68Slukem.endif
1311.112Smrg.if !defined(UPDATE) && !defined(NOCLEANDIR)
1321.117Smrg	${MAKE} ${_J} ${_M} cleandir
1331.39Schristos.endif
1341.103Ssimonb.if ${MKOBJDIRS} != "no"
1351.116Sthorpej	${MAKE} ${_M} obj
1361.103Ssimonb.endif
1371.115Sthorpej.if empty(HAVE_EGCS)
1381.71Smycroft.if defined(DESTDIR)
1391.71Smycroft	@echo "*** CAPUTE!"
1401.84Stv	@echo "    You attempted to compile the world without egcs.  You must"
1411.71Smycroft	@echo "    first install a native egcs compiler."
1421.84Stv	@false
1431.71Smycroft.else
1441.71Smycroft	(cd ${.CURDIR}/gnu/usr.bin/egcs && \
1451.112Smrg	    ${MAKE} ${_M} ${_J} dependall MKMAN=no && \
1461.112Smrg	    ${MAKE} ${_M} MKMAN=no install && ${MAKE} ${_M} cleandir)
1471.112Smrg.endif
1481.71Smycroft.endif
1491.112Smrg.if !defined(NOINCLUDES)
1501.112Smrg	${MAKE} ${_M} includes
1511.71Smycroft.endif
1521.61Smycroft	(cd ${.CURDIR}/lib/csu && \
1531.113Smrg	    ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \
1541.113Smrg	    ${MAKE} ${_M} MKSHARE=no install)
1551.61Smycroft	(cd ${.CURDIR}/lib && \
1561.113Smrg	    ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \
1571.113Smrg	    ${MAKE} ${_M} MKSHARE=no install)
1581.61Smycroft	(cd ${.CURDIR}/gnu/lib && \
1591.113Smrg	    ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \
1601.113Smrg	    ${MAKE} ${_M} MKSHARE=no install)
1611.112Smrg	${MAKE} ${_M} ${_J} dependall && ${MAKE} ${_M} _BUILD= install
1621.97Schristos.if defined(DOMESTIC) && !defined(EXPORTABLE_SYSTEM)
1631.112Smrg	(cd ${.CURDIR}/${DOMESTIC} && ${MAKE} ${_M} ${_J} _SLAVE_BUILD= build)
1641.49Slukem.endif
1651.112Smrg	${MAKE} ${_M} whatis.db
1661.50Smellon	@echo -n "Build finished at: "
1671.50Smellon	@date
1681.110Sjlam.endif
1691.87Scjs
1701.87Scjsrelease snapshot: build
1711.112Smrg	(cd ${.CURDIR}/etc && ${MAKE} ${_M} INSTALL_DONE=1 release)
1721.1Scgd
1731.1Scgd.include <bsd.subdir.mk>
174