iso9660fs: initialize buffer cache
[minix.git] / tools / Makefile
blobaaf7680043b886fb2d406586c688e35115231fd0
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 \
64 makewhatis mkdep mtree .WAIT \
65 m4 \
66 .WAIT mkfs.mfs \
67 .WAIT yacc \
68 .WAIT awk \
69 .WAIT tic \
70 .WAIT lex \
71 .WAIT pax \
72 .WAIT ${TOOLCHAIN_BITS} \
73 ${DTRACE_BITS} \
74 cat cksum \
75 file \
76 .WAIT \
77 pwd_mkdb stat zic
79 .if ${MKLLVM} != "no"
80 # .WAIT between llvm-tblgen and llvm-clang-tblgen ensures install
81 # rules works correctly
82 SUBDIR+= \
83 llvm .WAIT \
84 llvm-lib/libLLVMSupport llvm-lib/libLLVMTableGen .WAIT \
85 llvm-tblgen .WAIT llvm-clang-tblgen .WAIT \
86 llvm-include .WAIT \
87 llvm-lib .WAIT \
88 llvm-clang
89 .endif
91 .if ${MKMAN} != "no" || ${MKDOC} != "no" || ${MKHTML} != "no"
92 . if ${MKGROFF} != "no"
93 SUBDIR+= groff
94 . endif
95 SUBDIR+= mandoc
96 .endif
98 .if ${MKMAINTAINERTOOLS:Uno} != "no"
99 SUBDIR+= autoconf .WAIT gettext
100 .endif
102 .if ${USE_PIGZGZIP} != "no"
103 SUBDIR+= pigz
104 .endif
106 .if ${MACHINE} == "hp700"
107 SUBDIR+= hp700-mkboot
108 .endif
110 .if ${MACHINE} == "ibmnws"
111 SUBDIR+= ibmnws-ncdcs
112 .endif
114 .if ${MACHINE} == "macppc"
115 SUBDIR+= macppc-fixcoff
116 .endif
118 .if (${MACHINE} == "prep" || ${MACHINE} == "rs6000" || ${MACHINE} == "bebox")
119 SUBDIR+= powerpc-mkbootimage
120 .endif
122 .if ${MACHINE_ARCH} == "m68k"
123 SUBDIR+= m68k-elf2aout
124 .endif
126 .if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \
127 ${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb")
128 SUBDIR+= mips-elf2ecoff
129 .endif
131 .if (${MACHINE} == "sgimips")
132 SUBDIR+= sgivol
133 .endif
135 .if ${MACHINE} == "acorn32"
136 SUBDIR+= sparkcrc
137 .endif
139 .if (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64")
140 SUBDIR+= fgen
141 .endif
143 .if ${MACHINE} == "amiga"
144 SUBDIR+= amiga-elf2bb
145 SUBDIR+= amiga-txlt
146 .endif
148 .if ${MACHINE} == "hp300"
149 SUBDIR+= hp300-mkboot
150 .endif
152 .if !defined(__MINIX)
153 .if ${MACHINE} == "evbarm" || ${MACHINE} == "evbmips" || \
154 ${MACHINE} == "evbppc" || ${MACHINE} == "sandpoint"
155 SUBDIR+= mkubootimage
156 .endif
157 .endif # !defined(__MINIX)
159 check_MKTOOLS: .PHONY .NOTMAIN
160 .if ${MKTOOLS:Uyes} == "no"
161 @echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and'
162 @echo '*** updating your host toolchain. This should be used only as a'
163 @echo '*** temporary workaround for toolchain problems, as it will result'
164 @echo '*** in version skew and build errors over time!'
165 .endif
167 .if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes" # {
168 realall realdepend install: check_MKTOOLS
170 .for dir in ${SUBDIR:N.WAIT}
171 all-${dir} depend-${dir} dependall-${dir} install-${dir}:
172 @true
173 .endfor
174 .endif # }
176 .include <bsd.subdir.mk>
177 .include <bsd.obj.mk>
179 .if !defined(PREVIOUSTOOLDIR)
180 . if exists(PREVIOUSTOOLDIR)
181 PREVIOUSTOOLDIR!= cat PREVIOUSTOOLDIR
182 . else
183 PREVIOUSTOOLDIR=
184 . endif
185 .endif
187 CLEANFILES+= PREVIOUSTOOLDIR
189 realall realdepend: .MAKE
190 .if !empty(PREVIOUSTOOLDIR) && "${PREVIOUSTOOLDIR}" != "${TOOLDIR}"
191 @echo "*** WARNING: TOOLDIR has moved?"
192 @echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'"
193 @echo "*** != TOOLDIR '${TOOLDIR}'"
194 @echo "*** Cleaning mis-matched tools"
195 rm -f PREVIOUSTOOLDIR
196 (cd ${.CURDIR} && ${MAKE} PREVIOUSTOOLDIR=${TOOLDIR} cleandir)
197 .endif
198 echo ${TOOLDIR} >PREVIOUSTOOLDIR
200 # For each .WAIT point, make sure the immediately preceding target is
201 # installed before building anything after that point.
202 # (dsl: which means that with: 'a b .WAIT c' the build of 'c' waits for the
203 # install of 'b', but not the install of 'a'.)
205 # We use the "internal" targets and dependencies generated by <bsd.subdir.mk>
206 # to achieve this. These targets look like:
207 # subdir-all: all-dir1 [.WAIT] all-dir2 etc..
208 # subdir-install: install-dir1 [.WAIT] install-dir2 etc..
209 # and so on for each element in ${TARGETS}, with .WAIT sources inserted at
210 # places corresponding to the .WAITs in our $SUBDIR variable.
212 # Also, since we're now mixing `install' with `all' and `depend' targets
213 # an order relationship between those in each individual subdirectory
214 # must be established.
216 _deps:=
217 _prev:=
219 .for d in ${SUBDIR} # {
220 _this:= ${d}
222 .if ${_this} == ".WAIT" # {
224 # setup dependency to apply to all/depend targets in the next group
225 _deps:= ${_deps} ${_prev:S/^/install-/}
227 # if we're building *only* individual targets (i.e. "dependall-yacc"),
228 # make sure prerequisite tools build before installing
229 # XXX: dsl: this is likely to generate a dependency loop since there is
230 # a .ORDER releation between the nodes as well.
231 .if !make(all) && !make(dependall) && !make(install)
232 install-${_prev}: dependall-${_prev}
233 .endif
235 .else # ${_this} != ".WAIT" # } {
237 # order depend/all/install targets for ${d} subdir.
238 .ORDER: depend-${d} all-${d} dependall-${d} install-${d}
240 # prevent cleandir in real{all,depend} from interfering with subdir makes
241 .ORDER: realdepend dependall-${d}
242 .ORDER: realdepend depend-${d}
243 .ORDER: realall all-${d}
245 # make all/depend-${d} dependent on list of install targets
246 depend-${d} all-${d} dependall-${d}: ${_deps}
248 .endif # ${_this} != ".WAIT" # }
250 # stash current name in case the next entry is .WAIT
251 _prev:= ${d}
252 .endfor # }
254 cleandir:
255 rm -f ${CLEANFILES}