1 # $NetBSD: Makefile,v 1.182 2015/07/23 08:03:26 mrg 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"
28 . if defined
(HAVE_GCC
) && ${HAVE_GCC} > 0
29 TOOLCHAIN_BITS
= gmake .WAIT
30 TOOLCHAIN_BITS
+= gmp .WAIT
31 TOOLCHAIN_BITS
+= mpfr .WAIT
32 TOOLCHAIN_BITS
+= mpc .WAIT
36 .if
${TOOLCHAIN_MISSING} == "no"
37 TOOLCHAIN_BITS
+= binutils .WAIT
40 .if defined
(HAVE_GCC
) && ${HAVE_GCC} > 0
41 . if
${TOOLCHAIN_MISSING} == "no"
44 # The following test is broken as it still tries to create the directory
45 . if
${MKCROSSGDB
:Uno
} != "no" || make
(obj
)
48 .
endif # !defined(__MINIX)
49 TOOLCHAIN_BITS
+= .WAIT
54 . if
${TOOLCHAIN_MISSING} == "no"
60 .if
${TOOLCHAIN_MISSING} == "no"
61 # XXX Eventually, we want to be able to build dbsym and mdsetimage
62 # XXX if EXTERNAL_TOOLCHAIN is set.
63 TOOLCHAIN_BITS
+= dbsym mdsetimage
65 .
endif # !defined(__MINIX)
68 .if
${MKDTRACE} != "no" ||
${MKCTF} != "no"
69 DTRACE_BITS
+= .WAIT libelf
70 DTRACE_BITS
+= .WAIT libdwarf
71 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 genassym
104 .if
${TOOLS_BUILDRUMP} == "no"
107 makewhatis mtree nbperf .WAIT uudecode
110 SUBDIR
+= cat
join lorder m4 mkdep tsort .WAIT
yacc .WAIT awk .WAIT
lex
112 .if
${TOOLS_BUILDRUMP} == "no"
113 SUBDIR
+= .WAIT texinfo \
116 .WAIT
${TOOLCHAIN_BITS} \
135 SUBDIR
+= .WAIT config
136 .
endif # defined(__MINIX)
138 .if
${MKLLVM} != "no"
141 llvm-lib
/libLLVMSupport llvm-lib
/libLLVMTableGen .WAIT \
142 llvm-tblgen llvm-clang-tblgen .WAIT \
146 . if
${MKLLD} != "no"
149 . if
${MKMCLINKER} != "no"
154 .if
${MKMAN} != "no" ||
${MKDOC} != "no" ||
${MKHTML} != "no"
155 . if
${MKGROFF} != "no"
161 .if
${TOOLS_BUILDRUMP} == "no"
163 .if
${MKMAINTAINERTOOLS
:Uno
} != "no"
164 SUBDIR
+= autoconf .WAIT gettext
167 .if
${USE_PIGZGZIP} != "no"
171 .if
${MACHINE} == "hppa"
175 .if
${MACHINE} == "ibmnws"
176 SUBDIR
+= ibmnws-ncdcs
179 .if
${MACHINE} == "macppc"
180 SUBDIR
+= macppc-fixcoff
183 .if
(${MACHINE} == "prep" ||
${MACHINE} == "rs6000" ||
${MACHINE} == "bebox")
184 SUBDIR
+= powerpc-mkbootimage
187 .if
${MACHINE_ARCH} == "m68k"
188 SUBDIR
+= m68k-elf2aout
191 .if
(${MACHINE_ARCH} == "mipsel" ||
${MACHINE_ARCH} == "mipseb" || \
192 ${MACHINE_ARCH} == "mips64el" ||
${MACHINE_ARCH} == "mips64eb")
193 SUBDIR
+= mips-elf2ecoff
196 .if
(${MACHINE} == "sgimips")
200 .if
${MACHINE} == "acorn32"
204 .if
(${MACHINE_ARCH} == "sparc" ||
${MACHINE_ARCH} == "sparc64")
208 .if
${MACHINE} == "amiga"
209 SUBDIR
+= amiga-elf2bb
213 .if
${MACHINE} == "hp300"
214 SUBDIR
+= hp300-mkboot
217 .if
!defined
(__MINIX
)
218 .if
${MACHINE} == "evbarm" \
219 && ${MACHINE_CPU} == "arm" \
220 && ${TARGET_ENDIANNESS} == "1234"
224 .if
${MACHINE} == "evbarm" ||
${MACHINE} == "evbmips" || \
225 ${MACHINE} == "evbppc" ||
${MACHINE} == "sandpoint"
226 SUBDIR
+= mkubootimage
228 .
endif # !defined(__MINIX)
235 .
endif # TOOLCHAIN_BUILDRUMP
237 check_MKTOOLS
: .PHONY .NOTMAIN
238 .if
${MKTOOLS
:Uyes
} == "no"
239 @echo
'*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and'
240 @echo
'*** updating your host toolchain. This should be used only as a'
241 @echo
'*** temporary workaround for toolchain problems, as it will result'
242 @echo
'*** in version skew and build errors over time!'
245 .if
${MKTOOLS
:Uyes
} == "no" ||
${USETOOLS} != "yes" # {
247 realall realdepend
install: check_MKTOOLS
250 .
include <bsd.subdir.mk
>
251 .
include <bsd.buildinstall.mk
>
252 .
include <bsd.obj.mk
>
254 .if
!defined
(PREVIOUSTOOLDIR
)
255 . if exists
(PREVIOUSTOOLDIR
)
256 PREVIOUSTOOLDIR
!= cat PREVIOUSTOOLDIR
262 CLEANFILES
+= PREVIOUSTOOLDIR
264 realall realdepend
: .MAKE
265 .if
!empty
(PREVIOUSTOOLDIR
) && "${PREVIOUSTOOLDIR}" != "${TOOLDIR}"
266 @echo
"*** WARNING: TOOLDIR has moved?"
267 @echo
"*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'"
268 @echo
"*** != TOOLDIR '${TOOLDIR}'"
269 @echo
"*** Cleaning mis-matched tools"
270 rm -f PREVIOUSTOOLDIR
271 (cd
${.CURDIR
} && ${MAKE} PREVIOUSTOOLDIR
=${TOOLDIR} cleandir
)
273 echo
${TOOLDIR} >PREVIOUSTOOLDIR