Makefile revision 1.112
11.112Smrg#	$NetBSD: Makefile,v 1.112 2000/04/10 14:47:22 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.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.109Scjs.endif
631.105Sassar
641.105Sassarincludes-lib: includes-include includes-sys
651.36Sexplorer
661.36Sexplorer.if exists(games)
671.36SexplorerSUBDIR+= games
681.36Sexplorer.endif
691.36Sexplorer
701.8ScgdSUBDIR+= gnu
711.52Smycroft# This is needed for libstdc++ and gen-params.
721.52Smycroftincludes-gnu: includes-include includes-sys
731.21Scgd
741.13Sbrezak.if exists(regress)
751.9Scgd.ifmake !(install)
761.9ScgdSUBDIR+= regress
771.9Scgd.endif
781.9Scgd
791.10Scgdregression-tests:
801.10Scgd	@echo Running regression tests...
811.112Smrg	@(cd ${.CURDIR}/regress && ${MAKE} ${_M} regress)
821.13Sbrezak.endif
831.20Scgd
841.108Serhbuildmsg:
851.45Sperry	@echo -n "Build started at: "
861.45Sperry	@date
871.108Serh
881.108Serhbeforeinstall:
891.112Smrg.ifndef NODISTRIBDIRS
901.26Stls.ifndef DESTDIR
911.26Stls	(cd ${.CURDIR}/etc && ${MAKE} DESTDIR=/ distrib-dirs)
921.31Stls.else
931.31Stls	(cd ${.CURDIR}/etc && ${MAKE} distrib-dirs)
941.26Stls.endif
951.112Smrg.endif
961.15Scgd
971.15Scgdafterinstall:
981.86Slukem.if ${MKMAN} != "no" && !defined(_BUILD)
991.112Smrg	${MAKE} ${_M} whatis.db
1001.81Sscottr.endif
1011.81Sscottr
1021.81Sscottrwhatis.db:
1031.112Smrg	(cd ${.CURDIR}/share/man && ${MAKE} ${_M} makedb)
1041.15Scgd
1051.84Stv# wrt info/dir below:  It's safe to move this over top of /usr/share/info/dir,
1061.84Stv# as the build will automatically remove/replace the non-pkg entries there.
1071.84Stv
1081.110Sjlam.if defined(BUILD_DONE)
1091.110Sjlambuild:
1101.110Sjlam	@echo "Build installed into ${DESTDIR}"
1111.110Sjlam.else
1121.108Serhbuild: buildmsg beforeinstall
1131.96Sscottr.if defined(FORCE_DOMESTIC)
1141.96Sscottr	@echo '*** CAPUTE!'
1151.96Sscottr	@echo '    The FORCE_DOMESTIC flag is not compatible with "make build".'
1161.96Sscottr	@echo '    Please correct the problem and try again.'
1171.96Sscottr	@false
1181.96Sscottr.endif
1191.86Slukem.if ${MKSHARE} != "no"
1201.32Scgd	(cd ${.CURDIR}/share/mk && ${MAKE} install)
1211.68Slukem.endif
1221.112Smrg.if !defined(UPDATE) && !defined(NOCLEANDIR)
1231.112Smrg	${MAKE} ${_M} cleandir
1241.39Schristos.endif
1251.103Ssimonb.if ${MKOBJDIRS} != "no"
1261.103Ssimonb	${MAKE} obj
1271.103Ssimonb.endif
1281.75Stv.if empty(HAVE_GCC28)
1291.71Smycroft.if defined(DESTDIR)
1301.71Smycroft	@echo "*** CAPUTE!"
1311.84Stv	@echo "    You attempted to compile the world without egcs.  You must"
1321.71Smycroft	@echo "    first install a native egcs compiler."
1331.84Stv	@false
1341.71Smycroft.else
1351.71Smycroft	(cd ${.CURDIR}/gnu/usr.bin/egcs && \
1361.112Smrg	    ${MAKE} ${_M} ${_J} dependall MKMAN=no && \
1371.112Smrg	    ${MAKE} ${_M} MKMAN=no install && ${MAKE} ${_M} cleandir)
1381.112Smrg.endif
1391.71Smycroft.endif
1401.112Smrg.if !defined(NOINCLUDES)
1411.112Smrg	${MAKE} ${_M} includes
1421.71Smycroft.endif
1431.61Smycroft	(cd ${.CURDIR}/lib/csu && \
1441.112Smrg	    ${MAKE} ${_M} ${_J} MKMAN=no dependall && \
1451.112Smrg	    ${MAKE} ${_M} MKMAN=no install)
1461.61Smycroft	(cd ${.CURDIR}/lib && \
1471.112Smrg	    ${MAKE} ${_M} ${_J} MKMAN=no MKINFO=no dependall && \
1481.112Smrg	    ${MAKE} ${_M} MKMAN=no MKINFO=no install)
1491.61Smycroft	(cd ${.CURDIR}/gnu/lib && \
1501.112Smrg	    ${MAKE} ${_M} ${_J} MKMAN=no MKINFO=no dependall && \
1511.112Smrg	    ${MAKE} ${_M} MKMAN=no MKINFO=no install)
1521.106Saidan.if target(cryptobuild)
1531.112Smrg	${MAKE} ${_M} ${_J} cryptobuild
1541.103Ssimonb.endif
1551.112Smrg	${MAKE} ${_M} ${_J} dependall && ${MAKE} ${_M} _BUILD= install
1561.97Schristos.if defined(DOMESTIC) && !defined(EXPORTABLE_SYSTEM)
1571.112Smrg	(cd ${.CURDIR}/${DOMESTIC} && ${MAKE} ${_M} ${_J} _SLAVE_BUILD= build)
1581.49Slukem.endif
1591.112Smrg	${MAKE} ${_M} whatis.db
1601.50Smellon	@echo -n "Build finished at: "
1611.50Smellon	@date
1621.110Sjlam.endif
1631.87Scjs
1641.87Scjsrelease snapshot: build
1651.112Smrg	(cd ${.CURDIR}/etc && ${MAKE} ${_M} INSTALL_DONE=1 release)
1661.1Scgd
1671.1Scgd.include <bsd.subdir.mk>
168