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