Makefile revision 1.120
11.120Sfredb#	$NetBSD: Makefile,v 1.120 2000/08/19 22:09:08 fredb 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.108Serhbeforeinstall:
901.112Smrg.ifndef NODISTRIBDIRS
911.26Stls.ifndef DESTDIR
921.26Stls	(cd ${.CURDIR}/etc && ${MAKE} DESTDIR=/ distrib-dirs)
931.31Stls.else
941.117Smrg	(cd ${.CURDIR}/etc && ${MAKE} distrib-dirs)
951.26Stls.endif
961.112Smrg.endif
971.15Scgd
981.15Scgdafterinstall:
991.86Slukem.if ${MKMAN} != "no" && !defined(_BUILD)
1001.112Smrg	${MAKE} ${_M} whatis.db
1011.81Sscottr.endif
1021.81Sscottr
1031.81Sscottrwhatis.db:
1041.112Smrg	(cd ${.CURDIR}/share/man && ${MAKE} ${_M} makedb)
1051.15Scgd
1061.84Stv# wrt info/dir below:  It's safe to move this over top of /usr/share/info/dir,
1071.84Stv# as the build will automatically remove/replace the non-pkg entries there.
1081.84Stv
1091.110Sjlam.if defined(BUILD_DONE)
1101.110Sjlambuild:
1111.110Sjlam	@echo "Build installed into ${DESTDIR}"
1121.110Sjlam.else
1131.108Serhbuild: buildmsg beforeinstall
1141.96Sscottr.if defined(FORCE_DOMESTIC)
1151.96Sscottr	@echo '*** CAPUTE!'
1161.96Sscottr	@echo '    The FORCE_DOMESTIC flag is not compatible with "make build".'
1171.96Sscottr	@echo '    Please correct the problem and try again.'
1181.96Sscottr	@false
1191.96Sscottr.endif
1201.86Slukem.if ${MKSHARE} != "no"
1211.117Smrg	(cd ${.CURDIR}/share/mk && ${MAKE} install)
1221.68Slukem.endif
1231.112Smrg.if !defined(UPDATE) && !defined(NOCLEANDIR)
1241.117Smrg	${MAKE} ${_J} ${_M} cleandir
1251.39Schristos.endif
1261.103Ssimonb.if ${MKOBJDIRS} != "no"
1271.116Sthorpej	${MAKE} ${_M} obj
1281.103Ssimonb.endif
1291.115Sthorpej.if empty(HAVE_EGCS)
1301.71Smycroft.if defined(DESTDIR)
1311.71Smycroft	@echo "*** CAPUTE!"
1321.84Stv	@echo "    You attempted to compile the world without egcs.  You must"
1331.71Smycroft	@echo "    first install a native egcs compiler."
1341.84Stv	@false
1351.71Smycroft.else
1361.71Smycroft	(cd ${.CURDIR}/gnu/usr.bin/egcs && \
1371.112Smrg	    ${MAKE} ${_M} ${_J} dependall MKMAN=no && \
1381.112Smrg	    ${MAKE} ${_M} MKMAN=no install && ${MAKE} ${_M} cleandir)
1391.112Smrg.endif
1401.71Smycroft.endif
1411.112Smrg.if !defined(NOINCLUDES)
1421.112Smrg	${MAKE} ${_M} includes
1431.71Smycroft.endif
1441.61Smycroft	(cd ${.CURDIR}/lib/csu && \
1451.113Smrg	    ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \
1461.113Smrg	    ${MAKE} ${_M} MKSHARE=no install)
1471.61Smycroft	(cd ${.CURDIR}/lib && \
1481.113Smrg	    ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \
1491.113Smrg	    ${MAKE} ${_M} MKSHARE=no install)
1501.61Smycroft	(cd ${.CURDIR}/gnu/lib && \
1511.113Smrg	    ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \
1521.113Smrg	    ${MAKE} ${_M} MKSHARE=no install)
1531.112Smrg	${MAKE} ${_M} ${_J} dependall && ${MAKE} ${_M} _BUILD= install
1541.97Schristos.if defined(DOMESTIC) && !defined(EXPORTABLE_SYSTEM)
1551.112Smrg	(cd ${.CURDIR}/${DOMESTIC} && ${MAKE} ${_M} ${_J} _SLAVE_BUILD= build)
1561.49Slukem.endif
1571.112Smrg	${MAKE} ${_M} whatis.db
1581.50Smellon	@echo -n "Build finished at: "
1591.50Smellon	@date
1601.110Sjlam.endif
1611.87Scjs
1621.87Scjsrelease snapshot: build
1631.112Smrg	(cd ${.CURDIR}/etc && ${MAKE} ${_M} INSTALL_DONE=1 release)
1641.1Scgd
1651.1Scgd.include <bsd.subdir.mk>
166