Drop main() prototype. Syncs with NetBSD-8
[minix.git] / tools / Makefile
blobc697f9c4955daa23d6cbd509ed90c65797ee2b4d
1 # $NetBSD: Makefile,v 1.182 2015/07/23 08:03:26 mrg Exp $
3 .include <bsd.own.mk>
4 .include <bsd.endian.mk>
6 .if defined(__MINIX)
7 # Some tools do not compile warning free with newer toolchains.
8 NOGCCERROR= yes
9 NOCLANGERROR= yes
10 .endif # defined(__MINIX)
11 # Make sure that the ordered build/install processing applies when using
12 # plain make.
13 .MAIN: build_install
15 # TOOLDIR must be valid, unless MKTOOLS=no
16 .if ${MKTOOLS:Uyes} != "no"
17 .if "${TOOLDIR}" == ""
18 .error "TOOLDIR is undefined or empty"
19 .elif "${TOOLDIR:tW:M/*}" == ""
20 .error "TOOLDIR is not an absolute path: ${TOOLDIR}"
21 #.elif !exists(TOOLDIR) # XXX .exists fails for directories
22 #.error "TOOLDIR does not exist: ${TOOLDIR}"
23 .endif
24 .endif # MKTOOLS != no
26 # TOOLS_BUILDRUMP == yes builds only the subset of the tools required
27 # for building rump kernels and the hypervisor. It is typically used
28 # when building rump kernels targeted for non-NetBSD systems (via
29 # buildrump.sh), and should not be set for a regular "make build".
30 TOOLS_BUILDRUMP?=no
32 .if ${TOOLCHAIN_MISSING} == "no"
33 . if defined(HAVE_GCC) && ${HAVE_GCC} > 0
34 TOOLCHAIN_BITS= gmake .WAIT
35 TOOLCHAIN_BITS+= gmp .WAIT
36 TOOLCHAIN_BITS+= mpfr .WAIT
37 TOOLCHAIN_BITS+= mpc .WAIT
38 . endif
39 .endif
41 .if ${TOOLCHAIN_MISSING} == "no"
42 TOOLCHAIN_BITS+= binutils .WAIT
43 .endif
45 .if defined(HAVE_GCC) && ${HAVE_GCC} > 0
46 . if ${TOOLCHAIN_MISSING} == "no"
47 TOOLCHAIN_BITS+= gcc
48 .if !defined(__MINIX)
49 # The following test is broken as it still tries to create the directory
50 . if ${MKCROSSGDB:Uno} != "no" || make(obj)
51 TOOLCHAIN_BITS+= gdb
52 . endif
53 .endif # !defined(__MINIX)
54 TOOLCHAIN_BITS+= .WAIT
55 . endif
56 .endif
58 .if defined(HAVE_PCC)
59 . if ${TOOLCHAIN_MISSING} == "no"
60 TOOLCHAIN_BITS+= pcc
61 . endif
62 .endif
64 .if !defined(__MINIX)
65 .if ${TOOLCHAIN_MISSING} == "no"
66 # XXX Eventually, we want to be able to build dbsym and mdsetimage
67 # XXX if EXTERNAL_TOOLCHAIN is set.
68 TOOLCHAIN_BITS+= dbsym mdsetimage
69 .endif
70 .endif # !defined(__MINIX)
72 DTRACE_BITS=
73 .if ${MKDTRACE} != "no" || ${MKCTF} != "no"
74 DTRACE_BITS+= .WAIT libelf
75 DTRACE_BITS+= .WAIT libdwarf
76 DTRACE_BITS+= .WAIT libctf
77 .endif
78 .if ${MKCTF} != "no"
79 DTRACE_BITS+= .WAIT ctfconvert ctfmerge
80 .endif
82 LINT_BITS=
83 .if ${MKLINT} != "no"
84 LINT_BITS= lint lint2
85 .endif
87 # All of host-mkdep, compat, and binstall are needed before anything
88 # else. Within this group, they must be built in a specific order, and
89 # all of them must be built before any of them is installed. They may
90 # be installed in any order. This can't be expressed using the .WAIT
91 # notation inside the SUBDIR list.
93 # XXX .ORDER does not work when multiple targets are passed on the
94 # make command line without "-j", so use dependencies in addition to .ORDER.
96 .ORDER: dependall-host-mkdep dependall-compat dependall-binstall
97 .if make(dependall-host-mkdep) && make(dependall-compat)
98 dependall-compat: dependall-host-mkdep
99 .endif
100 .if make(dependall-compat) && make(dependall-binstall)
101 dependall-binstall: dependall-compat
102 .endif
104 # Dependencies in SUBDIR below ordered to maximize parallel ability.
105 # See above for special treatment for host-mkdep, compat, and binstall.
107 SUBDIR= host-mkdep compat binstall \
108 .WAIT mktemp .WAIT sed .WAIT genassym
109 .if ${TOOLS_BUILDRUMP} == "no"
110 SUBDIR+= gencat \
111 ${LINT_BITS} \
112 makewhatis mtree nbperf .WAIT uudecode
113 .endif
115 SUBDIR+= cat join lorder m4 mkdep tsort .WAIT yacc .WAIT awk .WAIT lex
117 .if ${TOOLS_BUILDRUMP} == "no"
118 SUBDIR += .WAIT texinfo \
119 .WAIT tic \
120 .WAIT pax \
121 .WAIT ${TOOLCHAIN_BITS} \
122 ${DTRACE_BITS} \
123 cksum \
124 file \
125 makefs .WAIT mkcsmapper mkesdb mklocale \
126 .WAIT \
127 .WAIT \
128 .WAIT \
129 .WAIT installboot \
130 pwd_mkdb strfile zic
131 .endif
132 SUBDIR+= stat .WAIT
134 .if defined(__MINIX)
135 SUBDIR += \
136 mkfs.mfs \
137 partition \
138 toproto
139 .else
140 SUBDIR+= .WAIT config
141 .endif # defined(__MINIX)
143 .if ${MKLLVM} != "no"
144 SUBDIR+= \
145 llvm .WAIT \
146 llvm-lib/libLLVMSupport llvm-lib/libLLVMTableGen .WAIT \
147 llvm-tblgen llvm-clang-tblgen .WAIT \
148 llvm-include .WAIT \
149 llvm-lib .WAIT \
150 llvm-clang
151 . if ${MKLLD} != "no"
152 SUBDIR+= llvm-lld
153 . endif
154 . if ${MKMCLINKER} != "no"
155 SUBDIR+= llvm-mcld
156 . endif
157 .endif
159 .if ${MKMAN} != "no" || ${MKDOC} != "no" || ${MKHTML} != "no"
160 . if ${MKGROFF} != "no"
161 SUBDIR+= groff
162 . endif
163 SUBDIR+= mandoc
164 .endif
166 .if ${TOOLS_BUILDRUMP} == "no"
168 .if ${MKMAINTAINERTOOLS:Uno} != "no"
169 SUBDIR+= autoconf .WAIT gettext
170 .endif
172 .if ${USE_PIGZGZIP} != "no"
173 SUBDIR+= pigz
174 .endif
176 .if ${MACHINE} == "hppa"
177 SUBDIR+= hppa-mkboot
178 .endif
180 .if ${MACHINE} == "ibmnws"
181 SUBDIR+= ibmnws-ncdcs
182 .endif
184 .if ${MACHINE} == "macppc"
185 SUBDIR+= macppc-fixcoff
186 .endif
188 .if (${MACHINE} == "prep" || ${MACHINE} == "rs6000" || ${MACHINE} == "bebox")
189 SUBDIR+= powerpc-mkbootimage
190 .endif
192 .if ${MACHINE_ARCH} == "m68k"
193 SUBDIR+= m68k-elf2aout
194 .endif
196 .if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \
197 ${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb")
198 SUBDIR+= mips-elf2ecoff
199 .endif
201 .if (${MACHINE} == "sgimips")
202 SUBDIR+= sgivol
203 .endif
205 .if ${MACHINE} == "acorn32"
206 SUBDIR+= sparkcrc
207 .endif
209 .if (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64")
210 SUBDIR+= fgen
211 .endif
213 .if ${MACHINE} == "amiga"
214 SUBDIR+= amiga-elf2bb
215 SUBDIR+= amiga-txlt
216 .endif
218 .if ${MACHINE} == "hp300"
219 SUBDIR+= hp300-mkboot
220 .endif
222 .if !defined(__MINIX)
223 .if ${MACHINE} == "evbarm" \
224 && ${MACHINE_CPU} == "arm" \
225 && ${TARGET_ENDIANNESS} == "1234"
226 SUBDIR+= elftosb
227 .endif
229 .if ${MACHINE} == "evbarm" || ${MACHINE} == "evbmips" || \
230 ${MACHINE} == "evbppc" || ${MACHINE} == "sandpoint"
231 SUBDIR+= mkubootimage
232 .endif
233 .endif # !defined(__MINIX)
235 .if ${MKX11} != "no"
236 SUBDIR+= makestrs
237 SUBDIR+= makekeys
238 .endif
240 .endif # TOOLCHAIN_BUILDRUMP
242 check_MKTOOLS: .PHONY .NOTMAIN
243 .if ${MKTOOLS:Uyes} == "no"
244 @echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and'
245 @echo '*** updating your host toolchain. This should be used only as a'
246 @echo '*** temporary workaround for toolchain problems, as it will result'
247 @echo '*** in version skew and build errors over time!'
248 .endif
250 .if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes" # {
251 SUBDIR= # empty
252 realall realdepend install: check_MKTOOLS
253 .endif # }
255 .include <bsd.subdir.mk>
256 .include <bsd.buildinstall.mk>
257 .include <bsd.obj.mk>
259 .if !defined(PREVIOUSTOOLDIR)
260 . if exists(PREVIOUSTOOLDIR)
261 PREVIOUSTOOLDIR!= cat PREVIOUSTOOLDIR
262 . else
263 PREVIOUSTOOLDIR=
264 . endif
265 .endif
267 CLEANFILES+= PREVIOUSTOOLDIR
269 realall realdepend: .MAKE
270 .if !empty(PREVIOUSTOOLDIR) && "${PREVIOUSTOOLDIR}" != "${TOOLDIR}"
271 @echo "*** WARNING: TOOLDIR has moved?"
272 @echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'"
273 @echo "*** != TOOLDIR '${TOOLDIR}'"
274 @echo "*** Cleaning mis-matched tools"
275 rm -f PREVIOUSTOOLDIR
276 (cd ${.CURDIR} && ${MAKE} PREVIOUSTOOLDIR=${TOOLDIR} cleandir)
277 .endif
278 echo ${TOOLDIR} >PREVIOUSTOOLDIR
280 cleandir:
281 rm -f ${CLEANFILES}