1 # $NetBSD: Makefile,v 1.182 2015/07/23 08:03:26 mrg Exp $
4 .
include <bsd.endian.mk
>
7 # Some tools do not compile warning free with newer toolchains.
10 .
endif # defined(__MINIX)
11 # Make sure that the ordered build/install processing applies when using
15 # TOOLDIR must be valid, unless MKTOOLS=no
16 .if
${MKTOOLS
:Uyes
} != "no"
17 .if
"${TOOLDIR}" == ""
18 .error
"TOOLDIR is undefined or empty"
19 .elif
"${TOOLDIR:tW:M/*}" == ""
20 .error
"TOOLDIR is not an absolute path: ${TOOLDIR}"
21 #.elif !exists(TOOLDIR) # XXX .exists fails for directories
22 #.error "TOOLDIR does not exist: ${TOOLDIR}"
24 .
endif # MKTOOLS != no
26 # TOOLS_BUILDRUMP == yes builds only the subset of the tools required
27 # for building rump kernels and the hypervisor. It is typically used
28 # when building rump kernels targeted for non-NetBSD systems (via
29 # buildrump.sh), and should not be set for a regular "make build".
32 .if
${TOOLCHAIN_MISSING} == "no"
33 . if defined
(HAVE_GCC
) && ${HAVE_GCC} > 0
34 TOOLCHAIN_BITS
= gmake .WAIT
35 TOOLCHAIN_BITS
+= gmp .WAIT
36 TOOLCHAIN_BITS
+= mpfr .WAIT
37 TOOLCHAIN_BITS
+= mpc .WAIT
41 .if
${TOOLCHAIN_MISSING} == "no"
42 TOOLCHAIN_BITS
+= binutils .WAIT
45 .if defined
(HAVE_GCC
) && ${HAVE_GCC} > 0
46 . if
${TOOLCHAIN_MISSING} == "no"
49 # The following test is broken as it still tries to create the directory
50 . if
${MKCROSSGDB
:Uno
} != "no" || make
(obj
)
53 .
endif # !defined(__MINIX)
54 TOOLCHAIN_BITS
+= .WAIT
59 . if
${TOOLCHAIN_MISSING} == "no"
65 .if
${TOOLCHAIN_MISSING} == "no"
66 # XXX Eventually, we want to be able to build dbsym and mdsetimage
67 # XXX if EXTERNAL_TOOLCHAIN is set.
68 TOOLCHAIN_BITS
+= dbsym mdsetimage
70 .
endif # !defined(__MINIX)
73 .if
${MKDTRACE} != "no" ||
${MKCTF} != "no"
74 DTRACE_BITS
+= .WAIT libelf
75 DTRACE_BITS
+= .WAIT libdwarf
76 DTRACE_BITS
+= .WAIT libctf
79 DTRACE_BITS
+= .WAIT ctfconvert ctfmerge
87 # All of host-mkdep, compat, and binstall are needed before anything
88 # else. Within this group, they must be built in a specific order, and
89 # all of them must be built before any of them is installed. They may
90 # be installed in any order. This can't be expressed using the .WAIT
91 # notation inside the SUBDIR list.
93 # XXX .ORDER does not work when multiple targets are passed on the
94 # make command line without "-j", so use dependencies in addition to .ORDER.
96 .ORDER
: dependall-host-mkdep dependall-compat dependall-binstall
97 .if make
(dependall-host-mkdep
) && make
(dependall-compat
)
98 dependall-compat
: dependall-host-mkdep
100 .if make
(dependall-compat
) && make
(dependall-binstall
)
101 dependall-binstall
: dependall-compat
104 # Dependencies in SUBDIR below ordered to maximize parallel ability.
105 # See above for special treatment for host-mkdep, compat, and binstall.
107 SUBDIR
= host-mkdep compat binstall \
108 .WAIT mktemp .WAIT sed .WAIT genassym
109 .if
${TOOLS_BUILDRUMP} == "no"
112 makewhatis mtree nbperf .WAIT uudecode
115 SUBDIR
+= cat
join lorder m4 mkdep tsort .WAIT
yacc .WAIT awk .WAIT
lex
117 .if
${TOOLS_BUILDRUMP} == "no"
118 SUBDIR
+= .WAIT texinfo \
121 .WAIT
${TOOLCHAIN_BITS} \
125 makefs .WAIT mkcsmapper mkesdb mklocale \
140 SUBDIR
+= .WAIT config
141 .
endif # defined(__MINIX)
143 .if
${MKLLVM} != "no"
146 llvm-lib
/libLLVMSupport llvm-lib
/libLLVMTableGen .WAIT \
147 llvm-tblgen llvm-clang-tblgen .WAIT \
151 . if
${MKLLD} != "no"
154 . if
${MKMCLINKER} != "no"
159 .if
${MKMAN} != "no" ||
${MKDOC} != "no" ||
${MKHTML} != "no"
160 . if
${MKGROFF} != "no"
166 .if
${TOOLS_BUILDRUMP} == "no"
168 .if
${MKMAINTAINERTOOLS
:Uno
} != "no"
169 SUBDIR
+= autoconf .WAIT gettext
172 .if
${USE_PIGZGZIP} != "no"
176 .if
${MACHINE} == "hppa"
180 .if
${MACHINE} == "ibmnws"
181 SUBDIR
+= ibmnws-ncdcs
184 .if
${MACHINE} == "macppc"
185 SUBDIR
+= macppc-fixcoff
188 .if
(${MACHINE} == "prep" ||
${MACHINE} == "rs6000" ||
${MACHINE} == "bebox")
189 SUBDIR
+= powerpc-mkbootimage
192 .if
${MACHINE_ARCH} == "m68k"
193 SUBDIR
+= m68k-elf2aout
196 .if
(${MACHINE_ARCH} == "mipsel" ||
${MACHINE_ARCH} == "mipseb" || \
197 ${MACHINE_ARCH} == "mips64el" ||
${MACHINE_ARCH} == "mips64eb")
198 SUBDIR
+= mips-elf2ecoff
201 .if
(${MACHINE} == "sgimips")
205 .if
${MACHINE} == "acorn32"
209 .if
(${MACHINE_ARCH} == "sparc" ||
${MACHINE_ARCH} == "sparc64")
213 .if
${MACHINE} == "amiga"
214 SUBDIR
+= amiga-elf2bb
218 .if
${MACHINE} == "hp300"
219 SUBDIR
+= hp300-mkboot
222 .if
!defined
(__MINIX
)
223 .if
${MACHINE} == "evbarm" \
224 && ${MACHINE_CPU} == "arm" \
225 && ${TARGET_ENDIANNESS} == "1234"
229 .if
${MACHINE} == "evbarm" ||
${MACHINE} == "evbmips" || \
230 ${MACHINE} == "evbppc" ||
${MACHINE} == "sandpoint"
231 SUBDIR
+= mkubootimage
233 .
endif # !defined(__MINIX)
240 .
endif # TOOLCHAIN_BUILDRUMP
242 check_MKTOOLS
: .PHONY .NOTMAIN
243 .if
${MKTOOLS
:Uyes
} == "no"
244 @echo
'*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and'
245 @echo
'*** updating your host toolchain. This should be used only as a'
246 @echo
'*** temporary workaround for toolchain problems, as it will result'
247 @echo
'*** in version skew and build errors over time!'
250 .if
${MKTOOLS
:Uyes
} == "no" ||
${USETOOLS} != "yes" # {
252 realall realdepend
install: check_MKTOOLS
255 .
include <bsd.subdir.mk
>
256 .
include <bsd.buildinstall.mk
>
257 .
include <bsd.obj.mk
>
259 .if
!defined
(PREVIOUSTOOLDIR
)
260 . if exists
(PREVIOUSTOOLDIR
)
261 PREVIOUSTOOLDIR
!= cat PREVIOUSTOOLDIR
267 CLEANFILES
+= PREVIOUSTOOLDIR
269 realall realdepend
: .MAKE
270 .if
!empty
(PREVIOUSTOOLDIR
) && "${PREVIOUSTOOLDIR}" != "${TOOLDIR}"
271 @echo
"*** WARNING: TOOLDIR has moved?"
272 @echo
"*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'"
273 @echo
"*** != TOOLDIR '${TOOLDIR}'"
274 @echo
"*** Cleaning mis-matched tools"
275 rm -f PREVIOUSTOOLDIR
276 (cd
${.CURDIR
} && ${MAKE} PREVIOUSTOOLDIR
=${TOOLDIR} cleandir
)
278 echo
${TOOLDIR} >PREVIOUSTOOLDIR