Makefile revision 1.99
1#	$NetBSD: Makefile,v 1.99 1999/09/14 01:32:43 perry Exp $
2
3# This is the top-level makefile for building NetBSD. For an outline of
4# how to build a snapshot or release, as well as other release engineering
5# information, see http://www.netbsd.org/developers/releng/index.html
6#
7# Not everything you can set or do is documented in this makefile. In
8# particular, you should review the files in /usr/share/mk (especially
9# bsd.README) for general information on building programs and writing
10# Makefiles within this structure, and see the comments in src/etc/Makefile
11# for further information on installation and release set options.
12#
13# Variables listed below can be set on the make command line (highest
14# priority), in /etc/mk.conf (middle priority), or in the environment
15# (lowest priority).
16#
17# Variables:
18#   NBUILDJOBS is the number of jobs to start in parallel during a
19#	'make build'. It defaults to 1.
20#   MKMAN, if set to `no', will prevent building of manual pages.
21#   MKSHARE, if set to `no', will prevent building and installing
22#	anything in /usr/share.
23#   UPDATE will avoid a `make cleandir' at the start of `make build',
24#	as well as having the effects listed in /usr/share/mk/bsd.README.
25#   DESTDIR is the target directory for installation of the compiled
26#	software. It defaults to /. Note that programs are built against
27#	libraries installed in DESTDIR.
28#
29# Targets:
30#   build: builds a full release of netbsd in DESTDIR.
31#   release: does a `make build,' and then tars up the DESTDIR files
32#	into RELEASEDIR, in release(7) format. (See etc/Makefile for
33#	more information on this.)
34#   snapshot: a synonym for release.
35
36.include <bsd.own.mk>			# for configuration variables.
37
38
39HAVE_GCC28!=	${CXX} --version | egrep "^(2\.8|egcs)" ; echo
40
41.if defined(NBUILDJOBS)
42_J= -j${NBUILDJOBS}
43.endif
44
45# NOTE THAT etc *DOES NOT* BELONG IN THE LIST BELOW
46
47SUBDIR+= lib include bin libexec sbin usr.bin usr.sbin share sys
48
49.if exists(games)
50SUBDIR+= games
51.endif
52
53SUBDIR+= gnu
54# This is needed for libstdc++ and gen-params.
55includes-gnu: includes-include includes-sys
56
57.if exists(regress)
58.ifmake !(install)
59SUBDIR+= regress
60.endif
61
62regression-tests:
63	@echo Running regression tests...
64	@(cd ${.CURDIR}/regress && ${MAKE} regress)
65.endif
66
67beforeinstall:
68.ifmake build
69	@echo -n "Build started at: "
70	@date
71.endif
72.ifndef DESTDIR
73	(cd ${.CURDIR}/etc && ${MAKE} DESTDIR=/ distrib-dirs)
74.else
75	(cd ${.CURDIR}/etc && ${MAKE} distrib-dirs)
76.endif
77
78afterinstall:
79.if ${MKMAN} != "no" && !defined(_BUILD)
80	${MAKE} whatis.db
81.endif
82
83whatis.db:
84	(cd ${.CURDIR}/share/man && ${MAKE} makedb)
85
86# wrt info/dir below:  It's safe to move this over top of /usr/share/info/dir,
87# as the build will automatically remove/replace the non-pkg entries there.
88
89build: beforeinstall
90.if defined(FORCE_DOMESTIC)
91	@echo '*** CAPUTE!'
92	@echo '    The FORCE_DOMESTIC flag is not compatible with "make build".'
93	@echo '    Please correct the problem and try again.'
94	@false
95.endif
96.if ${MKSHARE} != "no"
97	(cd ${.CURDIR}/share/mk && ${MAKE} install)
98	(cd ${.CURDIR}/share/tmac && ${MAKE} && ${MAKE} install)
99.endif
100.if !defined(UPDATE)
101	${MAKE} cleandir
102.endif
103.if empty(HAVE_GCC28)
104.if defined(DESTDIR)
105	@echo "*** CAPUTE!"
106	@echo "    You attempted to compile the world without egcs.  You must"
107	@echo "    first install a native egcs compiler."
108	@false
109.else
110	(cd ${.CURDIR}/gnu/usr.bin/egcs && \
111	    ${MAKE} ${_J} dependall MKMAN=no && \
112	    ${MAKE} MKMAN=no install && ${MAKE} cleandir)
113.endif
114.endif
115	${MAKE} includes
116	(cd ${.CURDIR}/lib/csu && \
117	    ${MAKE} ${_J} dependall MKMAN=no && \
118	    ${MAKE} MKMAN=no install)
119	(cd ${.CURDIR}/lib && \
120	    ${MAKE} ${_J} dependall MKMAN=no && \
121	    ${MAKE} MKMAN=no install)
122	(cd ${.CURDIR}/gnu/lib && \
123	    ${MAKE} ${_J} dependall MKMAN=no MKINFO=no && \
124	    ${MAKE} MKMAN=no MKINFO=no install)
125	${MAKE} ${_J} dependall && ${MAKE} _BUILD= install
126.if defined(DOMESTIC) && !defined(EXPORTABLE_SYSTEM)
127	(cd ${.CURDIR}/${DOMESTIC} && ${MAKE} ${_J} _SLAVE_BUILD= build)
128.endif
129	${MAKE} whatis.db
130	@echo -n "Build finished at: "
131	@date
132
133release snapshot: build
134	(cd ${.CURDIR}/etc && ${MAKE} INSTALL_DONE=1 release)
135
136.include <bsd.subdir.mk>
137