1 # $NetBSD: Makefile,v 1.170 2013/09/02 14:34:57 joerg Exp $
4 .
include <bsd.endian.mk
>
6 # Make sure that the ordered build/install processing applies when using
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}"
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".
27 .if
${TOOLCHAIN_MISSING} == "no"
29 TOOLCHAIN_BITS
= gmake .WAIT
34 TOOLCHAIN_BITS
+= gmp .WAIT
35 TOOLCHAIN_BITS
+= mpfr .WAIT
36 TOOLCHAIN_BITS
+= mpc .WAIT
41 .if
${TOOLCHAIN_MISSING} == "no"
42 TOOLCHAIN_BITS
+= binutils .WAIT
46 .if
${TOOLCHAIN_MISSING} == "no"
48 . if
${MKCROSSGDB
:Uno
} != "no" # LSC: Doesn't work || make(obj)
51 TOOLCHAIN_BITS
+= .WAIT
56 .if
${TOOLCHAIN_MISSING} == "no"
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
67 .
endif # !defined(__MINIX)
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
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
95 .if make
(dependall-compat
) && make
(dependall-binstall
)
96 dependall-binstall
: dependall-compat
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"
107 makewhatis mtree nbperf .WAIT
110 SUBDIR
+= join lorder m4 mkdep tsort .WAIT
yacc .WAIT awk .WAIT
lex
112 .if
${TOOLS_BUILDRUMP} == "no"
113 SUBDIR
+= .WAIT texinfo \
116 .WAIT
${TOOLCHAIN_BITS} \
134 SUBDIR
+= .WAIT config
135 .
endif # defined(__MINIX)
137 .if
${MKLLVM} != "no"
140 llvm-lib
/libLLVMSupport llvm-lib
/libLLVMTableGen .WAIT \
141 llvm-tblgen llvm-clang-tblgen .WAIT \
148 .if
${MKMCLINKER} != "no"
153 .if
${MKMAN} != "no" ||
${MKDOC} != "no" ||
${MKHTML} != "no"
154 . if
${MKGROFF} != "no"
160 .if
${TOOLS_BUILDRUMP} == "no"
162 .if
${MKMAINTAINERTOOLS
:Uno
} != "no"
163 SUBDIR
+= autoconf .WAIT gettext
166 .if
${USE_PIGZGZIP} != "no"
170 .if
${MACHINE} == "hp700"
171 SUBDIR
+= hp700-mkboot
174 .if
${MACHINE} == "ibmnws"
175 SUBDIR
+= ibmnws-ncdcs
178 .if
${MACHINE} == "macppc"
179 SUBDIR
+= macppc-fixcoff
182 .if
(${MACHINE} == "prep" ||
${MACHINE} == "rs6000" ||
${MACHINE} == "bebox")
183 SUBDIR
+= powerpc-mkbootimage
186 .if
${MACHINE_ARCH} == "m68k"
187 SUBDIR
+= m68k-elf2aout
190 .if
(${MACHINE_ARCH} == "mipsel" ||
${MACHINE_ARCH} == "mipseb" || \
191 ${MACHINE_ARCH} == "mips64el" ||
${MACHINE_ARCH} == "mips64eb")
192 SUBDIR
+= mips-elf2ecoff
195 .if
(${MACHINE} == "sgimips")
199 .if
${MACHINE} == "acorn32"
203 .if
(${MACHINE_ARCH} == "sparc" ||
${MACHINE_ARCH} == "sparc64")
207 .if
${MACHINE} == "amiga"
208 SUBDIR
+= amiga-elf2bb
212 .if
${MACHINE} == "hp300"
213 SUBDIR
+= hp300-mkboot
216 .if
!defined
(__MINIX
)
217 .if
${MACHINE} == "evbarm" \
218 && ${MACHINE_CPU} == "arm" \
219 && ${TARGET_ENDIANNESS} == "1234"
223 .if
${MACHINE} == "evbarm" ||
${MACHINE} == "evbmips" || \
224 ${MACHINE} == "evbppc" ||
${MACHINE} == "sandpoint"
225 SUBDIR
+= mkubootimage
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!'
239 .if
${MKTOOLS
:Uyes
} == "no" ||
${USETOOLS} != "yes" # {
241 realall realdepend
install: check_MKTOOLS
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
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
)
267 echo
${TOOLDIR} >PREVIOUSTOOLDIR