Makefile revision 1.118
11.118Sthorpej#	$NetBSD: Makefile,v 1.118 2000/06/20 06:00:24 thorpej 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.118Sthorpej.include <bsd.own.mk>
401.4Scgd
411.100SsommerfeMKOBJDIRS ?= no
421.115SthorpejHAVE_EGCS!=	${CXX} --version | egrep "^(2\.[89]|egcs)" ; echo
431.58Stv
441.76Sbouyer.if defined(NBUILDJOBS)
451.76Sbouyer_J= -j${NBUILDJOBS}
461.76Sbouyer.endif
471.76Sbouyer
481.112Smrg.if defined(DESTDIR)
491.112Smrg_M=-m ${DESTDIR}/usr/share/mk
501.112Smrg.endif
511.112Smrg
521.4Scgd# NOTE THAT etc *DOES NOT* BELONG IN THE LIST BELOW
531.2Scgd
541.52SmycroftSUBDIR+= lib include bin libexec sbin usr.bin usr.sbin share sys
551.109Scjs.if make(obj)
561.109ScjsSUBDIR+= distrib
571.114Ssjg.ifdef MAKEOBJDIRPREFIX
581.114SsjgSUBDIR+= etc
591.114Ssjg.endif
601.109Scjs.endif
611.105Sassar
621.105Sassarincludes-lib: includes-include includes-sys
631.36Sexplorer
641.36Sexplorer.if exists(games)
651.36SexplorerSUBDIR+= games
661.36Sexplorer.endif
671.36Sexplorer
681.8ScgdSUBDIR+= gnu
691.52Smycroft# This is needed for libstdc++ and gen-params.
701.52Smycroftincludes-gnu: includes-include includes-sys
711.21Scgd
721.13Sbrezak.if exists(regress)
731.9Scgd.ifmake !(install)
741.9ScgdSUBDIR+= regress
751.9Scgd.endif
761.9Scgd
771.10Scgdregression-tests:
781.10Scgd	@echo Running regression tests...
791.112Smrg	@(cd ${.CURDIR}/regress && ${MAKE} ${_M} regress)
801.13Sbrezak.endif
811.20Scgd
821.108Serhbuildmsg:
831.45Sperry	@echo -n "Build started at: "
841.45Sperry	@date
851.108Serh
861.108Serhbeforeinstall:
871.112Smrg.ifndef NODISTRIBDIRS
881.26Stls.ifndef DESTDIR
891.26Stls	(cd ${.CURDIR}/etc && ${MAKE} DESTDIR=/ distrib-dirs)
901.31Stls.else
911.117Smrg	(cd ${.CURDIR}/etc && ${MAKE} distrib-dirs)
921.26Stls.endif
931.112Smrg.endif
941.15Scgd
951.15Scgdafterinstall:
961.86Slukem.if ${MKMAN} != "no" && !defined(_BUILD)
971.112Smrg	${MAKE} ${_M} whatis.db
981.81Sscottr.endif
991.81Sscottr
1001.81Sscottrwhatis.db:
1011.112Smrg	(cd ${.CURDIR}/share/man && ${MAKE} ${_M} makedb)
1021.15Scgd
1031.84Stv# wrt info/dir below:  It's safe to move this over top of /usr/share/info/dir,
1041.84Stv# as the build will automatically remove/replace the non-pkg entries there.
1051.84Stv
1061.110Sjlam.if defined(BUILD_DONE)
1071.110Sjlambuild:
1081.110Sjlam	@echo "Build installed into ${DESTDIR}"
1091.110Sjlam.else
1101.108Serhbuild: buildmsg beforeinstall
1111.96Sscottr.if defined(FORCE_DOMESTIC)
1121.96Sscottr	@echo '*** CAPUTE!'
1131.96Sscottr	@echo '    The FORCE_DOMESTIC flag is not compatible with "make build".'
1141.96Sscottr	@echo '    Please correct the problem and try again.'
1151.96Sscottr	@false
1161.96Sscottr.endif
1171.86Slukem.if ${MKSHARE} != "no"
1181.117Smrg	(cd ${.CURDIR}/share/mk && ${MAKE} install)
1191.68Slukem.endif
1201.112Smrg.if !defined(UPDATE) && !defined(NOCLEANDIR)
1211.117Smrg	${MAKE} ${_J} ${_M} cleandir
1221.39Schristos.endif
1231.103Ssimonb.if ${MKOBJDIRS} != "no"
1241.116Sthorpej	${MAKE} ${_M} obj
1251.103Ssimonb.endif
1261.115Sthorpej.if empty(HAVE_EGCS)
1271.71Smycroft.if defined(DESTDIR)
1281.71Smycroft	@echo "*** CAPUTE!"
1291.84Stv	@echo "    You attempted to compile the world without egcs.  You must"
1301.71Smycroft	@echo "    first install a native egcs compiler."
1311.84Stv	@false
1321.71Smycroft.else
1331.71Smycroft	(cd ${.CURDIR}/gnu/usr.bin/egcs && \
1341.112Smrg	    ${MAKE} ${_M} ${_J} dependall MKMAN=no && \
1351.112Smrg	    ${MAKE} ${_M} MKMAN=no install && ${MAKE} ${_M} cleandir)
1361.112Smrg.endif
1371.71Smycroft.endif
1381.112Smrg.if !defined(NOINCLUDES)
1391.112Smrg	${MAKE} ${_M} includes
1401.71Smycroft.endif
1411.61Smycroft	(cd ${.CURDIR}/lib/csu && \
1421.113Smrg	    ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \
1431.113Smrg	    ${MAKE} ${_M} MKSHARE=no install)
1441.61Smycroft	(cd ${.CURDIR}/lib && \
1451.113Smrg	    ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \
1461.113Smrg	    ${MAKE} ${_M} MKSHARE=no install)
1471.61Smycroft	(cd ${.CURDIR}/gnu/lib && \
1481.113Smrg	    ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \
1491.113Smrg	    ${MAKE} ${_M} MKSHARE=no install)
1501.112Smrg	${MAKE} ${_M} ${_J} dependall && ${MAKE} ${_M} _BUILD= install
1511.97Schristos.if defined(DOMESTIC) && !defined(EXPORTABLE_SYSTEM)
1521.112Smrg	(cd ${.CURDIR}/${DOMESTIC} && ${MAKE} ${_M} ${_J} _SLAVE_BUILD= build)
1531.49Slukem.endif
1541.112Smrg	${MAKE} ${_M} whatis.db
1551.50Smellon	@echo -n "Build finished at: "
1561.50Smellon	@date
1571.110Sjlam.endif
1581.87Scjs
1591.87Scjsrelease snapshot: build
1601.112Smrg	(cd ${.CURDIR}/etc && ${MAKE} ${_M} INSTALL_DONE=1 release)
1611.1Scgd
1621.1Scgd.include <bsd.subdir.mk>
163