Makefile revision 1.97 1 1.97 christos # $NetBSD: Makefile,v 1.97 1999/05/27 21:03:31 christos Exp $
2 1.95 cjs
3 1.95 cjs # This is the top-level makefile for building NetBSD. For an outline of
4 1.95 cjs # how to build a snapshot or release, as well as other release engineering
5 1.95 cjs # information, see http://www.netbsd.org/developers/releng/index.html
6 1.95 cjs #
7 1.95 cjs # Not everything you can set or do is documented in this makefile. In
8 1.95 cjs # particular, you should review the files in /usr/share/mk (especially
9 1.95 cjs # bsd.README) for general information on building programs and writing
10 1.95 cjs # Makefiles within this structure, and see the comments in src/etc/Makefile
11 1.95 cjs # for further information on installation and release set options.
12 1.95 cjs #
13 1.95 cjs # Variables listed below can be set on the make command line (highest
14 1.95 cjs # priority), in /etc/mk.conf (middle priority), or in the environment
15 1.95 cjs # (lowest priority).
16 1.95 cjs #
17 1.95 cjs # Variables:
18 1.95 cjs # NBUILDJOBS is the number of jobs to start in parallel during a
19 1.95 cjs # 'make build'. It defaults to 1.
20 1.95 cjs # MKMAN, if set to `no', will prevent building of manual pages.
21 1.95 cjs # MKSHARE, if set to `no', will prevent building and installing
22 1.95 cjs # anything in /usr/share.
23 1.95 cjs # UPDATE will avoid a `make cleandir' at the start of `make build',
24 1.95 cjs # as well as having the effects listed in /usr/share/mk/bsd.README.
25 1.95 cjs # DESTDIR is the target directory for installation of the compiled
26 1.95 cjs # software. It defaults to /. Note that programs are built against
27 1.95 cjs # libraries installed in DESTDIR.
28 1.96 scottr # EXPORTABLE_SYSTEM, when set, ensures that non-exportable crypto code
29 1.96 scottr # is not compiled or installed. EXPORTABLE_SYSTEM is ignored if
30 1.97 christos # the `domestic/crypto-us' subtree does not exist.
31 1.97 christos # FORCE_DOMESTIC, when set, forces a descent into the domestic/crypto-us tree
32 1.96 scottr # when handling the `all', `includes', and `install' targets. This
33 1.96 scottr # flag is incompatible with the `build' target. It's generally a
34 1.96 scottr # bad idea to use FORCE_DOMESTIC unless the ramifications are well
35 1.96 scottr # understood, and should never be enabled by default. FORCE_DOMESTIC
36 1.97 christos # is ignored if the `domestic/crypto-us' subtree does not exist.
37 1.95 cjs #
38 1.95 cjs # Targets:
39 1.95 cjs # build: builds a full release of netbsd in DESTDIR.
40 1.95 cjs # release: does a `make build,' and then tars up the DESTDIR files
41 1.95 cjs # into RELEASEDIR, in release(7) format. (See etc/Makefile for
42 1.95 cjs # more information on this.)
43 1.95 cjs # snapshot: a synonym for release.
44 1.32 cgd
45 1.32 cgd .include <bsd.own.mk> # for configuration variables.
46 1.4 cgd
47 1.76 bouyer
48 1.58 tv HAVE_GCC28!= ${CXX} --version | egrep "^(2\.8|egcs)" ; echo
49 1.58 tv
50 1.76 bouyer .if defined(NBUILDJOBS)
51 1.76 bouyer _J= -j${NBUILDJOBS}
52 1.76 bouyer .endif
53 1.76 bouyer
54 1.4 cgd # NOTE THAT etc *DOES NOT* BELONG IN THE LIST BELOW
55 1.2 cgd
56 1.52 mycroft SUBDIR+= lib include bin libexec sbin usr.bin usr.sbin share sys
57 1.36 explorer
58 1.36 explorer .if exists(games)
59 1.36 explorer SUBDIR+= games
60 1.36 explorer .endif
61 1.36 explorer
62 1.8 cgd SUBDIR+= gnu
63 1.52 mycroft # This is needed for libstdc++ and gen-params.
64 1.52 mycroft includes-gnu: includes-include includes-sys
65 1.9 cgd
66 1.97 christos # Descend into the domestic/crypto-us tree if it exists AND
67 1.82 scottr # 1) the target is clean, cleandir, or obj, OR
68 1.93 scottr # 2) the the target is install or includes AND
69 1.96 scottr # NOT compiling only "exportable" code AND
70 1.96 scottr # doing it as part of installing a distribution, OR
71 1.96 scottr # 3) we Really Know what we're doing. (Really!)
72 1.94 scottr #
73 1.94 scottr # NOTE: due to the use of the make(foo) construct here, using the
74 1.94 scottr # clean, cleandir, and obj targets on the command line in conjunction
75 1.94 scottr # with any other target may produce unexpected results.
76 1.82 scottr
77 1.97 christos .if exists(domestic)
78 1.97 christos DOMESTIC=domestic
79 1.97 christos .elif exists(crypto-us)
80 1.97 christos DOMESTIC=crypto-us
81 1.97 christos .endif
82 1.97 christos
83 1.97 christos .if defined(DOMESTIC) && \
84 1.79 scottr (make(clean) || make(cleandir) || make(obj) || \
85 1.82 scottr ((make(includes) || make(install)) && \
86 1.96 scottr !defined(EXPORTABLE_SYSTEM) && defined(_DISTRIB)) || \
87 1.96 scottr defined(FORCE_DOMESTIC))
88 1.97 christos SUBDIR+= ${DOMESTIC}
89 1.21 cgd .endif
90 1.21 cgd
91 1.13 brezak .if exists(regress)
92 1.9 cgd .ifmake !(install)
93 1.9 cgd SUBDIR+= regress
94 1.9 cgd .endif
95 1.9 cgd
96 1.10 cgd regression-tests:
97 1.10 cgd @echo Running regression tests...
98 1.22 cgd @(cd ${.CURDIR}/regress && ${MAKE} regress)
99 1.13 brezak .endif
100 1.20 cgd
101 1.26 tls beforeinstall:
102 1.45 perry .ifmake build
103 1.45 perry @echo -n "Build started at: "
104 1.45 perry @date
105 1.45 perry .endif
106 1.26 tls .ifndef DESTDIR
107 1.26 tls (cd ${.CURDIR}/etc && ${MAKE} DESTDIR=/ distrib-dirs)
108 1.31 tls .else
109 1.31 tls (cd ${.CURDIR}/etc && ${MAKE} distrib-dirs)
110 1.26 tls .endif
111 1.15 cgd
112 1.15 cgd afterinstall:
113 1.86 lukem .if ${MKMAN} != "no" && !defined(_BUILD)
114 1.81 scottr ${MAKE} whatis.db
115 1.81 scottr .endif
116 1.81 scottr
117 1.81 scottr whatis.db:
118 1.22 cgd (cd ${.CURDIR}/share/man && ${MAKE} makedb)
119 1.15 cgd
120 1.84 tv # wrt info/dir below: It's safe to move this over top of /usr/share/info/dir,
121 1.84 tv # as the build will automatically remove/replace the non-pkg entries there.
122 1.84 tv
123 1.43 thorpej build: beforeinstall
124 1.96 scottr .if defined(FORCE_DOMESTIC)
125 1.96 scottr @echo '*** CAPUTE!'
126 1.96 scottr @echo ' The FORCE_DOMESTIC flag is not compatible with "make build".'
127 1.96 scottr @echo ' Please correct the problem and try again.'
128 1.96 scottr @false
129 1.96 scottr .endif
130 1.86 lukem .if ${MKSHARE} != "no"
131 1.32 cgd (cd ${.CURDIR}/share/mk && ${MAKE} install)
132 1.47 thorpej (cd ${.CURDIR}/share/tmac && ${MAKE} && ${MAKE} install)
133 1.68 lukem .endif
134 1.39 christos .if !defined(UPDATE)
135 1.17 cgd ${MAKE} cleandir
136 1.39 christos .endif
137 1.75 tv .if empty(HAVE_GCC28)
138 1.71 mycroft .if defined(DESTDIR)
139 1.71 mycroft @echo "*** CAPUTE!"
140 1.84 tv @echo " You attempted to compile the world without egcs. You must"
141 1.71 mycroft @echo " first install a native egcs compiler."
142 1.84 tv @false
143 1.71 mycroft .else
144 1.71 mycroft (cd ${.CURDIR}/gnu/usr.bin/egcs && \
145 1.86 lukem ${MAKE} depend && ${MAKE} ${_J} MKMAN=no && \
146 1.86 lukem ${MAKE} MKMAN=no install && ${MAKE} cleandir)
147 1.71 mycroft .endif
148 1.71 mycroft .endif
149 1.93 scottr ${MAKE} includes
150 1.61 mycroft (cd ${.CURDIR}/lib/csu && \
151 1.86 lukem ${MAKE} depend && ${MAKE} ${_J} MKMAN=no && \
152 1.86 lukem ${MAKE} MKMAN=no install)
153 1.61 mycroft (cd ${.CURDIR}/lib && \
154 1.86 lukem ${MAKE} depend && ${MAKE} ${_J} MKMAN=no && \
155 1.86 lukem ${MAKE} MKMAN=no install)
156 1.61 mycroft (cd ${.CURDIR}/gnu/lib && \
157 1.89 mellon ${MAKE} depend && ${MAKE} ${_J} MKMAN=no MKINFO=no && \
158 1.89 mellon ${MAKE} MKMAN=no MKINFO=no install)
159 1.80 scottr ${MAKE} depend && ${MAKE} ${_J} && ${MAKE} _BUILD= install
160 1.97 christos .if defined(DOMESTIC) && !defined(EXPORTABLE_SYSTEM)
161 1.97 christos (cd ${.CURDIR}/${DOMESTIC} && ${MAKE} ${_J} _SLAVE_BUILD= build)
162 1.49 lukem .endif
163 1.81 scottr ${MAKE} whatis.db
164 1.50 mellon @echo -n "Build finished at: "
165 1.50 mellon @date
166 1.87 cjs
167 1.87 cjs release snapshot: build
168 1.91 scottr (cd ${.CURDIR}/etc && ${MAKE} INSTALL_DONE=1 release)
169 1.1 cgd
170 1.1 cgd .include <bsd.subdir.mk>
171