Makefile revision 1.166 1 1.166 pooka # $NetBSD: Makefile,v 1.166 2013/01/31 15:22:50 pooka Exp $
2 1.1 tv
3 1.3 tv .include <bsd.own.mk>
4 1.3 tv
5 1.159 joerg # Make sure that the ordered build/install processing applies when using
6 1.159 joerg # plain make.
7 1.159 joerg .MAIN: build_install
8 1.159 joerg
9 1.164 apb # TOOLDIR must be valid, unless MKTOOLS=no
10 1.164 apb .if ${MKTOOLS:Uyes} != "no"
11 1.164 apb .if "${TOOLDIR}" == ""
12 1.164 apb .error "TOOLDIR is undefined or empty"
13 1.164 apb .elif "${TOOLDIR:tW:M/*}" == ""
14 1.164 apb .error "TOOLDIR is not an absolute path: ${TOOLDIR}"
15 1.164 apb #.elif !exists(TOOLDIR) # XXX .exists fails for directories
16 1.164 apb #.error "TOOLDIR does not exist: ${TOOLDIR}"
17 1.164 apb .endif
18 1.164 apb .endif # MKTOOLS != no
19 1.164 apb
20 1.166 pooka # TOOLS_BUILDRUMP == yes builds only the subset of the tools required
21 1.166 pooka # for building rump kernels and the hypervisor. It is typically used
22 1.166 pooka # when building rump kernels targeted for non-NetBSD systems (via
23 1.166 pooka # buildrump.sh), and should not be set for a regular "make build".
24 1.166 pooka TOOLS_BUILDRUMP?=no
25 1.166 pooka
26 1.160 pooka .if ${TOOLCHAIN_MISSING} == "no"
27 1.160 pooka .if defined(HAVE_GCC)
28 1.94 jmc TOOLCHAIN_BITS= gmake .WAIT
29 1.156 joerg .endif
30 1.156 joerg
31 1.156 joerg .if defined(HAVE_GCC)
32 1.146 mrg .if ${HAVE_GCC} >= 45
33 1.146 mrg TOOLCHAIN_BITS+= gmp .WAIT
34 1.146 mrg TOOLCHAIN_BITS+= mpfr .WAIT
35 1.146 mrg TOOLCHAIN_BITS+= mpc .WAIT
36 1.94 jmc .endif
37 1.156 joerg .endif
38 1.156 joerg .endif
39 1.156 joerg
40 1.156 joerg .if ${TOOLCHAIN_MISSING} == "no"
41 1.94 jmc TOOLCHAIN_BITS+= binutils .WAIT
42 1.156 joerg .endif
43 1.156 joerg
44 1.156 joerg .if defined(HAVE_GCC)
45 1.156 joerg .if ${TOOLCHAIN_MISSING} == "no"
46 1.77 mrg TOOLCHAIN_BITS+= gcc
47 1.97 mrg . if ${MKCROSSGDB:Uno} != "no"
48 1.74 cl TOOLCHAIN_BITS+= gdb
49 1.70 mrg . endif
50 1.156 joerg TOOLCHAIN_BITS+= .WAIT
51 1.31 tv .endif
52 1.118 gmcgarry .endif
53 1.118 gmcgarry
54 1.118 gmcgarry .if defined(HAVE_PCC)
55 1.118 gmcgarry .if ${TOOLCHAIN_MISSING} == "no"
56 1.118 gmcgarry TOOLCHAIN_BITS+= pcc
57 1.118 gmcgarry .endif
58 1.118 gmcgarry .endif
59 1.31 tv
60 1.157 pooka .if ${TOOLCHAIN_MISSING} == "no"
61 1.157 pooka # XXX Eventually, we want to be able to build dbsym and mdsetimage
62 1.157 pooka # XXX if EXTERNAL_TOOLCHAIN is set.
63 1.156 joerg TOOLCHAIN_BITS+= dbsym mdsetimage
64 1.157 pooka .endif
65 1.156 joerg
66 1.137 darran DTRACE_BITS=
67 1.137 darran .if ${MKDTRACE} != "no"
68 1.137 darran DTRACE_BITS+= .WAIT libelf
69 1.137 darran DTRACE_BITS+= .WAIT libdwarf
70 1.162 apb DTRACE_BITS+= .WAIT libctf
71 1.137 darran DTRACE_BITS+= .WAIT ctfconvert ctfmerge
72 1.137 darran .endif
73 1.137 darran
74 1.99 mrg LINT_BITS=
75 1.99 mrg .if ${MKLINT} != "no"
76 1.99 mrg LINT_BITS= lint lint2
77 1.99 mrg .endif
78 1.99 mrg
79 1.165 apb # All of host-mkdep, compat, and binstall are needed before anything
80 1.165 apb # else. Within this group, they must be built in a specific order, and
81 1.165 apb # all of them must be built before any of them is installed. They may
82 1.165 apb # be installed in any order. This can't be expressed using the .WAIT
83 1.165 apb # notation inside the SUBDIR list.
84 1.165 apb #
85 1.165 apb # XXX .ORDER does not work when multiple targets are passed on the
86 1.165 apb # make command line without "-j", so use dependencies in addition to .ORDER.
87 1.165 apb #
88 1.165 apb .ORDER: dependall-host-mkdep dependall-compat dependall-binstall
89 1.165 apb .if make(dependall-host-mkdep) && make(dependall-compat)
90 1.165 apb dependall-compat: dependall-host-mkdep
91 1.165 apb .endif
92 1.165 apb .if make(dependall-compat) && make(dependall-binstall)
93 1.165 apb dependall-binstall: dependall-compat
94 1.165 apb .endif
95 1.165 apb
96 1.16 tv # Dependencies in SUBDIR below ordered to maximize parallel ability.
97 1.165 apb # See above for special treatment for host-mkdep, compat, and binstall.
98 1.165 apb #
99 1.165 apb SUBDIR= host-mkdep compat binstall \
100 1.166 pooka .WAIT mktemp .WAIT sed .WAIT
101 1.166 pooka .if ${TOOLS_BUILDRUMP} == "no"
102 1.166 pooka SUBDIR+= cap_mkdb crunchgen ctags genassym gencat hexdump \
103 1.99 mrg ${LINT_BITS} \
104 1.166 pooka makewhatis mtree nbperf .WAIT rpcgen uudecode
105 1.166 pooka .endif
106 1.166 pooka
107 1.166 pooka SUBDIR+= join lorder m4 mkdep tsort .WAIT yacc .WAIT awk .WAIT lex
108 1.166 pooka
109 1.166 pooka .if ${TOOLS_BUILDRUMP} == "no"
110 1.166 pooka SUBDIR += .WAIT texinfo \
111 1.153 christos .WAIT tic \
112 1.132 mrg .WAIT pax \
113 1.132 mrg .WAIT ${TOOLCHAIN_BITS} \
114 1.137 darran ${DTRACE_BITS} \
115 1.166 pooka asn1_compile cat cksum compile_et db \
116 1.145 elric file lint1 slc \
117 1.144 riz makefs .WAIT menuc mkcsmapper mkesdb mklocale mknod msgc \
118 1.132 mrg .WAIT disklabel \
119 1.132 mrg .WAIT paxctl \
120 1.132 mrg .WAIT fdisk \
121 1.132 mrg .WAIT installboot \
122 1.154 njoly pwd_mkdb stat strfile sunlabel zic
123 1.166 pooka .endif
124 1.166 pooka SUBDIR+= .WAIT config
125 1.39 tv
126 1.142 joerg .if ${MKLLVM} != "no"
127 1.142 joerg SUBDIR+= \
128 1.142 joerg llvm .WAIT \
129 1.149 joerg llvm-lib/libLLVMSupport llvm-lib/libLLVMTableGen .WAIT \
130 1.159 joerg llvm-tblgen llvm-clang-tblgen .WAIT \
131 1.142 joerg llvm-include .WAIT \
132 1.142 joerg llvm-lib .WAIT \
133 1.142 joerg llvm-clang
134 1.142 joerg .endif
135 1.142 joerg
136 1.121 dyoung .if ${MKMAN} != "no" || ${MKDOC} != "no" || ${MKHTML} != "no"
137 1.136 joerg . if ${MKGROFF} != "no"
138 1.39 tv SUBDIR+= groff
139 1.136 joerg . endif
140 1.128 joerg SUBDIR+= mandoc
141 1.39 tv .endif
142 1.22 tv
143 1.166 pooka .if ${TOOLS_BUILDRUMP} == "no"
144 1.166 pooka
145 1.22 tv .if ${MKMAINTAINERTOOLS:Uno} != "no"
146 1.103 lukem SUBDIR+= autoconf .WAIT gettext
147 1.72 matt .endif
148 1.72 matt
149 1.140 mrg .if ${USE_PIGZGZIP} != "no"
150 1.140 mrg SUBDIR+= pigz
151 1.140 mrg .endif
152 1.140 mrg
153 1.86 jmc .if ${MACHINE} == "hp700"
154 1.83 skrll SUBDIR+= hp700-mkboot
155 1.83 skrll .endif
156 1.83 skrll
157 1.86 jmc .if ${MACHINE} == "ibmnws"
158 1.72 matt SUBDIR+= ibmnws-ncdcs
159 1.79 matt .endif
160 1.79 matt
161 1.86 jmc .if ${MACHINE} == "macppc"
162 1.79 matt SUBDIR+= macppc-fixcoff
163 1.48 kleink .endif
164 1.48 kleink
165 1.116 garbled .if (${MACHINE} == "prep" || ${MACHINE} == "rs6000" || ${MACHINE} == "bebox")
166 1.115 garbled SUBDIR+= powerpc-mkbootimage
167 1.22 tv .endif
168 1.37 gmcgarry
169 1.148 tsutsui .if ${MACHINE_ARCH} == "m68k"
170 1.148 tsutsui SUBDIR+= m68k-elf2aout
171 1.148 tsutsui .endif
172 1.148 tsutsui
173 1.147 mrg .if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \
174 1.147 mrg ${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb")
175 1.37 gmcgarry SUBDIR+= mips-elf2ecoff
176 1.76 sekiya .endif
177 1.76 sekiya
178 1.76 sekiya .if (${MACHINE} == "sgimips")
179 1.76 sekiya SUBDIR+= sgivol
180 1.51 bjh21 .endif
181 1.51 bjh21
182 1.82 abs .if ${MACHINE} == "acorn32"
183 1.82 abs SUBDIR+= sparkcrc
184 1.82 abs .endif
185 1.82 abs
186 1.125 abs .if (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64")
187 1.51 bjh21 SUBDIR+= fgen
188 1.37 gmcgarry .endif
189 1.37 gmcgarry
190 1.85 jmc .if ${MACHINE} == "amiga"
191 1.85 jmc SUBDIR+= amiga-elf2bb
192 1.85 jmc SUBDIR+= amiga-txlt
193 1.85 jmc .endif
194 1.85 jmc
195 1.86 jmc .if ${MACHINE} == "hp300"
196 1.86 jmc SUBDIR+= hp300-mkboot
197 1.86 jmc .endif
198 1.86 jmc
199 1.161 jkunz .if ${MACHINE} == "evbarm" && ${MACHINE_ARCH} == "arm"
200 1.158 jkunz SUBDIR+= elftosb
201 1.158 jkunz .endif
202 1.158 jkunz
203 1.143 phx .if ${MACHINE} == "evbarm" || ${MACHINE} == "evbmips" || \
204 1.143 phx ${MACHINE} == "evbppc" || ${MACHINE} == "sandpoint"
205 1.139 jmcneill SUBDIR+= mkubootimage
206 1.139 jmcneill .endif
207 1.139 jmcneill
208 1.166 pooka .endif # TOOLCHAIN_BUILDRUMP
209 1.166 pooka
210 1.66 lukem check_MKTOOLS: .PHONY .NOTMAIN
211 1.19 jmc .if ${MKTOOLS:Uyes} == "no"
212 1.17 tv @echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and'
213 1.17 tv @echo '*** updating your host toolchain. This should be used only as a'
214 1.17 tv @echo '*** temporary workaround for toolchain problems, as it will result'
215 1.23 wiz @echo '*** in version skew and build errors over time!'
216 1.18 jmc .endif
217 1.17 tv
218 1.66 lukem .if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes" # {
219 1.163 apb SUBDIR= # empty
220 1.67 lukem realall realdepend install: check_MKTOOLS
221 1.66 lukem .endif # }
222 1.1 tv
223 1.1 tv .include <bsd.subdir.mk>
224 1.159 joerg .include <bsd.buildinstall.mk>
225 1.11 tv .include <bsd.obj.mk>
226 1.16 tv
227 1.102 tron .if !defined(PREVIOUSTOOLDIR)
228 1.102 tron . if exists(PREVIOUSTOOLDIR)
229 1.66 lukem PREVIOUSTOOLDIR!= cat PREVIOUSTOOLDIR
230 1.102 tron . else
231 1.162 apb PREVIOUSTOOLDIR=
232 1.102 tron . endif
233 1.66 lukem .endif
234 1.66 lukem
235 1.66 lukem CLEANFILES+= PREVIOUSTOOLDIR
236 1.66 lukem
237 1.101 tron realall realdepend: .MAKE
238 1.107 apb .if !empty(PREVIOUSTOOLDIR) && "${PREVIOUSTOOLDIR}" != "${TOOLDIR}"
239 1.66 lukem @echo "*** WARNING: TOOLDIR has moved?"
240 1.66 lukem @echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'"
241 1.66 lukem @echo "*** != TOOLDIR '${TOOLDIR}'"
242 1.66 lukem @echo "*** Cleaning mis-matched tools"
243 1.66 lukem rm -f PREVIOUSTOOLDIR
244 1.106 freza (cd ${.CURDIR} && ${MAKE} PREVIOUSTOOLDIR=${TOOLDIR} cleandir)
245 1.66 lukem .endif
246 1.102 tron echo ${TOOLDIR} >PREVIOUSTOOLDIR
247 1.66 lukem
248 1.69 tron cleandir:
249 1.69 tron rm -f ${CLEANFILES}
250