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 makewhatis mkdep mtree .WAIT \
72 .WAIT
${TOOLCHAIN_BITS} \
80 # .WAIT between llvm-tblgen and llvm-clang-tblgen ensures install
81 # rules works correctly
84 llvm-lib
/libLLVMSupport llvm-lib
/libLLVMTableGen .WAIT \
85 llvm-tblgen .WAIT llvm-clang-tblgen .WAIT \
91 .if
${MKMAN} != "no" ||
${MKDOC} != "no" ||
${MKHTML} != "no"
92 . if
${MKGROFF} != "no"
98 .if
${MKMAINTAINERTOOLS
:Uno
} != "no"
99 SUBDIR
+= autoconf .WAIT gettext
102 .if
${USE_PIGZGZIP} != "no"
106 .if
${MACHINE} == "hp700"
107 SUBDIR
+= hp700-mkboot
110 .if
${MACHINE} == "ibmnws"
111 SUBDIR
+= ibmnws-ncdcs
114 .if
${MACHINE} == "macppc"
115 SUBDIR
+= macppc-fixcoff
118 .if
(${MACHINE} == "prep" ||
${MACHINE} == "rs6000" ||
${MACHINE} == "bebox")
119 SUBDIR
+= powerpc-mkbootimage
122 .if
${MACHINE_ARCH} == "m68k"
123 SUBDIR
+= m68k-elf2aout
126 .if
(${MACHINE_ARCH} == "mipsel" ||
${MACHINE_ARCH} == "mipseb" || \
127 ${MACHINE_ARCH} == "mips64el" ||
${MACHINE_ARCH} == "mips64eb")
128 SUBDIR
+= mips-elf2ecoff
131 .if
(${MACHINE} == "sgimips")
135 .if
${MACHINE} == "acorn32"
139 .if
(${MACHINE_ARCH} == "sparc" ||
${MACHINE_ARCH} == "sparc64")
143 .if
${MACHINE} == "amiga"
144 SUBDIR
+= amiga-elf2bb
148 .if
${MACHINE} == "hp300"
149 SUBDIR
+= hp300-mkboot
152 .if
!defined
(__MINIX
)
153 .if
${MACHINE} == "evbarm" ||
${MACHINE} == "evbmips" || \
154 ${MACHINE} == "evbppc" ||
${MACHINE} == "sandpoint"
155 SUBDIR
+= mkubootimage
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!'
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}:
176 .
include <bsd.subdir.mk
>
177 .
include <bsd.obj.mk
>
179 .if
!defined
(PREVIOUSTOOLDIR
)
180 . if exists
(PREVIOUSTOOLDIR
)
181 PREVIOUSTOOLDIR
!= cat PREVIOUSTOOLDIR
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
)
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.
219 .for d in
${SUBDIR} # {
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}
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