Makefile revision 1.114
11.114Ssjg#	$NetBSD: Makefile,v 1.114 2000/05/06 07:53:53 sjg 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.95Scjs#
311.95Scjs# Targets:
321.110Sjlam#   build: builds a full release of netbsd in DESTDIR. If BUILD_DONE is
331.110Sjlam#	set, this is an empty target.
341.95Scjs#   release: does a `make build,' and then tars up the DESTDIR files
351.95Scjs#	into RELEASEDIR, in release(7) format. (See etc/Makefile for
361.95Scjs#	more information on this.)
371.95Scjs#   snapshot: a synonym for release.
381.32Scgd
391.106SaidanSRCTOP=.
401.106Saidan.include <bsd.crypto.mk>		# for configuration variables.
411.106Saidan
421.106Saidan.if defined(CRYPTOPATH)
431.106Saidan.sinclude "${CRYPTOPATH}/Makefile.frag"
441.106Saidan.endif
451.4Scgd
461.100SsommerfeMKOBJDIRS ?= no
471.58StvHAVE_GCC28!=	${CXX} --version | egrep "^(2\.8|egcs)" ; echo
481.58Stv
491.76Sbouyer.if defined(NBUILDJOBS)
501.76Sbouyer_J= -j${NBUILDJOBS}
511.76Sbouyer.endif
521.76Sbouyer
531.112Smrg.if defined(DESTDIR)
541.112Smrg_M=-m ${DESTDIR}/usr/share/mk
551.112Smrg.endif
561.112Smrg
571.4Scgd# NOTE THAT etc *DOES NOT* BELONG IN THE LIST BELOW
581.2Scgd
591.52SmycroftSUBDIR+= lib include bin libexec sbin usr.bin usr.sbin share sys
601.109Scjs.if make(obj)
611.109ScjsSUBDIR+= distrib
621.114Ssjg.ifdef MAKEOBJDIRPREFIX
631.114SsjgSUBDIR+= etc
641.114Ssjg.endif
651.109Scjs.endif
661.105Sassar
671.105Sassarincludes-lib: includes-include includes-sys
681.36Sexplorer
691.36Sexplorer.if exists(games)
701.36SexplorerSUBDIR+= games
711.36Sexplorer.endif
721.36Sexplorer
731.8ScgdSUBDIR+= gnu
741.52Smycroft# This is needed for libstdc++ and gen-params.
751.52Smycroftincludes-gnu: includes-include includes-sys
761.21Scgd
771.13Sbrezak.if exists(regress)
781.9Scgd.ifmake !(install)
791.9ScgdSUBDIR+= regress
801.9Scgd.endif
811.9Scgd
821.10Scgdregression-tests:
831.10Scgd	@echo Running regression tests...
841.112Smrg	@(cd ${.CURDIR}/regress && ${MAKE} ${_M} regress)
851.13Sbrezak.endif
861.20Scgd
871.108Serhbuildmsg:
881.45Sperry	@echo -n "Build started at: "
891.45Sperry	@date
901.108Serh
911.108Serhbeforeinstall:
921.112Smrg.ifndef NODISTRIBDIRS
931.26Stls.ifndef DESTDIR
941.26Stls	(cd ${.CURDIR}/etc && ${MAKE} DESTDIR=/ distrib-dirs)
951.31Stls.else
961.31Stls	(cd ${.CURDIR}/etc && ${MAKE} distrib-dirs)
971.26Stls.endif
981.112Smrg.endif
991.15Scgd
1001.15Scgdafterinstall:
1011.86Slukem.if ${MKMAN} != "no" && !defined(_BUILD)
1021.112Smrg	${MAKE} ${_M} whatis.db
1031.81Sscottr.endif
1041.81Sscottr
1051.81Sscottrwhatis.db:
1061.112Smrg	(cd ${.CURDIR}/share/man && ${MAKE} ${_M} makedb)
1071.15Scgd
1081.84Stv# wrt info/dir below:  It's safe to move this over top of /usr/share/info/dir,
1091.84Stv# as the build will automatically remove/replace the non-pkg entries there.
1101.84Stv
1111.110Sjlam.if defined(BUILD_DONE)
1121.110Sjlambuild:
1131.110Sjlam	@echo "Build installed into ${DESTDIR}"
1141.110Sjlam.else
1151.108Serhbuild: buildmsg beforeinstall
1161.96Sscottr.if defined(FORCE_DOMESTIC)
1171.96Sscottr	@echo '*** CAPUTE!'
1181.96Sscottr	@echo '    The FORCE_DOMESTIC flag is not compatible with "make build".'
1191.96Sscottr	@echo '    Please correct the problem and try again.'
1201.96Sscottr	@false
1211.96Sscottr.endif
1221.86Slukem.if ${MKSHARE} != "no"
1231.32Scgd	(cd ${.CURDIR}/share/mk && ${MAKE} install)
1241.68Slukem.endif
1251.112Smrg.if !defined(UPDATE) && !defined(NOCLEANDIR)
1261.112Smrg	${MAKE} ${_M} cleandir
1271.39Schristos.endif
1281.103Ssimonb.if ${MKOBJDIRS} != "no"
1291.103Ssimonb	${MAKE} obj
1301.103Ssimonb.endif
1311.75Stv.if empty(HAVE_GCC28)
1321.71Smycroft.if defined(DESTDIR)
1331.71Smycroft	@echo "*** CAPUTE!"
1341.84Stv	@echo "    You attempted to compile the world without egcs.  You must"
1351.71Smycroft	@echo "    first install a native egcs compiler."
1361.84Stv	@false
1371.71Smycroft.else
1381.71Smycroft	(cd ${.CURDIR}/gnu/usr.bin/egcs && \
1391.112Smrg	    ${MAKE} ${_M} ${_J} dependall MKMAN=no && \
1401.112Smrg	    ${MAKE} ${_M} MKMAN=no install && ${MAKE} ${_M} cleandir)
1411.112Smrg.endif
1421.71Smycroft.endif
1431.112Smrg.if !defined(NOINCLUDES)
1441.112Smrg	${MAKE} ${_M} includes
1451.71Smycroft.endif
1461.61Smycroft	(cd ${.CURDIR}/lib/csu && \
1471.113Smrg	    ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \
1481.113Smrg	    ${MAKE} ${_M} MKSHARE=no install)
1491.61Smycroft	(cd ${.CURDIR}/lib && \
1501.113Smrg	    ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \
1511.113Smrg	    ${MAKE} ${_M} MKSHARE=no install)
1521.61Smycroft	(cd ${.CURDIR}/gnu/lib && \
1531.113Smrg	    ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \
1541.113Smrg	    ${MAKE} ${_M} MKSHARE=no install)
1551.106Saidan.if target(cryptobuild)
1561.112Smrg	${MAKE} ${_M} ${_J} cryptobuild
1571.103Ssimonb.endif
1581.112Smrg	${MAKE} ${_M} ${_J} dependall && ${MAKE} ${_M} _BUILD= install
1591.97Schristos.if defined(DOMESTIC) && !defined(EXPORTABLE_SYSTEM)
1601.112Smrg	(cd ${.CURDIR}/${DOMESTIC} && ${MAKE} ${_M} ${_J} _SLAVE_BUILD= build)
1611.49Slukem.endif
1621.112Smrg	${MAKE} ${_M} whatis.db
1631.50Smellon	@echo -n "Build finished at: "
1641.50Smellon	@date
1651.110Sjlam.endif
1661.87Scjs
1671.87Scjsrelease snapshot: build
1681.112Smrg	(cd ${.CURDIR}/etc && ${MAKE} ${_M} INSTALL_DONE=1 release)
1691.1Scgd
1701.1Scgd.include <bsd.subdir.mk>
171