Makefile revision 1.110 1 # $NetBSD: Makefile,v 1.110 2000/03/11 00:10:20 jlam 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. If BUILD_DONE is
33 # set, this is an empty target.
34 # release: does a `make build,' and then tars up the DESTDIR files
35 # into RELEASEDIR, in release(7) format. (See etc/Makefile for
36 # more information on this.)
37 # snapshot: a synonym for release.
38
39 SRCTOP=.
40 .include <bsd.crypto.mk> # for configuration variables.
41
42 .if defined(CRYPTOPATH)
43 .sinclude "${CRYPTOPATH}/Makefile.frag"
44 .endif
45
46 MKOBJDIRS ?= no
47 HAVE_GCC28!= ${CXX} --version | egrep "^(2\.8|egcs)" ; echo
48
49 .if defined(NBUILDJOBS)
50 _J= -j${NBUILDJOBS}
51 .endif
52
53 # NOTE THAT etc *DOES NOT* BELONG IN THE LIST BELOW
54
55 SUBDIR+= lib include bin libexec sbin usr.bin usr.sbin share sys
56 .if make(obj)
57 SUBDIR+= distrib
58 .endif
59
60 includes-lib: includes-include includes-sys
61
62 .if exists(games)
63 SUBDIR+= games
64 .endif
65
66 SUBDIR+= gnu
67 # This is needed for libstdc++ and gen-params.
68 includes-gnu: includes-include includes-sys
69
70 .if exists(regress)
71 .ifmake !(install)
72 SUBDIR+= regress
73 .endif
74
75 regression-tests:
76 @echo Running regression tests...
77 @(cd ${.CURDIR}/regress && ${MAKE} regress)
78 .endif
79
80 buildmsg:
81 @echo -n "Build started at: "
82 @date
83
84 beforeinstall:
85 .ifndef DESTDIR
86 (cd ${.CURDIR}/etc && ${MAKE} DESTDIR=/ distrib-dirs)
87 .else
88 (cd ${.CURDIR}/etc && ${MAKE} distrib-dirs)
89 .endif
90
91 afterinstall:
92 .if ${MKMAN} != "no" && !defined(_BUILD)
93 ${MAKE} whatis.db
94 .endif
95
96 whatis.db:
97 (cd ${.CURDIR}/share/man && ${MAKE} makedb)
98
99 # wrt info/dir below: It's safe to move this over top of /usr/share/info/dir,
100 # as the build will automatically remove/replace the non-pkg entries there.
101
102 .if defined(BUILD_DONE)
103 build:
104 @echo "Build installed into ${DESTDIR}"
105 .else
106 build: buildmsg beforeinstall
107 .if defined(FORCE_DOMESTIC)
108 @echo '*** CAPUTE!'
109 @echo ' The FORCE_DOMESTIC flag is not compatible with "make build".'
110 @echo ' Please correct the problem and try again.'
111 @false
112 .endif
113 .if ${MKSHARE} != "no"
114 (cd ${.CURDIR}/share/mk && ${MAKE} install)
115 .endif
116 .if !defined(UPDATE)
117 ${MAKE} cleandir
118 .endif
119 .if ${MKOBJDIRS} != "no"
120 ${MAKE} obj
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} ${_J} dependall MKMAN=no && \
131 ${MAKE} MKMAN=no install && ${MAKE} cleandir)
132 .endif
133 .endif
134 ${MAKE} includes
135 (cd ${.CURDIR}/lib/csu && \
136 ${MAKE} ${_J} MKMAN=no dependall && \
137 ${MAKE} MKMAN=no install)
138 (cd ${.CURDIR}/lib && \
139 ${MAKE} ${_J} MKMAN=no dependall && \
140 ${MAKE} MKMAN=no install)
141 (cd ${.CURDIR}/gnu/lib && \
142 ${MAKE} ${_J} MKMAN=no MKINFO=no dependall && \
143 ${MAKE} MKMAN=no MKINFO=no install)
144 .if target(cryptobuild)
145 ${MAKE} ${_J} cryptobuild
146 .endif
147 ${MAKE} ${_J} dependall && ${MAKE} _BUILD= install
148 .if defined(DOMESTIC) && !defined(EXPORTABLE_SYSTEM)
149 (cd ${.CURDIR}/${DOMESTIC} && ${MAKE} ${_J} _SLAVE_BUILD= build)
150 .endif
151 ${MAKE} whatis.db
152 @echo -n "Build finished at: "
153 @date
154 .endif
155
156 release snapshot: build
157 (cd ${.CURDIR}/etc && ${MAKE} INSTALL_DONE=1 release)
158
159 .include <bsd.subdir.mk>
160