Makefile revision 1.95
1#	$NetBSD: Makefile,v 1.95 1999/04/01 02:49:12 cjs 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# Descend into the domestic tree if it exists AND
58#  1) the target is clean, cleandir, or obj, OR
59#  2) the the target is install or includes AND
60#    NOT compiling only "exportable" code AND
61#    doing it as part of installing a distribution.
62#
63# NOTE:  due to the use of the make(foo) construct here, using the
64# clean, cleandir, and obj targets on the command line in conjunction
65# with any other target may produce unexpected results.
66
67.if exists(domestic) && \
68    (make(clean) || make(cleandir) || make(obj) || \
69    ((make(includes) || make(install)) && \
70    !defined(EXPORTABLE_SYSTEM) && defined(_DISTRIB)))
71SUBDIR+= domestic
72.endif
73
74.if exists(regress)
75.ifmake !(install)
76SUBDIR+= regress
77.endif
78
79regression-tests:
80	@echo Running regression tests...
81	@(cd ${.CURDIR}/regress && ${MAKE} regress)
82.endif
83
84beforeinstall:
85.ifmake build
86	@echo -n "Build started at: "
87	@date
88.endif
89.ifndef DESTDIR
90	(cd ${.CURDIR}/etc && ${MAKE} DESTDIR=/ distrib-dirs)
91.else
92	(cd ${.CURDIR}/etc && ${MAKE} distrib-dirs)
93.endif
94
95afterinstall:
96.if ${MKMAN} != "no" && !defined(_BUILD)
97	${MAKE} whatis.db
98.endif
99
100whatis.db:
101	(cd ${.CURDIR}/share/man && ${MAKE} makedb)
102
103# wrt info/dir below:  It's safe to move this over top of /usr/share/info/dir,
104# as the build will automatically remove/replace the non-pkg entries there.
105
106build: beforeinstall
107.if ${MKSHARE} != "no"
108	(cd ${.CURDIR}/share/mk && ${MAKE} install)
109	(cd ${.CURDIR}/share/tmac && ${MAKE} && ${MAKE} install)
110.endif
111.if !defined(UPDATE)
112	${MAKE} cleandir
113.endif
114.if empty(HAVE_GCC28)
115.if defined(DESTDIR)
116	@echo "*** CAPUTE!"
117	@echo "    You attempted to compile the world without egcs.  You must"
118	@echo "    first install a native egcs compiler."
119	@false
120.else
121	(cd ${.CURDIR}/gnu/usr.bin/egcs && \
122	    ${MAKE} depend && ${MAKE} ${_J} MKMAN=no && \
123	    ${MAKE} MKMAN=no install && ${MAKE} cleandir)
124.endif
125.endif
126	${MAKE} includes
127	(cd ${.CURDIR}/lib/csu && \
128	    ${MAKE} depend && ${MAKE} ${_J} MKMAN=no && \
129	    ${MAKE} MKMAN=no install)
130	(cd ${.CURDIR}/lib && \
131	    ${MAKE} depend && ${MAKE} ${_J} MKMAN=no && \
132	    ${MAKE} MKMAN=no install)
133	(cd ${.CURDIR}/gnu/lib && \
134	    ${MAKE} depend && ${MAKE} ${_J} MKMAN=no MKINFO=no && \
135	    ${MAKE} MKMAN=no MKINFO=no install)
136	${MAKE} depend && ${MAKE} ${_J} && ${MAKE} _BUILD= install
137.if exists(domestic) && !defined(EXPORTABLE_SYSTEM)
138	(cd ${.CURDIR}/domestic && ${MAKE} ${_J} _SLAVE_BUILD= build)
139.endif
140	${MAKE} whatis.db
141	@echo -n "Build finished at: "
142	@date
143
144release snapshot: build
145	(cd ${.CURDIR}/etc && ${MAKE} INSTALL_DONE=1 release)
146
147.include <bsd.subdir.mk>
148