Makefile revision 1.103
11.102Ssimonb#	$NetBSD: Makefile,v 1.103 1999/12/04 03:52:28 simonb 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.95Scjs#   build: builds a full release of netbsd in DESTDIR.
331.95Scjs#   release: does a `make build,' and then tars up the DESTDIR files
341.95Scjs#	into RELEASEDIR, in release(7) format. (See etc/Makefile for
351.95Scjs#	more information on this.)
361.95Scjs#   snapshot: a synonym for release.
371.32Scgd
381.32Scgd.include <bsd.own.mk>			# for configuration variables.
391.4Scgd
401.100SsommerfeMKOBJDIRS ?= no
411.58StvHAVE_GCC28!=	${CXX} --version | egrep "^(2\.8|egcs)" ; echo
421.58Stv
431.76Sbouyer.if defined(NBUILDJOBS)
441.76Sbouyer_J= -j${NBUILDJOBS}
451.76Sbouyer.endif
461.76Sbouyer
471.4Scgd# NOTE THAT etc *DOES NOT* BELONG IN THE LIST BELOW
481.2Scgd
491.52SmycroftSUBDIR+= lib include bin libexec sbin usr.bin usr.sbin share sys
501.36Sexplorer
511.36Sexplorer.if exists(games)
521.36SexplorerSUBDIR+= games
531.36Sexplorer.endif
541.36Sexplorer
551.8ScgdSUBDIR+= gnu
561.52Smycroft# This is needed for libstdc++ and gen-params.
571.52Smycroftincludes-gnu: includes-include includes-sys
581.21Scgd
591.13Sbrezak.if exists(regress)
601.9Scgd.ifmake !(install)
611.9ScgdSUBDIR+= regress
621.9Scgd.endif
631.9Scgd
641.10Scgdregression-tests:
651.10Scgd	@echo Running regression tests...
661.22Scgd	@(cd ${.CURDIR}/regress && ${MAKE} regress)
671.13Sbrezak.endif
681.20Scgd
691.26Stlsbeforeinstall:
701.45Sperry.ifmake build
711.45Sperry	@echo -n "Build started at: "
721.45Sperry	@date
731.45Sperry.endif
741.26Stls.ifndef DESTDIR
751.26Stls	(cd ${.CURDIR}/etc && ${MAKE} DESTDIR=/ distrib-dirs)
761.31Stls.else
771.31Stls	(cd ${.CURDIR}/etc && ${MAKE} distrib-dirs)
781.26Stls.endif
791.15Scgd
801.15Scgdafterinstall:
811.86Slukem.if ${MKMAN} != "no" && !defined(_BUILD)
821.81Sscottr	${MAKE} whatis.db
831.81Sscottr.endif
841.81Sscottr
851.81Sscottrwhatis.db:
861.22Scgd	(cd ${.CURDIR}/share/man && ${MAKE} makedb)
871.15Scgd
881.84Stv# wrt info/dir below:  It's safe to move this over top of /usr/share/info/dir,
891.84Stv# as the build will automatically remove/replace the non-pkg entries there.
901.84Stv
911.43Sthorpejbuild: beforeinstall
921.96Sscottr.if defined(FORCE_DOMESTIC)
931.96Sscottr	@echo '*** CAPUTE!'
941.96Sscottr	@echo '    The FORCE_DOMESTIC flag is not compatible with "make build".'
951.96Sscottr	@echo '    Please correct the problem and try again.'
961.96Sscottr	@false
971.96Sscottr.endif
981.86Slukem.if ${MKSHARE} != "no"
991.32Scgd	(cd ${.CURDIR}/share/mk && ${MAKE} install)
1001.68Slukem.endif
1011.39Schristos.if !defined(UPDATE)
1021.17Scgd	${MAKE} cleandir
1031.39Schristos.endif
1041.103Ssimonb.if ${MKOBJDIRS} != "no"
1051.103Ssimonb	${MAKE} obj
1061.103Ssimonb.endif
1071.75Stv.if empty(HAVE_GCC28)
1081.71Smycroft.if defined(DESTDIR)
1091.71Smycroft	@echo "*** CAPUTE!"
1101.84Stv	@echo "    You attempted to compile the world without egcs.  You must"
1111.71Smycroft	@echo "    first install a native egcs compiler."
1121.84Stv	@false
1131.71Smycroft.else
1141.71Smycroft	(cd ${.CURDIR}/gnu/usr.bin/egcs && \
1151.99Sperry	    ${MAKE} ${_J} dependall MKMAN=no && \
1161.86Slukem	    ${MAKE} MKMAN=no install && ${MAKE} cleandir)
1171.71Smycroft.endif
1181.71Smycroft.endif
1191.93Sscottr	${MAKE} includes
1201.61Smycroft	(cd ${.CURDIR}/lib/csu && \
1211.99Sperry	    ${MAKE} ${_J} dependall MKMAN=no && \
1221.86Slukem	    ${MAKE} MKMAN=no install)
1231.61Smycroft	(cd ${.CURDIR}/lib && \
1241.99Sperry	    ${MAKE} ${_J} dependall MKMAN=no && \
1251.86Slukem	    ${MAKE} MKMAN=no install)
1261.61Smycroft	(cd ${.CURDIR}/gnu/lib && \
1271.99Sperry	    ${MAKE} ${_J} dependall MKMAN=no MKINFO=no && \
1281.89Smellon	    ${MAKE} MKMAN=no MKINFO=no install)
1291.103Ssimonb.if ${MKSHARE} != "no"
1301.103Ssimonb	(cd ${.CURDIR}/share/tmac && ${MAKE} && ${MAKE} install)
1311.103Ssimonb.endif
1321.99Sperry	${MAKE} ${_J} dependall && ${MAKE} _BUILD= install
1331.97Schristos.if defined(DOMESTIC) && !defined(EXPORTABLE_SYSTEM)
1341.97Schristos	(cd ${.CURDIR}/${DOMESTIC} && ${MAKE} ${_J} _SLAVE_BUILD= build)
1351.49Slukem.endif
1361.81Sscottr	${MAKE} whatis.db
1371.50Smellon	@echo -n "Build finished at: "
1381.50Smellon	@date
1391.87Scjs
1401.87Scjsrelease snapshot: build
1411.91Sscottr	(cd ${.CURDIR}/etc && ${MAKE} INSTALL_DONE=1 release)
1421.1Scgd
1431.1Scgd.include <bsd.subdir.mk>
144