Makefile revision 1.108
1#	$NetBSD: Makefile,v 1.108 2000/02/29 21:54:03 erh 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#   DESTDIR is the target directory for installation of the compiled
19#	software. It defaults to /. Note that programs are built against
20#	libraries installed in DESTDIR.
21#   MKMAN, if set to `no', will prevent building of manual pages.
22#   MKOBJDIRS, if not set to `no', will build object directories at 
23#	an appropriate point in a build.
24#   MKSHARE, if set to `no', will prevent building and installing
25#	anything in /usr/share.
26#   NBUILDJOBS is the number of jobs to start in parallel during a
27#	'make build'. It defaults to 1.
28#   UPDATE will avoid a `make cleandir' at the start of `make build',
29#	as well as having the effects listed in /usr/share/mk/bsd.README.
30#
31# Targets:
32#   build: builds a full release of netbsd in DESTDIR.
33#   release: does a `make build,' and then tars up the DESTDIR files
34#	into RELEASEDIR, in release(7) format. (See etc/Makefile for
35#	more information on this.)
36#   snapshot: a synonym for release.
37
38SRCTOP=.
39.include <bsd.crypto.mk>		# for configuration variables.
40
41.if defined(CRYPTOPATH)
42.sinclude "${CRYPTOPATH}/Makefile.frag"
43.endif
44
45MKOBJDIRS ?= no
46HAVE_GCC28!=	${CXX} --version | egrep "^(2\.8|egcs)" ; echo
47
48.if defined(NBUILDJOBS)
49_J= -j${NBUILDJOBS}
50.endif
51
52# NOTE THAT etc *DOES NOT* BELONG IN THE LIST BELOW
53
54SUBDIR+= lib include bin libexec sbin usr.bin usr.sbin share sys
55
56includes-lib: includes-include includes-sys
57
58.if exists(games)
59SUBDIR+= games
60.endif
61
62SUBDIR+= gnu
63# This is needed for libstdc++ and gen-params.
64includes-gnu: includes-include includes-sys
65
66.if exists(regress)
67.ifmake !(install)
68SUBDIR+= regress
69.endif
70
71regression-tests:
72	@echo Running regression tests...
73	@(cd ${.CURDIR}/regress && ${MAKE} regress)
74.endif
75
76buildmsg:
77	@echo -n "Build started at: "
78	@date
79
80beforeinstall:
81.ifndef DESTDIR
82	(cd ${.CURDIR}/etc && ${MAKE} DESTDIR=/ distrib-dirs)
83.else
84	(cd ${.CURDIR}/etc && ${MAKE} distrib-dirs)
85.endif
86
87afterinstall:
88.if ${MKMAN} != "no" && !defined(_BUILD)
89	${MAKE} whatis.db
90.endif
91
92whatis.db:
93	(cd ${.CURDIR}/share/man && ${MAKE} makedb)
94
95# wrt info/dir below:  It's safe to move this over top of /usr/share/info/dir,
96# as the build will automatically remove/replace the non-pkg entries there.
97
98build: buildmsg beforeinstall
99.if defined(FORCE_DOMESTIC)
100	@echo '*** CAPUTE!'
101	@echo '    The FORCE_DOMESTIC flag is not compatible with "make build".'
102	@echo '    Please correct the problem and try again.'
103	@false
104.endif
105.if ${MKSHARE} != "no"
106	(cd ${.CURDIR}/share/mk && ${MAKE} install)
107.endif
108.if !defined(UPDATE)
109	${MAKE} cleandir
110.endif
111.if ${MKOBJDIRS} != "no"
112	${MAKE} obj
113	(cd ${.CURDIR}/distrib && ${MAKE} obj)
114.endif
115.if empty(HAVE_GCC28)
116.if defined(DESTDIR)
117	@echo "*** CAPUTE!"
118	@echo "    You attempted to compile the world without egcs.  You must"
119	@echo "    first install a native egcs compiler."
120	@false
121.else
122	(cd ${.CURDIR}/gnu/usr.bin/egcs && \
123	    ${MAKE} ${_J} dependall MKMAN=no && \
124	    ${MAKE} MKMAN=no install && ${MAKE} cleandir)
125.endif
126.endif
127	${MAKE} includes
128	(cd ${.CURDIR}/lib/csu && \
129	    ${MAKE} ${_J} MKMAN=no dependall && \
130	    ${MAKE} MKMAN=no install)
131	(cd ${.CURDIR}/lib && \
132	    ${MAKE} ${_J} MKMAN=no dependall && \
133	    ${MAKE} MKMAN=no install)
134	(cd ${.CURDIR}/gnu/lib && \
135	    ${MAKE} ${_J} MKMAN=no MKINFO=no dependall && \
136	    ${MAKE} MKMAN=no MKINFO=no install)
137.if target(cryptobuild)
138	${MAKE} ${_J} cryptobuild
139.endif
140	${MAKE} ${_J} dependall && ${MAKE} _BUILD= install
141.if defined(DOMESTIC) && !defined(EXPORTABLE_SYSTEM)
142	(cd ${.CURDIR}/${DOMESTIC} && ${MAKE} ${_J} _SLAVE_BUILD= build)
143.endif
144	${MAKE} whatis.db
145	@echo -n "Build finished at: "
146	@date
147
148release snapshot: build
149	(cd ${.CURDIR}/etc && ${MAKE} INSTALL_DONE=1 release)
150
151.include <bsd.subdir.mk>
152