1 # $NetBSD: Makefile,v 1.157 2012/09/20 15:50:20 pooka Exp $
5 .if defined
(HAVE_GCC
) || defined
(HAVE_PCC
)
6 TOOLCHAIN_BITS
= gmake .WAIT
9 .if
${TOOLCHAIN_MISSING} == "no"
12 TOOLCHAIN_BITS
+= gmp .WAIT
13 TOOLCHAIN_BITS
+= mpfr .WAIT
14 TOOLCHAIN_BITS
+= mpc .WAIT
19 .if
${TOOLCHAIN_MISSING} == "no"
20 TOOLCHAIN_BITS
+= binutils .WAIT
24 .if
${TOOLCHAIN_MISSING} == "no"
26 . if
${MKCROSSGDB
:Uno
} != "no"
29 TOOLCHAIN_BITS
+= .WAIT
34 .if
${TOOLCHAIN_MISSING} == "no"
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
45 .
endif # !defined(__MINIX)
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
60 # Dependencies in SUBDIR below ordered to maximize parallel ability.
61 SUBDIR
= host-mkdep .WAIT compat .WAIT \
62 binstall .WAIT mktemp .WAIT sed .WAIT \
64 lorder makewhatis mkdep mtree nbperf .WAIT tsort \
73 .WAIT
${TOOLCHAIN_BITS} \
81 # .WAIT between llvm-tblgen and llvm-clang-tblgen ensures install
82 # rules works correctly
85 llvm-lib
/libLLVMSupport llvm-lib
/libLLVMTableGen .WAIT \
86 llvm-tblgen .WAIT llvm-clang-tblgen .WAIT \
92 .if
${MKMAN} != "no" ||
${MKDOC} != "no" ||
${MKHTML} != "no"
93 . if
${MKGROFF} != "no"
99 .if
${MKMAINTAINERTOOLS
:Uno
} != "no"
100 SUBDIR
+= autoconf .WAIT gettext
103 .if
${USE_PIGZGZIP} != "no"
107 .if
${MACHINE} == "hp700"
108 SUBDIR
+= hp700-mkboot
111 .if
${MACHINE} == "ibmnws"
112 SUBDIR
+= ibmnws-ncdcs
115 .if
${MACHINE} == "macppc"
116 SUBDIR
+= macppc-fixcoff
119 .if
(${MACHINE} == "prep" ||
${MACHINE} == "rs6000" ||
${MACHINE} == "bebox")
120 SUBDIR
+= powerpc-mkbootimage
123 .if
${MACHINE_ARCH} == "m68k"
124 SUBDIR
+= m68k-elf2aout
127 .if
(${MACHINE_ARCH} == "mipsel" ||
${MACHINE_ARCH} == "mipseb" || \
128 ${MACHINE_ARCH} == "mips64el" ||
${MACHINE_ARCH} == "mips64eb")
129 SUBDIR
+= mips-elf2ecoff
132 .if
(${MACHINE} == "sgimips")
136 .if
${MACHINE} == "acorn32"
140 .if
(${MACHINE_ARCH} == "sparc" ||
${MACHINE_ARCH} == "sparc64")
144 .if
${MACHINE} == "amiga"
145 SUBDIR
+= amiga-elf2bb
149 .if
${MACHINE} == "hp300"
150 SUBDIR
+= hp300-mkboot
153 .if
!defined
(__MINIX
)
154 .if
${MACHINE} == "evbarm" ||
${MACHINE} == "evbmips" || \
155 ${MACHINE} == "evbppc" ||
${MACHINE} == "sandpoint"
156 SUBDIR
+= mkubootimage
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!'
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}:
177 .
include <bsd.subdir.mk
>
178 .
include <bsd.obj.mk
>
180 .if
!defined
(PREVIOUSTOOLDIR
)
181 . if exists
(PREVIOUSTOOLDIR
)
182 PREVIOUSTOOLDIR
!= cat PREVIOUSTOOLDIR
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
)
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.
220 .for d in
${SUBDIR} # {
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}
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