64-bit VFS_LSEEK_OFF
[minix3.git] / tools / Makefile
blobc7dfdb1b8d9a64e14b5e83f292822cb86b87a782
1 # $NetBSD: Makefile,v 1.170 2013/09/02 14:34:57 joerg Exp $
3 .include <bsd.own.mk>
4 .include <bsd.endian.mk>
6 # Make sure that the ordered build/install processing applies when using
7 # plain make.
8 .MAIN: build_install
10 # TOOLDIR must be valid, unless MKTOOLS=no
11 .if ${MKTOOLS:Uyes} != "no"
12 .if "${TOOLDIR}" == ""
13 .error "TOOLDIR is undefined or empty"
14 .elif "${TOOLDIR:tW:M/*}" == ""
15 .error "TOOLDIR is not an absolute path: ${TOOLDIR}"
16 #.elif !exists(TOOLDIR) # XXX .exists fails for directories
17 #.error "TOOLDIR does not exist: ${TOOLDIR}"
18 .endif
19 .endif # MKTOOLS != no
21 # TOOLS_BUILDRUMP == yes builds only the subset of the tools required
22 # for building rump kernels and the hypervisor. It is typically used
23 # when building rump kernels targeted for non-NetBSD systems (via
24 # buildrump.sh), and should not be set for a regular "make build".
25 TOOLS_BUILDRUMP?=no
27 .if ${TOOLCHAIN_MISSING} == "no"
28 .if defined(HAVE_GCC)
29 TOOLCHAIN_BITS= gmake .WAIT
30 .endif
32 .if defined(HAVE_GCC)
33 .if ${HAVE_GCC} >= 45
34 TOOLCHAIN_BITS+= gmp .WAIT
35 TOOLCHAIN_BITS+= mpfr .WAIT
36 TOOLCHAIN_BITS+= mpc .WAIT
37 .endif
38 .endif
39 .endif
41 .if ${TOOLCHAIN_MISSING} == "no"
42 TOOLCHAIN_BITS+= binutils .WAIT
43 .endif
45 .if defined(HAVE_GCC)
46 .if ${TOOLCHAIN_MISSING} == "no"
47 TOOLCHAIN_BITS+= gcc
48 . if ${MKCROSSGDB:Uno} != "no" # LSC: Doesn't work || make(obj)
49 TOOLCHAIN_BITS+= gdb
50 . endif
51 TOOLCHAIN_BITS+= .WAIT
52 .endif
53 .endif
55 .if defined(HAVE_PCC)
56 .if ${TOOLCHAIN_MISSING} == "no"
57 TOOLCHAIN_BITS+= pcc
58 .endif
59 .endif
61 .if !defined(__MINIX)
62 .if ${TOOLCHAIN_MISSING} == "no"
63 # XXX Eventually, we want to be able to build dbsym and mdsetimage
64 # XXX if EXTERNAL_TOOLCHAIN is set.
65 TOOLCHAIN_BITS+= dbsym mdsetimage
66 .endif
67 .endif # !defined(__MINIX)
69 DTRACE_BITS=
70 .if ${MKDTRACE} != "no"
71 DTRACE_BITS+= .WAIT libelf
72 DTRACE_BITS+= .WAIT libdwarf
73 DTRACE_BITS+= .WAIT libctf
74 DTRACE_BITS+= .WAIT ctfconvert ctfmerge
75 .endif
77 LINT_BITS=
78 .if ${MKLINT} != "no"
79 LINT_BITS= lint lint2
80 .endif
82 # All of host-mkdep, compat, and binstall are needed before anything
83 # else. Within this group, they must be built in a specific order, and
84 # all of them must be built before any of them is installed. They may
85 # be installed in any order. This can't be expressed using the .WAIT
86 # notation inside the SUBDIR list.
88 # XXX .ORDER does not work when multiple targets are passed on the
89 # make command line without "-j", so use dependencies in addition to .ORDER.
91 .ORDER: dependall-host-mkdep dependall-compat dependall-binstall
92 .if make(dependall-host-mkdep) && make(dependall-compat)
93 dependall-compat: dependall-host-mkdep
94 .endif
95 .if make(dependall-compat) && make(dependall-binstall)
96 dependall-binstall: dependall-compat
97 .endif
99 # Dependencies in SUBDIR below ordered to maximize parallel ability.
100 # See above for special treatment for host-mkdep, compat, and binstall.
102 SUBDIR= host-mkdep compat binstall \
103 .WAIT mktemp .WAIT sed .WAIT
104 .if ${TOOLS_BUILDRUMP} == "no"
105 SUBDIR+= genassym \
106 ${LINT_BITS} \
107 makewhatis mtree nbperf .WAIT
108 .endif
110 SUBDIR+= join lorder m4 mkdep tsort .WAIT yacc .WAIT awk .WAIT lex
112 .if ${TOOLS_BUILDRUMP} == "no"
113 SUBDIR += .WAIT texinfo \
114 .WAIT tic \
115 .WAIT pax \
116 .WAIT ${TOOLCHAIN_BITS} \
117 ${DTRACE_BITS} \
118 cat cksum \
119 file \
120 .WAIT \
121 .WAIT \
122 .WAIT \
123 .WAIT \
124 .WAIT \
125 pwd_mkdb stat zic
126 .endif
127 .if defined(__MINIX)
128 SUBDIR += \
129 mkfs.mfs \
130 partition \
131 toproto \
132 writeisofs
133 .else
134 SUBDIR+= .WAIT config
135 .endif # defined(__MINIX)
137 .if ${MKLLVM} != "no"
138 SUBDIR+= \
139 llvm .WAIT \
140 llvm-lib/libLLVMSupport llvm-lib/libLLVMTableGen .WAIT \
141 llvm-tblgen llvm-clang-tblgen .WAIT \
142 llvm-include .WAIT \
143 llvm-lib .WAIT \
144 llvm-clang
145 .if ${MKLLD} != "no"
146 SUBDIR+= llvm-lld
147 .endif
148 .if ${MKMCLINKER} != "no"
149 SUBDIR+= llvm-mcld
150 .endif
151 .endif
153 .if ${MKMAN} != "no" || ${MKDOC} != "no" || ${MKHTML} != "no"
154 . if ${MKGROFF} != "no"
155 SUBDIR+= groff
156 . endif
157 SUBDIR+= mandoc
158 .endif
160 .if ${TOOLS_BUILDRUMP} == "no"
162 .if ${MKMAINTAINERTOOLS:Uno} != "no"
163 SUBDIR+= autoconf .WAIT gettext
164 .endif
166 .if ${USE_PIGZGZIP} != "no"
167 SUBDIR+= pigz
168 .endif
170 .if ${MACHINE} == "hp700"
171 SUBDIR+= hp700-mkboot
172 .endif
174 .if ${MACHINE} == "ibmnws"
175 SUBDIR+= ibmnws-ncdcs
176 .endif
178 .if ${MACHINE} == "macppc"
179 SUBDIR+= macppc-fixcoff
180 .endif
182 .if (${MACHINE} == "prep" || ${MACHINE} == "rs6000" || ${MACHINE} == "bebox")
183 SUBDIR+= powerpc-mkbootimage
184 .endif
186 .if ${MACHINE_ARCH} == "m68k"
187 SUBDIR+= m68k-elf2aout
188 .endif
190 .if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \
191 ${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb")
192 SUBDIR+= mips-elf2ecoff
193 .endif
195 .if (${MACHINE} == "sgimips")
196 SUBDIR+= sgivol
197 .endif
199 .if ${MACHINE} == "acorn32"
200 SUBDIR+= sparkcrc
201 .endif
203 .if (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64")
204 SUBDIR+= fgen
205 .endif
207 .if ${MACHINE} == "amiga"
208 SUBDIR+= amiga-elf2bb
209 SUBDIR+= amiga-txlt
210 .endif
212 .if ${MACHINE} == "hp300"
213 SUBDIR+= hp300-mkboot
214 .endif
216 .if !defined(__MINIX)
217 .if ${MACHINE} == "evbarm" \
218 && ${MACHINE_CPU} == "arm" \
219 && ${TARGET_ENDIANNESS} == "1234"
220 SUBDIR+= elftosb
221 .endif
223 .if ${MACHINE} == "evbarm" || ${MACHINE} == "evbmips" || \
224 ${MACHINE} == "evbppc" || ${MACHINE} == "sandpoint"
225 SUBDIR+= mkubootimage
226 .endif
227 .endif # !defined(__MINIX)
229 .endif # TOOLCHAIN_BUILDRUMP
231 check_MKTOOLS: .PHONY .NOTMAIN
232 .if ${MKTOOLS:Uyes} == "no"
233 @echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and'
234 @echo '*** updating your host toolchain. This should be used only as a'
235 @echo '*** temporary workaround for toolchain problems, as it will result'
236 @echo '*** in version skew and build errors over time!'
237 .endif
239 .if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes" # {
240 SUBDIR= # empty
241 realall realdepend install: check_MKTOOLS
242 .endif # }
244 .include <bsd.subdir.mk>
245 .include <bsd.buildinstall.mk>
246 .include <bsd.obj.mk>
248 .if !defined(PREVIOUSTOOLDIR)
249 . if exists(PREVIOUSTOOLDIR)
250 PREVIOUSTOOLDIR!= cat PREVIOUSTOOLDIR
251 . else
252 PREVIOUSTOOLDIR=
253 . endif
254 .endif
256 CLEANFILES+= PREVIOUSTOOLDIR
258 realall realdepend: .MAKE
259 .if !empty(PREVIOUSTOOLDIR) && "${PREVIOUSTOOLDIR}" != "${TOOLDIR}"
260 @echo "*** WARNING: TOOLDIR has moved?"
261 @echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'"
262 @echo "*** != TOOLDIR '${TOOLDIR}'"
263 @echo "*** Cleaning mis-matched tools"
264 rm -f PREVIOUSTOOLDIR
265 (cd ${.CURDIR} && ${MAKE} PREVIOUSTOOLDIR=${TOOLDIR} cleandir)
266 .endif
267 echo ${TOOLDIR} >PREVIOUSTOOLDIR
269 cleandir:
270 rm -f ${CLEANFILES}