Makefile revision 1.97
11.97Schristos#	$NetBSD: Makefile,v 1.97 1999/05/27 21:03:31 christos 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.95Scjs#   NBUILDJOBS is the number of jobs to start in parallel during a
191.95Scjs#	'make build'. It defaults to 1.
201.95Scjs#   MKMAN, if set to `no', will prevent building of manual pages.
211.95Scjs#   MKSHARE, if set to `no', will prevent building and installing
221.95Scjs#	anything in /usr/share.
231.95Scjs#   UPDATE will avoid a `make cleandir' at the start of `make build',
241.95Scjs#	as well as having the effects listed in /usr/share/mk/bsd.README.
251.95Scjs#   DESTDIR is the target directory for installation of the compiled
261.95Scjs#	software. It defaults to /. Note that programs are built against
271.95Scjs#	libraries installed in DESTDIR.
281.96Sscottr#   EXPORTABLE_SYSTEM, when set, ensures that non-exportable crypto code
291.96Sscottr#	is not compiled or installed. EXPORTABLE_SYSTEM is ignored if
301.97Schristos#	the `domestic/crypto-us' subtree does not exist.
311.97Schristos#   FORCE_DOMESTIC, when set, forces a descent into the domestic/crypto-us tree
321.96Sscottr#	when handling the `all', `includes', and `install' targets. This
331.96Sscottr#	flag is incompatible with the `build' target. It's generally a
341.96Sscottr#	bad idea to use FORCE_DOMESTIC unless the ramifications are well
351.96Sscottr#	understood, and should never be enabled by default. FORCE_DOMESTIC
361.97Schristos#	is ignored if the `domestic/crypto-us' subtree does not exist.
371.95Scjs#
381.95Scjs# Targets:
391.95Scjs#   build: builds a full release of netbsd in DESTDIR.
401.95Scjs#   release: does a `make build,' and then tars up the DESTDIR files
411.95Scjs#	into RELEASEDIR, in release(7) format. (See etc/Makefile for
421.95Scjs#	more information on this.)
431.95Scjs#   snapshot: a synonym for release.
441.32Scgd
451.32Scgd.include <bsd.own.mk>			# for configuration variables.
461.4Scgd
471.76Sbouyer
481.58StvHAVE_GCC28!=	${CXX} --version | egrep "^(2\.8|egcs)" ; echo
491.58Stv
501.76Sbouyer.if defined(NBUILDJOBS)
511.76Sbouyer_J= -j${NBUILDJOBS}
521.76Sbouyer.endif
531.76Sbouyer
541.4Scgd# NOTE THAT etc *DOES NOT* BELONG IN THE LIST BELOW
551.2Scgd
561.52SmycroftSUBDIR+= lib include bin libexec sbin usr.bin usr.sbin share sys
571.36Sexplorer
581.36Sexplorer.if exists(games)
591.36SexplorerSUBDIR+= games
601.36Sexplorer.endif
611.36Sexplorer
621.8ScgdSUBDIR+= gnu
631.52Smycroft# This is needed for libstdc++ and gen-params.
641.52Smycroftincludes-gnu: includes-include includes-sys
651.9Scgd
661.97Schristos# Descend into the domestic/crypto-us tree if it exists AND
671.82Sscottr#  1) the target is clean, cleandir, or obj, OR
681.93Sscottr#  2) the the target is install or includes AND
691.96Sscottr#     NOT compiling only "exportable" code AND
701.96Sscottr#     doing it as part of installing a distribution, OR
711.96Sscottr#  3) we Really Know what we're doing.  (Really!)
721.94Sscottr#
731.94Sscottr# NOTE:  due to the use of the make(foo) construct here, using the
741.94Sscottr# clean, cleandir, and obj targets on the command line in conjunction
751.94Sscottr# with any other target may produce unexpected results.
761.82Sscottr
771.97Schristos.if exists(domestic)
781.97SchristosDOMESTIC=domestic
791.97Schristos.elif exists(crypto-us)
801.97SchristosDOMESTIC=crypto-us
811.97Schristos.endif
821.97Schristos
831.97Schristos.if defined(DOMESTIC) && \
841.79Sscottr    (make(clean) || make(cleandir) || make(obj) || \
851.82Sscottr    ((make(includes) || make(install)) && \
861.96Sscottr	!defined(EXPORTABLE_SYSTEM) && defined(_DISTRIB)) || \
871.96Sscottr    defined(FORCE_DOMESTIC))
881.97SchristosSUBDIR+= ${DOMESTIC}
891.21Scgd.endif
901.21Scgd
911.13Sbrezak.if exists(regress)
921.9Scgd.ifmake !(install)
931.9ScgdSUBDIR+= regress
941.9Scgd.endif
951.9Scgd
961.10Scgdregression-tests:
971.10Scgd	@echo Running regression tests...
981.22Scgd	@(cd ${.CURDIR}/regress && ${MAKE} regress)
991.13Sbrezak.endif
1001.20Scgd
1011.26Stlsbeforeinstall:
1021.45Sperry.ifmake build
1031.45Sperry	@echo -n "Build started at: "
1041.45Sperry	@date
1051.45Sperry.endif
1061.26Stls.ifndef DESTDIR
1071.26Stls	(cd ${.CURDIR}/etc && ${MAKE} DESTDIR=/ distrib-dirs)
1081.31Stls.else
1091.31Stls	(cd ${.CURDIR}/etc && ${MAKE} distrib-dirs)
1101.26Stls.endif
1111.15Scgd
1121.15Scgdafterinstall:
1131.86Slukem.if ${MKMAN} != "no" && !defined(_BUILD)
1141.81Sscottr	${MAKE} whatis.db
1151.81Sscottr.endif
1161.81Sscottr
1171.81Sscottrwhatis.db:
1181.22Scgd	(cd ${.CURDIR}/share/man && ${MAKE} makedb)
1191.15Scgd
1201.84Stv# wrt info/dir below:  It's safe to move this over top of /usr/share/info/dir,
1211.84Stv# as the build will automatically remove/replace the non-pkg entries there.
1221.84Stv
1231.43Sthorpejbuild: beforeinstall
1241.96Sscottr.if defined(FORCE_DOMESTIC)
1251.96Sscottr	@echo '*** CAPUTE!'
1261.96Sscottr	@echo '    The FORCE_DOMESTIC flag is not compatible with "make build".'
1271.96Sscottr	@echo '    Please correct the problem and try again.'
1281.96Sscottr	@false
1291.96Sscottr.endif
1301.86Slukem.if ${MKSHARE} != "no"
1311.32Scgd	(cd ${.CURDIR}/share/mk && ${MAKE} install)
1321.47Sthorpej	(cd ${.CURDIR}/share/tmac && ${MAKE} && ${MAKE} install)
1331.68Slukem.endif
1341.39Schristos.if !defined(UPDATE)
1351.17Scgd	${MAKE} cleandir
1361.39Schristos.endif
1371.75Stv.if empty(HAVE_GCC28)
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.86Slukem	    ${MAKE} depend && ${MAKE} ${_J} MKMAN=no && \
1461.86Slukem	    ${MAKE} MKMAN=no install && ${MAKE} cleandir)
1471.71Smycroft.endif
1481.71Smycroft.endif
1491.93Sscottr	${MAKE} includes
1501.61Smycroft	(cd ${.CURDIR}/lib/csu && \
1511.86Slukem	    ${MAKE} depend && ${MAKE} ${_J} MKMAN=no && \
1521.86Slukem	    ${MAKE} MKMAN=no install)
1531.61Smycroft	(cd ${.CURDIR}/lib && \
1541.86Slukem	    ${MAKE} depend && ${MAKE} ${_J} MKMAN=no && \
1551.86Slukem	    ${MAKE} MKMAN=no install)
1561.61Smycroft	(cd ${.CURDIR}/gnu/lib && \
1571.89Smellon	    ${MAKE} depend && ${MAKE} ${_J} MKMAN=no MKINFO=no && \
1581.89Smellon	    ${MAKE} MKMAN=no MKINFO=no install)
1591.80Sscottr	${MAKE} depend && ${MAKE} ${_J} && ${MAKE} _BUILD= install
1601.97Schristos.if defined(DOMESTIC) && !defined(EXPORTABLE_SYSTEM)
1611.97Schristos	(cd ${.CURDIR}/${DOMESTIC} && ${MAKE} ${_J} _SLAVE_BUILD= build)
1621.49Slukem.endif
1631.81Sscottr	${MAKE} whatis.db
1641.50Smellon	@echo -n "Build finished at: "
1651.50Smellon	@date
1661.87Scjs
1671.87Scjsrelease snapshot: build
1681.91Sscottr	(cd ${.CURDIR}/etc && ${MAKE} INSTALL_DONE=1 release)
1691.1Scgd
1701.1Scgd.include <bsd.subdir.mk>
171