kernel, random: adaptive entropy gathering
[minix3.git] / tools / Makefile
blobb5fba52e76b0b5987a609d35058374f3dfe62b98
1 # $NetBSD: Makefile,v 1.157 2012/09/20 15:50:20 pooka Exp $
3 .include <bsd.own.mk>
5 .if defined(HAVE_GCC) || defined(HAVE_PCC)
6 TOOLCHAIN_BITS= gmake .WAIT
7 .endif
9 .if ${TOOLCHAIN_MISSING} == "no"
10 .if defined(HAVE_GCC)
11 .if ${HAVE_GCC} >= 45
12 TOOLCHAIN_BITS+= gmp .WAIT
13 TOOLCHAIN_BITS+= mpfr .WAIT
14 TOOLCHAIN_BITS+= mpc .WAIT
15 .endif
16 .endif
17 .endif
19 .if ${TOOLCHAIN_MISSING} == "no"
20 TOOLCHAIN_BITS+= binutils .WAIT
21 .endif
23 .if defined(HAVE_GCC)
24 .if ${TOOLCHAIN_MISSING} == "no"
25 TOOLCHAIN_BITS+= gcc
26 . if ${MKCROSSGDB:Uno} != "no"
27 TOOLCHAIN_BITS+= gdb
28 . endif
29 TOOLCHAIN_BITS+= .WAIT
30 .endif
31 .endif
33 .if defined(HAVE_PCC)
34 .if ${TOOLCHAIN_MISSING} == "no"
35 TOOLCHAIN_BITS+= pcc
36 .endif
37 .endif
39 .if !defined(__MINIX)
40 .if ${TOOLCHAIN_MISSING} == "no"
41 # XXX Eventually, we want to be able to build dbsym and mdsetimage
42 # XXX if EXTERNAL_TOOLCHAIN is set.
43 TOOLCHAIN_BITS+= dbsym mdsetimage
44 .endif
45 .endif # !defined(__MINIX)
47 DTRACE_BITS=
48 .if ${MKDTRACE} != "no"
49 DTRACE_BITS+= .WAIT libelf
50 DTRACE_BITS+= .WAIT libdwarf
51 DTRACE_BITS+= .WAIT libctf
52 DTRACE_BITS+= .WAIT ctfconvert ctfmerge
53 .endif
55 LINT_BITS=
56 .if ${MKLINT} != "no"
57 LINT_BITS= lint lint2
58 .endif
60 # Dependencies in SUBDIR below ordered to maximize parallel ability.
61 SUBDIR= host-mkdep .WAIT compat .WAIT \
62 binstall .WAIT mktemp .WAIT sed .WAIT \
63 genassym join \
64 lorder makewhatis mkdep mtree nbperf .WAIT tsort \
65 m4 \
66 .WAIT mkfs.mfs \
67 .WAIT toproto \
68 .WAIT yacc \
69 .WAIT awk \
70 .WAIT tic \
71 .WAIT lex \
72 .WAIT pax \
73 .WAIT ${TOOLCHAIN_BITS} \
74 ${DTRACE_BITS} \
75 cat cksum \
76 file \
77 .WAIT \
78 pwd_mkdb stat zic
80 .if ${MKLLVM} != "no"
81 # .WAIT between llvm-tblgen and llvm-clang-tblgen ensures install
82 # rules works correctly
83 SUBDIR+= \
84 llvm .WAIT \
85 llvm-lib/libLLVMSupport llvm-lib/libLLVMTableGen .WAIT \
86 llvm-tblgen .WAIT llvm-clang-tblgen .WAIT \
87 llvm-include .WAIT \
88 llvm-lib .WAIT \
89 llvm-clang
90 .endif
92 .if ${MKMAN} != "no" || ${MKDOC} != "no" || ${MKHTML} != "no"
93 . if ${MKGROFF} != "no"
94 SUBDIR+= groff
95 . endif
96 SUBDIR+= mandoc
97 .endif
99 .if ${MKMAINTAINERTOOLS:Uno} != "no"
100 SUBDIR+= autoconf .WAIT gettext
101 .endif
103 .if ${USE_PIGZGZIP} != "no"
104 SUBDIR+= pigz
105 .endif
107 .if ${MACHINE} == "hp700"
108 SUBDIR+= hp700-mkboot
109 .endif
111 .if ${MACHINE} == "ibmnws"
112 SUBDIR+= ibmnws-ncdcs
113 .endif
115 .if ${MACHINE} == "macppc"
116 SUBDIR+= macppc-fixcoff
117 .endif
119 .if (${MACHINE} == "prep" || ${MACHINE} == "rs6000" || ${MACHINE} == "bebox")
120 SUBDIR+= powerpc-mkbootimage
121 .endif
123 .if ${MACHINE_ARCH} == "m68k"
124 SUBDIR+= m68k-elf2aout
125 .endif
127 .if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \
128 ${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb")
129 SUBDIR+= mips-elf2ecoff
130 .endif
132 .if (${MACHINE} == "sgimips")
133 SUBDIR+= sgivol
134 .endif
136 .if ${MACHINE} == "acorn32"
137 SUBDIR+= sparkcrc
138 .endif
140 .if (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64")
141 SUBDIR+= fgen
142 .endif
144 .if ${MACHINE} == "amiga"
145 SUBDIR+= amiga-elf2bb
146 SUBDIR+= amiga-txlt
147 .endif
149 .if ${MACHINE} == "hp300"
150 SUBDIR+= hp300-mkboot
151 .endif
153 .if !defined(__MINIX)
154 .if ${MACHINE} == "evbarm" || ${MACHINE} == "evbmips" || \
155 ${MACHINE} == "evbppc" || ${MACHINE} == "sandpoint"
156 SUBDIR+= mkubootimage
157 .endif
158 .endif # !defined(__MINIX)
160 check_MKTOOLS: .PHONY .NOTMAIN
161 .if ${MKTOOLS:Uyes} == "no"
162 @echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and'
163 @echo '*** updating your host toolchain. This should be used only as a'
164 @echo '*** temporary workaround for toolchain problems, as it will result'
165 @echo '*** in version skew and build errors over time!'
166 .endif
168 .if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes" # {
169 realall realdepend install: check_MKTOOLS
171 .for dir in ${SUBDIR:N.WAIT}
172 all-${dir} depend-${dir} dependall-${dir} install-${dir}:
173 @true
174 .endfor
175 .endif # }
177 .include <bsd.subdir.mk>
178 .include <bsd.obj.mk>
180 .if !defined(PREVIOUSTOOLDIR)
181 . if exists(PREVIOUSTOOLDIR)
182 PREVIOUSTOOLDIR!= cat PREVIOUSTOOLDIR
183 . else
184 PREVIOUSTOOLDIR=
185 . endif
186 .endif
188 CLEANFILES+= PREVIOUSTOOLDIR
190 realall realdepend: .MAKE
191 .if !empty(PREVIOUSTOOLDIR) && "${PREVIOUSTOOLDIR}" != "${TOOLDIR}"
192 @echo "*** WARNING: TOOLDIR has moved?"
193 @echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'"
194 @echo "*** != TOOLDIR '${TOOLDIR}'"
195 @echo "*** Cleaning mis-matched tools"
196 rm -f PREVIOUSTOOLDIR
197 (cd ${.CURDIR} && ${MAKE} PREVIOUSTOOLDIR=${TOOLDIR} cleandir)
198 .endif
199 echo ${TOOLDIR} >PREVIOUSTOOLDIR
201 # For each .WAIT point, make sure the immediately preceding target is
202 # installed before building anything after that point.
203 # (dsl: which means that with: 'a b .WAIT c' the build of 'c' waits for the
204 # install of 'b', but not the install of 'a'.)
206 # We use the "internal" targets and dependencies generated by <bsd.subdir.mk>
207 # to achieve this. These targets look like:
208 # subdir-all: all-dir1 [.WAIT] all-dir2 etc..
209 # subdir-install: install-dir1 [.WAIT] install-dir2 etc..
210 # and so on for each element in ${TARGETS}, with .WAIT sources inserted at
211 # places corresponding to the .WAITs in our $SUBDIR variable.
213 # Also, since we're now mixing `install' with `all' and `depend' targets
214 # an order relationship between those in each individual subdirectory
215 # must be established.
217 _deps:=
218 _prev:=
220 .for d in ${SUBDIR} # {
221 _this:= ${d}
223 .if ${_this} == ".WAIT" # {
225 # setup dependency to apply to all/depend targets in the next group
226 _deps:= ${_deps} ${_prev:S/^/install-/}
228 # if we're building *only* individual targets (i.e. "dependall-yacc"),
229 # make sure prerequisite tools build before installing
230 # XXX: dsl: this is likely to generate a dependency loop since there is
231 # a .ORDER releation between the nodes as well.
232 .if !make(all) && !make(dependall) && !make(install)
233 install-${_prev}: dependall-${_prev}
234 .endif
236 .else # ${_this} != ".WAIT" # } {
238 # order depend/all/install targets for ${d} subdir.
239 .ORDER: depend-${d} all-${d} dependall-${d} install-${d}
241 # prevent cleandir in real{all,depend} from interfering with subdir makes
242 .ORDER: realdepend dependall-${d}
243 .ORDER: realdepend depend-${d}
244 .ORDER: realall all-${d}
246 # make all/depend-${d} dependent on list of install targets
247 depend-${d} all-${d} dependall-${d}: ${_deps}
249 .endif # ${_this} != ".WAIT" # }
251 # stash current name in case the next entry is .WAIT
252 _prev:= ${d}
253 .endfor # }
255 cleandir:
256 rm -f ${CLEANFILES}