Makefile revision 1.96
11.96Sscottr#	$NetBSD: Makefile,v 1.96 1999/04/25 19:13:05 scottr 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.96Sscottr#	the `domestic' subtree does not exist.
311.96Sscottr#   FORCE_DOMESTIC, when set, forces a descent into the domestic 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.96Sscottr#	is ignored if the `domestic' 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.82Sscottr# Descend into the domestic 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.79Sscottr.if exists(domestic) && \
781.79Sscottr    (make(clean) || make(cleandir) || make(obj) || \
791.82Sscottr    ((make(includes) || make(install)) && \
801.96Sscottr	!defined(EXPORTABLE_SYSTEM) && defined(_DISTRIB)) || \
811.96Sscottr    defined(FORCE_DOMESTIC))
821.21ScgdSUBDIR+= domestic
831.21Scgd.endif
841.21Scgd
851.13Sbrezak.if exists(regress)
861.9Scgd.ifmake !(install)
871.9ScgdSUBDIR+= regress
881.9Scgd.endif
891.9Scgd
901.10Scgdregression-tests:
911.10Scgd	@echo Running regression tests...
921.22Scgd	@(cd ${.CURDIR}/regress && ${MAKE} regress)
931.13Sbrezak.endif
941.20Scgd
951.26Stlsbeforeinstall:
961.45Sperry.ifmake build
971.45Sperry	@echo -n "Build started at: "
981.45Sperry	@date
991.45Sperry.endif
1001.26Stls.ifndef DESTDIR
1011.26Stls	(cd ${.CURDIR}/etc && ${MAKE} DESTDIR=/ distrib-dirs)
1021.31Stls.else
1031.31Stls	(cd ${.CURDIR}/etc && ${MAKE} distrib-dirs)
1041.26Stls.endif
1051.15Scgd
1061.15Scgdafterinstall:
1071.86Slukem.if ${MKMAN} != "no" && !defined(_BUILD)
1081.81Sscottr	${MAKE} whatis.db
1091.81Sscottr.endif
1101.81Sscottr
1111.81Sscottrwhatis.db:
1121.22Scgd	(cd ${.CURDIR}/share/man && ${MAKE} makedb)
1131.15Scgd
1141.84Stv# wrt info/dir below:  It's safe to move this over top of /usr/share/info/dir,
1151.84Stv# as the build will automatically remove/replace the non-pkg entries there.
1161.84Stv
1171.43Sthorpejbuild: beforeinstall
1181.96Sscottr.if defined(FORCE_DOMESTIC)
1191.96Sscottr	@echo '*** CAPUTE!'
1201.96Sscottr	@echo '    The FORCE_DOMESTIC flag is not compatible with "make build".'
1211.96Sscottr	@echo '    Please correct the problem and try again.'
1221.96Sscottr	@false
1231.96Sscottr.endif
1241.86Slukem.if ${MKSHARE} != "no"
1251.32Scgd	(cd ${.CURDIR}/share/mk && ${MAKE} install)
1261.47Sthorpej	(cd ${.CURDIR}/share/tmac && ${MAKE} && ${MAKE} install)
1271.68Slukem.endif
1281.39Schristos.if !defined(UPDATE)
1291.17Scgd	${MAKE} cleandir
1301.39Schristos.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.86Slukem	    ${MAKE} depend && ${MAKE} ${_J} MKMAN=no && \
1401.86Slukem	    ${MAKE} MKMAN=no install && ${MAKE} cleandir)
1411.71Smycroft.endif
1421.71Smycroft.endif
1431.93Sscottr	${MAKE} includes
1441.61Smycroft	(cd ${.CURDIR}/lib/csu && \
1451.86Slukem	    ${MAKE} depend && ${MAKE} ${_J} MKMAN=no && \
1461.86Slukem	    ${MAKE} MKMAN=no install)
1471.61Smycroft	(cd ${.CURDIR}/lib && \
1481.86Slukem	    ${MAKE} depend && ${MAKE} ${_J} MKMAN=no && \
1491.86Slukem	    ${MAKE} MKMAN=no install)
1501.61Smycroft	(cd ${.CURDIR}/gnu/lib && \
1511.89Smellon	    ${MAKE} depend && ${MAKE} ${_J} MKMAN=no MKINFO=no && \
1521.89Smellon	    ${MAKE} MKMAN=no MKINFO=no install)
1531.80Sscottr	${MAKE} depend && ${MAKE} ${_J} && ${MAKE} _BUILD= install
1541.32Scgd.if exists(domestic) && !defined(EXPORTABLE_SYSTEM)
1551.78Sscottr	(cd ${.CURDIR}/domestic && ${MAKE} ${_J} _SLAVE_BUILD= build)
1561.49Slukem.endif
1571.81Sscottr	${MAKE} whatis.db
1581.50Smellon	@echo -n "Build finished at: "
1591.50Smellon	@date
1601.87Scjs
1611.87Scjsrelease snapshot: build
1621.91Sscottr	(cd ${.CURDIR}/etc && ${MAKE} INSTALL_DONE=1 release)
1631.1Scgd
1641.1Scgd.include <bsd.subdir.mk>
165