Makefile revision 1.95
11.95Scjs#	$NetBSD: Makefile,v 1.95 1999/04/01 02:49:12 cjs 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.95Scjs#
291.95Scjs# Targets:
301.95Scjs#   build: builds a full release of netbsd in DESTDIR.
311.95Scjs#   release: does a `make build,' and then tars up the DESTDIR files
321.95Scjs#	into RELEASEDIR, in release(7) format. (See etc/Makefile for
331.95Scjs#	more information on this.)
341.95Scjs#   snapshot: a synonym for release.
351.32Scgd
361.32Scgd.include <bsd.own.mk>			# for configuration variables.
371.4Scgd
381.76Sbouyer
391.58StvHAVE_GCC28!=	${CXX} --version | egrep "^(2\.8|egcs)" ; echo
401.58Stv
411.76Sbouyer.if defined(NBUILDJOBS)
421.76Sbouyer_J= -j${NBUILDJOBS}
431.76Sbouyer.endif
441.76Sbouyer
451.4Scgd# NOTE THAT etc *DOES NOT* BELONG IN THE LIST BELOW
461.2Scgd
471.52SmycroftSUBDIR+= lib include bin libexec sbin usr.bin usr.sbin share sys
481.36Sexplorer
491.36Sexplorer.if exists(games)
501.36SexplorerSUBDIR+= games
511.36Sexplorer.endif
521.36Sexplorer
531.8ScgdSUBDIR+= gnu
541.52Smycroft# This is needed for libstdc++ and gen-params.
551.52Smycroftincludes-gnu: includes-include includes-sys
561.9Scgd
571.82Sscottr# Descend into the domestic tree if it exists AND
581.82Sscottr#  1) the target is clean, cleandir, or obj, OR
591.93Sscottr#  2) the the target is install or includes AND
601.93Sscottr#    NOT compiling only "exportable" code AND
611.93Sscottr#    doing it as part of installing a distribution.
621.94Sscottr#
631.94Sscottr# NOTE:  due to the use of the make(foo) construct here, using the
641.94Sscottr# clean, cleandir, and obj targets on the command line in conjunction
651.94Sscottr# with any other target may produce unexpected results.
661.82Sscottr
671.79Sscottr.if exists(domestic) && \
681.79Sscottr    (make(clean) || make(cleandir) || make(obj) || \
691.82Sscottr    ((make(includes) || make(install)) && \
701.93Sscottr    !defined(EXPORTABLE_SYSTEM) && defined(_DISTRIB)))
711.21ScgdSUBDIR+= domestic
721.21Scgd.endif
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.22Scgd	@(cd ${.CURDIR}/regress && ${MAKE} regress)
821.13Sbrezak.endif
831.20Scgd
841.26Stlsbeforeinstall:
851.45Sperry.ifmake build
861.45Sperry	@echo -n "Build started at: "
871.45Sperry	@date
881.45Sperry.endif
891.26Stls.ifndef DESTDIR
901.26Stls	(cd ${.CURDIR}/etc && ${MAKE} DESTDIR=/ distrib-dirs)
911.31Stls.else
921.31Stls	(cd ${.CURDIR}/etc && ${MAKE} distrib-dirs)
931.26Stls.endif
941.15Scgd
951.15Scgdafterinstall:
961.86Slukem.if ${MKMAN} != "no" && !defined(_BUILD)
971.81Sscottr	${MAKE} whatis.db
981.81Sscottr.endif
991.81Sscottr
1001.81Sscottrwhatis.db:
1011.22Scgd	(cd ${.CURDIR}/share/man && ${MAKE} 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.43Sthorpejbuild: beforeinstall
1071.86Slukem.if ${MKSHARE} != "no"
1081.32Scgd	(cd ${.CURDIR}/share/mk && ${MAKE} install)
1091.47Sthorpej	(cd ${.CURDIR}/share/tmac && ${MAKE} && ${MAKE} install)
1101.68Slukem.endif
1111.39Schristos.if !defined(UPDATE)
1121.17Scgd	${MAKE} cleandir
1131.39Schristos.endif
1141.75Stv.if empty(HAVE_GCC28)
1151.71Smycroft.if defined(DESTDIR)
1161.71Smycroft	@echo "*** CAPUTE!"
1171.84Stv	@echo "    You attempted to compile the world without egcs.  You must"
1181.71Smycroft	@echo "    first install a native egcs compiler."
1191.84Stv	@false
1201.71Smycroft.else
1211.71Smycroft	(cd ${.CURDIR}/gnu/usr.bin/egcs && \
1221.86Slukem	    ${MAKE} depend && ${MAKE} ${_J} MKMAN=no && \
1231.86Slukem	    ${MAKE} MKMAN=no install && ${MAKE} cleandir)
1241.71Smycroft.endif
1251.71Smycroft.endif
1261.93Sscottr	${MAKE} includes
1271.61Smycroft	(cd ${.CURDIR}/lib/csu && \
1281.86Slukem	    ${MAKE} depend && ${MAKE} ${_J} MKMAN=no && \
1291.86Slukem	    ${MAKE} MKMAN=no install)
1301.61Smycroft	(cd ${.CURDIR}/lib && \
1311.86Slukem	    ${MAKE} depend && ${MAKE} ${_J} MKMAN=no && \
1321.86Slukem	    ${MAKE} MKMAN=no install)
1331.61Smycroft	(cd ${.CURDIR}/gnu/lib && \
1341.89Smellon	    ${MAKE} depend && ${MAKE} ${_J} MKMAN=no MKINFO=no && \
1351.89Smellon	    ${MAKE} MKMAN=no MKINFO=no install)
1361.80Sscottr	${MAKE} depend && ${MAKE} ${_J} && ${MAKE} _BUILD= install
1371.32Scgd.if exists(domestic) && !defined(EXPORTABLE_SYSTEM)
1381.78Sscottr	(cd ${.CURDIR}/domestic && ${MAKE} ${_J} _SLAVE_BUILD= build)
1391.49Slukem.endif
1401.81Sscottr	${MAKE} whatis.db
1411.50Smellon	@echo -n "Build finished at: "
1421.50Smellon	@date
1431.87Scjs
1441.87Scjsrelease snapshot: build
1451.91Sscottr	(cd ${.CURDIR}/etc && ${MAKE} INSTALL_DONE=1 release)
1461.1Scgd
1471.1Scgd.include <bsd.subdir.mk>
148