1 # $NetBSD: bsd.own.mk,v 1.874 2015/09/30 22:58:02 rjs Exp $
3 # This needs to be before bsd.init.mk
4 .if defined
(BSD_MK_COMPAT_FILE
)
5 .
include <${BSD_MK_COMPAT_FILE}>
8 .if
!defined
(_BSD_OWN_MK_
)
13 # Some Minix deviations from NetBSD
36 #MINIX-specific variables
39 # LSC MINIX does not support these features ATM.
65 WEAKALIASOVERRIDEPASS?
=${NETBSDSRCDIR}/minix
/llvm
/bin
/weak-alias-module-override.so
66 GOLD_PLUGIN?
=${NETBSDSRCDIR}/minix
/llvm
/bin
/LLVMgold.so
68 # By default when running LLVM passes:
69 # - do not run optimization while running LLVM passes
70 # - run the passe which allows assembly weak symbols to be
71 # overriden by bitcode functions
72 OPTFLAGS?
= -disable-opt \
74 -load
${WEAKALIASOVERRIDEPASS} -weak-alias-module-override
76 BITCODE_LD_FLAGS_1ST?
= \
77 -Wl
,-plugin
=${GOLD_PLUGIN} \
78 -Wl
,-plugin-opt
=-disable-opt \
79 -Wl
,-plugin-opt
=-disable-inlining
81 BITCODE_LD_FLAGS_2ND?
=${BITCODE_LD_FLAGS_1ST}
84 SMP_FLAGS
+= -DCONFIG_SMP
85 .
ifdef CONFIG_MAX_CPUS
86 SMP_FLAGS
+= -DCONFIG_MAX_CPUS
=${CONFIG_MAX_CPUS}
90 CPPFLAGS
+= ${SMP_FLAGS}
93 .if
${__uname_s
:Uunknown
} == "Minix"
95 . if
${USETOOLS
:Uno
} != "yes"
98 # If DESTDIR was specified, and we are not using the tools, then make sure to
99 # build out-of-tree and to refer only DESTDIR for target binaries
100 # The case when using tools is already handled below.
101 . if
${DESTDIR
:U
} != ""
102 CPPFLAGS
+= --sysroot
=${DESTDIR}
103 LDFLAGS
+= --sysroot
=${DESTDIR}
104 .
endif # ${DESTDIR:U} != ""
107 .
endif # ${USETOOLS:Uno} != "yes"
109 . if
!defined
(HOSTPROG
) && !defined
(HOSTLIB
)
110 # LSC FIXME: Override MACHINE as the native minix host make command will set
112 . if
${MACHINE_ARCH} == "i386"
115 # LSC FIXME: On a native ARM system MACHINE_ARCH is earmv7 instead of earm...
116 . if
!empty
(MACHINE_ARCH
:Mearm
*)
119 .
endif # !defined(HOSTPROG) && !defined(HOSTLIB)
120 .
endif # __uname_s == "Minix"
122 # LSC FIXME: RELEASEMACHINEDIR is set to evbarm, instead of evbearm-el
123 .if
!empty
(MACHINE
:Mevbarm
*)
124 RELEASEMACHINEDIR
:= evbearm-el
127 .if
${HAVE_GCC
:Dyes
} == "yes" || \
128 (${MKGCCCMDS
:Uno
} == "yes" && ${MKLLVM
:Uyes
} == "no")
129 # We are building with GCC, means we cannot build LIBCXX, and need LIBSTDCXX
130 MKLIBCXX?
= no
# Can't compile with GCC.
132 . if
${USETOOLS
:Uno
} == "yes" ||
${MKLIBSTDCXX
:Uno
} == "yes"
133 # When cross-compiling, or building MKLIBSTDCXX, use the in-tree LIBSTDCXX
135 CXXFLAGS
+= -I
${DESTDIR}/usr
/include/g
++
136 .
endif # ${USETOOLS:Uno} == "yes"
138 . if
${MKLIBSTDCXX
:Uno
} == "no"
139 # Specify the C++ system header for the host libstdc++, as we are not building
141 CXXFLAGS
+= -I
/usr
/include/g
++
142 .
endif # ${MKLIBSTDCXX:Uno} == "no"
144 .
endif # ${HAVE_GCC:Dyes} == "yes" || \
145 # (${MKGCCCMDS:Uno} == "yes" && ${MKLLVM:Uyes} == "no")
147 # MKGCCCMDS == yes implies MKGCC == yes
148 .if
${MKGCCCMDS} == "yes"
150 MKBINUTILS?
= yes
# We are installing GCC, so trigger binutils.
151 MKLIBSTDCXX?
= yes
# Also install the GNU C++ library
152 .
endif # ${MKGCCCMDS} == "yes"
154 # The default value of MKLIBSTDCXX cannot be set before the previous test.
157 .if
${MKGCC} == "yes"
158 HAVE_GCC?
= 5 # Not really, but that's the setting.
161 .
endif # ${MKGCC} == "yes"
163 .if
${USETOOLS
:Uno
} == "yes"
165 .
endif # ${USETOOLS:Uno} == "yes"
167 .if
${MKLLVM
:Uno
} == "yes"
169 MKBINUTILS?
= yes
# We are installing clang, so trigger binutils.
170 .
endif # ${MKLLVM:Uno} == "yes"
172 .if
${HAVE_LLVM
:Dyes
} == "yes"
174 .
endif # ${HAVE_LLVM:Dyes} == "yes"
176 # The default value has to be set after we have figured out if we are using GCC
178 MKLIBCXX?
= yes
# Build by default libc++
180 # The default value of MKBINUTILS cannot be set before the previous test.
183 .
endif # defined(__MINIX)
185 MAKECONF?
= /etc
/mk.conf
186 .
-include "${MAKECONF}"
189 # CPU model, derived from MACHINE_ARCH
191 MACHINE_CPU
= ${MACHINE_ARCH
:C
/mipse
[bl
]/mips
/:C
/mips64e
[bl
]/mips
/:C
/sh3e
[bl
]/sh3
/:S
/coldfire
/m68k
/:S
/m68000
/m68k
/:C
/arm.
*/arm
/:C
/earm.
*/arm
/:S
/earm
/arm
/:S
/powerpc64
/powerpc
/:S
/aarch64eb
/aarch64
/:S
/or1knd
/or1k
/:C
/riscv..
/riscv
/}
194 # Subdirectory used below ${RELEASEDIR} when building a release
196 RELEASEMACHINEDIR?
= ${MACHINE}
199 # Subdirectory or path component used for the following paths:
200 # distrib/${RELEASEMACHINE}
201 # distrib/notes/${RELEASEMACHINE}
202 # etc/etc.${RELEASEMACHINE}
203 # Used when building a release.
205 RELEASEMACHINE?
= ${MACHINE}
208 # NEED_OWN_INSTALL_TARGET is set to "no" by pkgsrc/mk/bsd.pkg.mk to
209 # ensure that things defined by <bsd.own.mk> (default targets,
210 # INSTALL_FILE, etc.) are not conflicting with bsd.pkg.mk.
212 NEED_OWN_INSTALL_TARGET?
= yes
215 # This lists the platforms which do not have working in-tree toolchains. For
216 # the in-tree gcc toolchain, this list is empty.
218 # If some future port is not supported by the in-tree toolchain, this should
219 # be set to "yes" for that port only.
221 .if
${MACHINE} == "playstation2"
222 TOOLCHAIN_MISSING?
= yes
225 TOOLCHAIN_MISSING?
= no
227 .if
${MACHINE_CPU} == "aarch64" && !defined
(EXTERNAL_TOOLCHAIN
) && ${MKLLVM
:Uyes
} != "no"
234 # GCC Using platforms.
236 .if
${MKGCC
:Uyes
} != "no"
238 .if
${MACHINE} == "playstation2" ||
${MACHINE_CPU} == "aarch64"
241 # Otherwise, default to GCC4.8
246 # Platforms that can't run a modern GCC natively
247 .if
${MACHINE_ARCH} == "m68000"
252 # We import the old gcc as "gcc.old" when upgrading. EXTERNAL_GCC_SUBDIR is
253 # set to the relevant subdirectory in src/external/gpl3 for his HAVE_GCC.
256 EXTERNAL_GCC_SUBDIR
= gcc
257 .elif
${HAVE_GCC} == 48
258 EXTERNAL_GCC_SUBDIR
= gcc.old
260 EXTERNAL_GCC_SUBDIR
= /does
/not
/exist
266 .if
!empty
(MACHINE_ARCH
:Mearm
*)
267 _LIBC_COMPILER_RT.
${MACHINE_ARCH}= yes
270 _LIBC_COMPILER_RT.aarch64
= yes
271 _LIBC_COMPILER_RT.i386
= yes
272 _LIBC_COMPILER_RT.powerpc
= yes
273 _LIBC_COMPILER_RT.powerpc64
= yes
274 _LIBC_COMPILER_RT.x86_64
= yes
276 .if
${HAVE_LLVM
:Uno
} == "yes" && ${_LIBC_COMPILER_RT.
${MACHINE_ARCH}:Uno
} == "yes"
283 # ia64 is not support
284 .if
${HAVE_LLVM
:Uno
} == "yes" ||
!empty
(MACHINE_ARCH
:Mearm
*)
292 .if
(${MACHINE_ARCH} == "alpha") || \
293 (${MACHINE_ARCH} == "hppa") || \
294 (${MACHINE_ARCH} == "ia64") || \
295 (${MACHINE_CPU} == "mips")
299 .if
${USE_FORT
:Uno
} != "no"
304 .if empty
(.MAKEFLAGS
:tW
:M
*-V .OBJDIR
*)
305 .if defined
(MAKEOBJDIRPREFIX
) || defined
(MAKEOBJDIR
)
306 PRINTOBJDIR
= ${MAKE} -r
-V .OBJDIR
-f
/dev
/null xxx
308 PRINTOBJDIR
= ${MAKE} -V .OBJDIR
311 PRINTOBJDIR
= echo
/error
/bsd.own.mk
/PRINTOBJDIR
# avoid infinite recursion
315 # Determine if running in the NetBSD source tree by checking for the
316 # existence of build.sh and tools/ in the current or a parent directory,
317 # and setting _SRC_TOP_ to the result.
319 .if
!defined
(_SRC_TOP_
) # {
320 _SRC_TOP_
!= cd
"${.CURDIR}"; while
:; do \
322 [ -f build.sh
] && [ -d tools
] && { echo
$$here; break
; }; \
323 case
$$here in
/) echo
""; break
;; esac
; \
326 .MAKEOVERRIDES
+= _SRC_TOP_
331 # If _SRC_TOP_ != "", we're within the NetBSD source tree.
332 # * Set defaults for NETBSDSRCDIR and _SRC_TOP_OBJ_.
333 # * Define _NETBSD_VERSION_DEPENDS. Targets that depend on the
334 # NetBSD version, or on variables defined at build time, can
335 # declare a dependency on ${_NETBSD_VERSION_DEPENDS}.
337 .if
(${_SRC_TOP_} != "") # {
339 NETBSDSRCDIR?
= ${_SRC_TOP_}
341 .if
!defined
(_SRC_TOP_OBJ_
)
342 _SRC_TOP_OBJ_
!= cd
"${_SRC_TOP_}" && ${PRINTOBJDIR}
343 .MAKEOVERRIDES
+= _SRC_TOP_OBJ_
346 _NETBSD_VERSION_DEPENDS
= ${_SRC_TOP_OBJ_}/params
347 _NETBSD_VERSION_DEPENDS
+= ${NETBSDSRCDIR}/sys
/sys
/param.h
348 _NETBSD_VERSION_DEPENDS
+= ${NETBSDSRCDIR}/sys
/conf
/newvers.sh
349 _NETBSD_VERSION_DEPENDS
+= ${NETBSDSRCDIR}/sys
/conf
/osrelease.sh
350 ${_SRC_TOP_OBJ_}/params
: .NOTMAIN .OPTIONAL
# created by top level "make build"
352 .
endif # _SRC_TOP_ != "" # }
355 .if
(${_SRC_TOP_} != "") && \
356 (${TOOLCHAIN_MISSING} == "no" || defined
(EXTERNAL_TOOLCHAIN
))
362 .if
${MACHINE_ARCH} == "mips" ||
${MACHINE_ARCH} == "mips64" || \
363 ${MACHINE_ARCH} == "sh3"
365 @echo
"Must set MACHINE_ARCH to one of ${MACHINE_ARCH}eb or ${MACHINE_ARCH}el"
367 .elif defined
(REQUIRETOOLS
) && \
368 (${TOOLCHAIN_MISSING} == "no" || defined
(EXTERNAL_TOOLCHAIN
)) && \
371 @echo
"USETOOLS=no, but this component requires a version-specific host toolchain"
376 # Host platform information; may be overridden
378 .
include <bsd.host.mk
>
380 .if
${USETOOLS} == "yes" # {
383 # Provide a default for TOOLDIR.
385 .if
!defined
(TOOLDIR
)
386 TOOLDIR
:= ${_SRC_TOP_OBJ_}/tooldir.
${HOST_OSTYPE}
387 .MAKEOVERRIDES
+= TOOLDIR
391 # This is the prefix used for the NetBSD-sourced tools.
396 # If an external toolchain base is specified, use it.
398 .if defined
(EXTERNAL_TOOLCHAIN
) # {
399 AR
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-ar
400 AS
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-as
401 LD
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-ld
402 NM
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-nm
403 OBJCOPY
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-objcopy
404 OBJDUMP
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-objdump
405 RANLIB
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-ranlib
406 READELF
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-readelf
407 SIZE
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-size
408 STRINGS
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-strings
409 STRIP
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-strip
411 TOOL_CC.gcc
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-gcc
412 TOOL_CPP.gcc
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-cpp
413 TOOL_CXX.gcc
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-c
++
414 TOOL_FC.gcc
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-g77
415 TOOL_OBJC.gcc
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-gcc
417 TOOL_CC.clang
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-clang
418 TOOL_CPP.clang
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-clang-cpp
419 TOOL_CXX.clang
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-clang
++
420 TOOL_OBJC.clang
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-clang
421 TOOL_OPT.clang
= ${EXTERNAL_TOOLCHAIN}/bin
/opt
422 TOOL_LLC.clang
= ${EXTERNAL_TOOLCHAIN}/bin
/llc
424 # Define default locations for common tools.
425 .if
${USETOOLS_BINUTILS
:Uyes
} == "yes" # {
426 AR
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-ar
427 AS
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-as
428 LD
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-ld
429 NM
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-nm
430 OBJCOPY
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-objcopy
431 OBJDUMP
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-objdump
432 RANLIB
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-ranlib
433 READELF
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-readelf
434 SIZE
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-size
435 STRINGS
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-strings
436 STRIP
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-strip
438 # GCC supports C, C++, Fortran and Objective C
439 TOOL_CC.gcc
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-gcc
440 TOOL_CPP.gcc
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-cpp
441 TOOL_CXX.gcc
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-c
++
442 TOOL_FC.gcc
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-g77
443 TOOL_OBJC.gcc
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-gcc
446 # Clang supports C, C++ and Objective C
447 TOOL_CC.clang
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-clang
448 TOOL_CPP.clang
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-clang-cpp
449 TOOL_CXX.clang
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-clang
++
450 TOOL_OBJC.clang
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-clang
451 TOOL_OPT.clang
= ${TOOLDIR}/bin
/opt
452 TOOL_LLC.clang
= ${TOOLDIR}/bin
/llc
454 # PCC supports C and Fortran
455 TOOL_CC.pcc
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-pcc
456 TOOL_CPP.pcc
= ${TOOLDIR}/libexec
/${MACHINE_GNU_PLATFORM}-cpp
457 TOOL_CXX.pcc
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-p
++
460 # Make sure DESTDIR is set, so that builds with these tools always
461 # get appropriate -nostdinc, -nostdlib, etc. handling. The default is
462 # <empty string>, meaning start from /, the root directory.
466 .if
!defined
(HOSTPROG
) && !defined
(HOSTLIB
)
467 . if
${DESTDIR} != ""
468 CPPFLAGS
+= --sysroot
=${DESTDIR}
469 LDFLAGS
+= --sysroot
=${DESTDIR}
471 CPPFLAGS
+= --sysroot
=/
472 LDFLAGS
+= --sysroot
=/
475 .
endif # EXTERNAL_TOOLCHAIN # }
477 DBSYM
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-dbsym
478 ELF2AOUT
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}m68k-elf2aout
479 ELF2ECOFF
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}mips-elf2ecoff
480 INSTALL
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-install
481 LEX
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}lex
482 LINT
= CC
=${CC
:Q
} ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-lint
483 LORDER
= NM
=${NM
:Q
} MKTEMP
=${TOOL_MKTEMP
:Q
} ${TOOLDIR}/bin
/${_TOOL_PREFIX}lorder
484 MKDEP
= CC
=${CC
:Q
} ${TOOLDIR}/bin
/${_TOOL_PREFIX}mkdep
485 MKDEPCXX
= CC
=${CXX
:Q
} ${TOOLDIR}/bin
/${_TOOL_PREFIX}mkdep
486 PAXCTL
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}paxctl
487 TSORT
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}tsort
-q
488 YACC
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}yacc
490 TOOL_AMIGAAOUT2BB
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}amiga-aout2bb
491 TOOL_AMIGAELF2BB
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}amiga-elf2bb
492 TOOL_AMIGATXLT
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}amiga-txlt
493 TOOL_ASN1_COMPILE
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}asn1_compile
494 TOOL_AWK
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}awk
495 TOOL_CAP_MKDB
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}cap_mkdb
496 TOOL_CAT
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}cat
497 TOOL_CKSUM
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}cksum
498 TOOL_CLANG_TBLGEN
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}clang-tblgen
499 TOOL_COMPILE_ET
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}compile_et
500 TOOL_CONFIG
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}config
501 TOOL_CRUNCHGEN
= MAKE
=${.MAKE
:Q
} ${TOOLDIR}/bin
/${_TOOL_PREFIX}crunchgen
502 TOOL_CTAGS
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}ctags
503 TOOL_CTFCONVERT
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}ctfconvert
504 TOOL_CTFMERGE
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}ctfmerge
505 TOOL_DB
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}db
506 TOOL_DISKLABEL
= ${TOOLDIR}/bin
/nbdisklabel
507 TOOL_EQN
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}eqn
508 TOOL_FDISK
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-fdisk
509 TOOL_FGEN
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}fgen
510 TOOL_GENASSYM
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}genassym
511 TOOL_GENCAT
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}gencat
512 TOOL_GMAKE
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}gmake
513 TOOL_GREP
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}grep
514 TOOL_GROFF
= PATH
=${TOOLDIR}/lib
/groff
:$${PATH} ${TOOLDIR}/bin
/${_TOOL_PREFIX}groff
515 TOOL_HEXDUMP
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}hexdump
516 TOOL_HP300MKBOOT
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}hp300-mkboot
517 TOOL_HPPAMKBOOT
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}hppa-mkboot
518 TOOL_INDXBIB
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}indxbib
519 TOOL_INSTALLBOOT
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}installboot
520 TOOL_INSTALL_INFO
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}install-info
521 TOOL_JOIN
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}join
522 TOOL_LLVM_TBLGEN
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}llvm-tblgen
523 TOOL_M4
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}m4
524 TOOL_MACPPCFIXCOFF
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}macppc-fixcoff
525 TOOL_MAKEFS
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}makefs
526 TOOL_MAKEINFO
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}makeinfo
527 TOOL_MAKEKEYS
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}makekeys
528 TOOL_MAKESTRS
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}makestrs
529 TOOL_MAKEWHATIS
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}makewhatis
530 TOOL_MANDOC_ASCII
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}mandoc
-Tascii
531 TOOL_MANDOC_HTML
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}mandoc
-Thtml
532 TOOL_MANDOC_LINT
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}mandoc
-Tlint
533 TOOL_MDSETIMAGE
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-mdsetimage
534 TOOL_MENUC
= MENUDEF
=${TOOLDIR}/share
/misc
${TOOLDIR}/bin
/${_TOOL_PREFIX}menuc
535 TOOL_M68KELF2AOUT
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}m68k-elf2aout
536 TOOL_MIPSELF2ECOFF
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}mips-elf2ecoff
537 TOOL_MKCSMAPPER
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}mkcsmapper
538 TOOL_MKESDB
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}mkesdb
539 TOOL_MKFSMFS
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}mkfs.mfs
540 TOOL_MKLOCALE
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}mklocale
541 TOOL_MKMAGIC
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}file
542 TOOL_MKNOD
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}mknod
543 TOOL_MKTEMP
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}mktemp
544 TOOL_MKUBOOTIMAGE
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}mkubootimage
545 TOOL_ELFTOSB
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}elftosb
546 TOOL_MSGC
= MSGDEF
=${TOOLDIR}/share
/misc
${TOOLDIR}/bin
/${_TOOL_PREFIX}msgc
547 TOOL_MTREE
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}mtree
548 TOOL_NBPERF
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}perf
549 TOOL_NCDCS
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}ibmnws-ncdcs
550 TOOL_PAX
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}pax
551 TOOL_PIC
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}pic
552 TOOL_PIGZ
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}pigz
553 TOOL_PKG_CREATE
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}pkg_create
554 TOOL_POWERPCMKBOOTIMAGE
=${TOOLDIR}/bin
/${_TOOL_PREFIX}powerpc-mkbootimage
555 TOOL_PWD_MKDB
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}pwd_mkdb
556 TOOL_REFER
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}refer
557 TOOL_ROFF_ASCII
= PATH
=${TOOLDIR}/lib
/groff
:$${PATH} ${TOOLDIR}/bin
/${_TOOL_PREFIX}nroff
558 TOOL_ROFF_DOCASCII
= ${TOOL_GROFF} -Tascii
559 TOOL_ROFF_DOCHTML
= ${TOOL_GROFF} -Thtml
560 TOOL_ROFF_DVI
= ${TOOL_GROFF} -Tdvi
561 TOOL_ROFF_HTML
= ${TOOL_GROFF} -Tlatin1
-mdoc2html
562 TOOL_ROFF_PS
= ${TOOL_GROFF} -Tps
563 TOOL_ROFF_RAW
= ${TOOL_GROFF} -Z
564 TOOL_RPCGEN
= RPCGEN_CPP
=${CPP
:Q
} ${TOOLDIR}/bin
/${_TOOL_PREFIX}rpcgen
565 TOOL_SED
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}sed
566 TOOL_SLC
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}slc
567 TOOL_SOELIM
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}soelim
568 TOOL_SPARKCRC
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}sparkcrc
569 TOOL_STAT
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}stat
570 TOOL_STRFILE
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}strfile
571 TOOL_SUNLABEL
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}sunlabel
572 TOOL_TBL
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}tbl
573 TOOL_TIC
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}tic
574 TOOL_TOPROTO
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}toproto
575 TOOL_UUDECODE
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}uudecode
576 TOOL_VGRIND
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}vgrind
-f
577 TOOL_VFONTEDPR
= ${TOOLDIR}/libexec
/${_TOOL_PREFIX}vfontedpr
578 TOOL_ZIC
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}zic
580 .
else # USETOOLS != yes # } {
582 # Clang supports C, C++ and Objective C
585 TOOL_CPP.clang
= clang
-E
587 TOOL_CPP.clang
= clang-cpp
588 .
endif # defined(__MINIX)
589 TOOL_CXX.clang
= clang
++
590 TOOL_OBJC.clang
= clang
594 # GCC supports C, C++, Fortran and Objective C
601 # PCC supports C and Fortran
603 TOOL_CPP.pcc
= /usr
/libexec
/pcpp
606 TOOL_AMIGAAOUT2BB
= amiga-aout2bb
607 TOOL_AMIGAELF2BB
= amiga-elf2bb
608 TOOL_AMIGATXLT
= amiga-txlt
609 TOOL_ASN1_COMPILE
= asn1_compile
611 TOOL_CAP_MKDB
= cap_mkdb
615 # LSC: A full path has to be provided, as this is also used as a make
617 . if exists
(/usr
/pkg
/bin
/clang-tblgen
)
618 TOOL_CLANG_TBLGEN
= /usr
/pkg
/bin
/clang-tblgen
620 TOOL_CLANG_TBLGEN
= /usr
/bin
/clang-tblgen
621 .
endif # exists(/usr/pkg/bin/clang-tblgen)
623 TOOL_CLANG_TBLGEN
= clang-tblgen
624 .
endif # defined(__MINIX)
625 TOOL_COMPILE_ET
= compile_et
627 TOOL_CRUNCHGEN
= crunchgen
629 TOOL_CTFCONVERT
= ctfconvert
630 TOOL_CTFMERGE
= ctfmerge
632 TOOL_DISKLABEL
= disklabel
636 TOOL_GENASSYM
= genassym
641 TOOL_HEXDUMP
= hexdump
642 TOOL_HP300MKBOOT
= hp300-mkboot
643 TOOL_HPPAMKBOOT
= hppa-mkboot
644 TOOL_INDXBIB
= indxbib
645 TOOL_INSTALLBOOT
= installboot
646 TOOL_INSTALL_INFO
= install-info
649 # LSC: A full path has to be provided, as this is also used as a make
651 . if exists
(/usr
/pkg
/bin
/llvm-tblgen
)
652 TOOL_LLVM_TBLGEN
= /usr
/pkg
/bin
/llvm-tblgen
654 TOOL_LLVM_TBLGEN
= /usr
/bin
/llvm-tblgen
655 .
endif # exists(/usr/pkg/bin/llvm-tblgen)
657 TOOL_LLVM_TBLGEN
= llvm-tblgen
658 .
endif # defined(__MINIX)
660 TOOL_MACPPCFIXCOFF
= macppc-fixcoff
662 TOOL_MAKEINFO
= makeinfo
664 # LSC: A full path has to be provided, as this is also used as a make
666 TOOL_MAKEKEYS
= /usr
/X11R7
/bin
/makekeys
668 TOOL_MAKEKEYS
= makekeys
669 .
endif # defined(__MINIX)
671 # LSC: A full path has to be provided, as this is also used as a make
673 TOOL_MAKESTRS
= /usr
/X11R7
/bin
/makestrs
675 TOOL_MAKESTRS
= makestrs
676 .
endif # defined(__MINIX)
677 TOOL_MAKEWHATIS
= /usr
/libexec
/makewhatis
678 TOOL_MANDOC_ASCII
= mandoc
-Tascii
679 TOOL_MANDOC_HTML
= mandoc
-Thtml
680 TOOL_MANDOC_LINT
= mandoc
-Tlint
681 TOOL_MDSETIMAGE
= mdsetimage
683 TOOL_M68KELF2AOUT
= m68k-elf2aout
684 TOOL_MIPSELF2ECOFF
= mips-elf2ecoff
685 TOOL_MKCSMAPPER
= mkcsmapper
687 TOOL_MKFSMFS
= mkfs.mfs
688 TOOL_MKLOCALE
= mklocale
692 TOOL_MKUBOOTIMAGE
= mkubootimage
693 TOOL_ELFTOSB
= elftosb
701 TOOL_PKG_CREATE
= pkg_create
702 TOOL_POWERPCMKBOOTIMAGE
= powerpc-mkbootimage
703 TOOL_PWD_MKDB
= pwd_mkdb
705 TOOL_ROFF_ASCII
= nroff
706 TOOL_ROFF_DOCASCII
= ${TOOL_GROFF} -Tascii
707 TOOL_ROFF_DOCHTML
= ${TOOL_GROFF} -Thtml
708 TOOL_ROFF_DVI
= ${TOOL_GROFF} -Tdvi
709 TOOL_ROFF_HTML
= ${TOOL_GROFF} -Tlatin1
-mdoc2html
710 TOOL_ROFF_PS
= ${TOOL_GROFF} -Tps
711 TOOL_ROFF_RAW
= ${TOOL_GROFF} -Z
715 TOOL_SPARKCRC
= sparkcrc
718 TOOL_STRFILE
= /usr
/games
/strfile
720 TOOL_STRFILE
= strfile
721 .
endif # defined(__MINIX)
722 TOOL_SUNLABEL
= sunlabel
725 # LSC: There is a tic packaged, which has a completly different set of
726 # options, so make sure to use the base system one, always.
727 TOOL_TIC
= /usr
/bin
/tic
730 .
endif # defined(__MINIX)
731 TOOL_TOPROTO
= toproto
732 TOOL_UUDECODE
= uudecode
733 TOOL_VGRIND
= vgrind
-f
734 TOOL_VFONTEDPR
= /usr
/libexec
/vfontedpr
737 .
endif # USETOOLS != yes # }
739 # Fallback to ensure that all variables are defined to something
741 TOOL_CPP.false
= false
742 TOOL_CXX.false
= false
744 TOOL_OBJC.false
= false
745 TOOL_OPT.false
= false
746 TOOL_LLC.false
= false
748 AVAILABLE_COMPILER?
= ${HAVE_PCC
:Dpcc
} ${HAVE_LLVM
:Dclang
} ${HAVE_GCC
:Dgcc
} ${EXTERNAL_TOOLCHAIN
:Dgcc
} false
750 .for _t in CC CPP CXX FC OBJC OPT LLC
751 ACTIVE_
${_t}= ${AVAILABLE_COMPILER
:@.c.@
${ !defined
(UNSUPPORTED_COMPILER.
${.c.
}) && defined
(TOOL_
${_t}.
${.c.
}) :?
${.c.
} : }@
:[1]}
752 SUPPORTED_
${_t}=${AVAILABLE_COMPILER
:Nfalse
:@.c.@
${ !defined
(UNSUPPORTED_COMPILER.
${.c.
}) && defined
(TOOL_
${_t}.
${.c.
}) :?
${.c.
} : }@
}
754 # make bugs prevent moving this into the .for loop
755 CC
= ${TOOL_CC.
${ACTIVE_CC}}
756 CPP
= ${TOOL_CPP.
${ACTIVE_CPP}}
757 CXX
= ${TOOL_CXX.
${ACTIVE_CXX}}
758 FC
= ${TOOL_FC.
${ACTIVE_FC}}
759 OBJC
= ${TOOL_OBJC.
${ACTIVE_OBJC}}
760 OPT
= ${TOOL_OPT.
${ACTIVE_OPT}}
761 LLC
= ${TOOL_LLC.
${ACTIVE_LLC}}
763 # Override with tools versions if needed
764 .if
${MKCTF
:Uno
} != "no" && !defined
(NOCTF
)
765 CTFCONVERT
= ${TOOL_CTFCONVERT}
766 CTFMERGE
= ${TOOL_CTFMERGE}
769 # For each ${MACHINE_CPU}, list the ports that use it.
770 MACHINES.aarch64
= evbarm64
771 MACHINES.alpha
= alpha
772 MACHINES.arm
= acorn26 acorn32 cats epoc32 evbarm hpcarm \
773 iyonix netwinder shark zaurus
774 MACHINES.coldfire
= evbcf
778 MACHINES.m68000
= sun2
779 MACHINES.m68k
= amiga atari cesfic hp300 luna68k mac68k \
780 news68k next68k sun3 x68k
781 MACHINES.mips
= arc cobalt algor cobalt emips evbmips ews4800mips \
782 hpcmips mipsco newsmips pmax sbmips sgimips
784 MACHINES.powerpc
= amigappc bebox evbppc ibmnws macppc mvmeppc \
785 ofppc prep rs6000 sandpoint
786 MACHINES.riscv
= riscv
787 MACHINES.sh3
= dreamcast evbsh3 hpcsh landisk mmeye
788 MACHINES.sparc
= sparc sparc64
789 MACHINES.sparc64
= sparc64
791 MACHINES.x86_64
= amd64
793 # for crunchide & ldd, define the OBJECT_FMTS used by a MACHINE_ARCH
796 .if
${MACHINE_ARCH} != "alpha"
799 .if
${MACHINE_ARCH} == "alpha" ||
${MACHINE_ARCH
:M
*64*} != ""
803 # OBJCOPY flags to create a.out binaries for old firmware
804 # shared among src/distrib and ${MACHINE}/conf/Makefile.${MACHINE}.inc
805 .if
${MACHINE_CPU} == "arm"
806 OBJCOPY_ELF2AOUT_FLAGS?
= \
807 -O a.out-arm-netbsd \
825 -R .note.netbsd.ident
829 # Targets to check if DESTDIR or RELEASEDIR is provided
831 .if
!target
(check_DESTDIR
)
832 check_DESTDIR
: .PHONY .NOTMAIN
833 .if
!defined
(DESTDIR
)
834 @echo
"setenv DESTDIR before doing that!"
841 .if
!target
(check_RELEASEDIR
)
842 check_RELEASEDIR
: .PHONY .NOTMAIN
843 .if
!defined
(RELEASEDIR
)
844 @echo
"setenv RELEASEDIR before doing that!"
852 # Build a dynamically linked /bin and /sbin, with the necessary shared
853 # libraries moved from /usr/lib to /lib and the shared linker moved
854 # from /usr/libexec to /lib
856 # Note that if the BINDIR is not /bin or /sbin, then we always use the
857 # non-DYNAMICROOT behavior (i.e. it is only enabled for programs in /bin
858 # and /sbin). See <bsd.shlib.mk>.
863 # Where the system object and source trees are kept; can be configurable
864 # by the user in case they want them in ~/foosrc and ~/fooobj (for example).
868 NETBSDSRCDIR?
= ${BSDSRCDIR}
875 # These are here mainly because we don't want suid root in case
876 # a Makefile defines BINMODE.
882 MANDIR?
= /usr
/share
/man
885 MANMODE?
= ${NONBINMODE}
886 MANINSTALL?
= ${_MANINSTALL}
888 INFODIR?
= /usr
/share
/info
891 INFOMODE?
= ${NONBINMODE}
895 LINTLIBDIR?
= /usr
/libdata
/lint
898 LIBMODE?
= ${NONBINMODE}
900 DOCDIR?
= /usr
/share
/doc
903 DOCMODE?
= ${NONBINMODE}
905 NLSDIR?
= /usr
/share
/nls
908 NLSMODE?
= ${NONBINMODE}
912 KMODULEMODE?
= ${NONBINMODE}
914 LOCALEDIR?
= /usr
/share
/locale
917 LOCALEMODE?
= ${NONBINMODE}
919 FIRMWAREDIR?
= /libdata
/firmware
922 FIRMWAREMODE?
= ${NONBINMODE}
924 DEBUGDIR?
= /usr
/libdata
/debug
927 DEBUGMODE?
= ${NONBINMODE}
930 # Data-driven table using make variables to control how
931 # toolchain-dependent targets and shared libraries are built
932 # for different platforms and object formats.
934 # OBJECT_FMT: currently either "ELF" or "a.out".
936 # All platforms are ELF.
941 # If this platform's toolchain is missing, we obviously cannot build it.
943 .if
${TOOLCHAIN_MISSING} != "no"
950 # If we are using an external toolchain, we can still build the target's
951 # binutils, but we cannot build GCC's support libraries, since those are
952 # tightly-coupled to the version of GCC being used.
954 .if defined
(EXTERNAL_TOOLCHAIN
)
958 # No GDB support for aarch64
964 # No kernel modules for or1k (yet)
969 # No profiling for or1k (yet)
975 # The m68000 port is incomplete.
977 .if
${MACHINE_ARCH} == "m68000"
980 # XXX GCC 4 outputs mcount() calling sequences that try to load values
981 # from over 64KB away and this fails to assemble.
982 .if defined
(HAVE_GCC
)
988 # The ia64 port is incomplete.
994 # On the MIPS, all libs are compiled with ABIcalls (and are thus PIC),
995 # not just shared libraries, so don't build the _pic version.
997 .if
${MACHINE_ARCH} == "mipsel" ||
${MACHINE_ARCH} == "mipseb" || \
998 ${MACHINE_ARCH} == "mips64el" ||
${MACHINE_ARCH} == "mips64eb"
1002 # PowerPC64 and AArch64 ABI's are PIC
1003 MKPICLIB.powerpc64
= no
1004 #MKPICLIB.aarch64= no
1007 # On VAX using ELF, all objects are PIC, not just shared libraries,
1008 # so don't build the _pic version.
1013 # Location of the file that contains the major and minor numbers of the
1014 # version of a shared library. If this file exists a shared library
1015 # will be built by <bsd.lib.mk>.
1017 SHLIB_VERSION_FILE?
= ${.CURDIR
}/shlib_version
1020 # GNU sources and packages sometimes see architecture names differently.
1022 GNU_ARCH.aarch64eb
=aarch64_be
1023 GNU_ARCH.coldfire
=m5407
1026 GNU_ARCH.earmeb
=armeb
1027 GNU_ARCH.earmhfeb
=armeb
1028 GNU_ARCH.earmv4
=armv4
1029 GNU_ARCH.earmv4eb
=armv4eb
1031 GNU_ARCH.earmv5eb
=armeb
1032 GNU_ARCH.earmv6
=armv6
1033 GNU_ARCH.earmv6hf
=armv6
1034 GNU_ARCH.earmv6eb
=armv6eb
1035 GNU_ARCH.earmv6hfeb
=armv6eb
1036 GNU_ARCH.earmv7
=armv7
1037 GNU_ARCH.earmv7hf
=armv7
1038 GNU_ARCH.earmv7eb
=armv7eb
1039 GNU_ARCH.earmv7hfeb
=armv7eb
1041 GCC_CONFIG_ARCH.i386
=i486
1042 GCC_CONFIG_TUNE.i386
=nocona
1043 GCC_CONFIG_TUNE.x86_64
=nocona
1044 GNU_ARCH.m68000
=m68010
1047 GNU_ARCH.mips64eb
=mips64
1049 .if defined
(__MINIX
)
1051 GCC_CONFIG_ARCH.earm
=armv7-a
1053 # MINIX/intel default
1055 GCC_CONFIG_ARCH.i386
=i586
1057 .
endif # defined(__MINIX)
1059 MACHINE_GNU_ARCH
=${GNU_ARCH.
${MACHINE_ARCH}:U
${MACHINE_ARCH}}
1062 # In order to identify NetBSD to GNU packages, we sometimes need
1063 # an "elf" tag for historically a.out platforms.
1065 .if
(!empty
(MACHINE_ARCH
:Mearm
*))
1066 MACHINE_GNU_PLATFORM?
=${MACHINE_GNU_ARCH}--netbsdelf-
${MACHINE_ARCH
:C
/eb
//:C
/v
[4-7]//:S
/earm
/eabi
/}
1067 .elif
(${MACHINE_GNU_ARCH} == "arm" || \
1068 ${MACHINE_GNU_ARCH} == "armeb" || \
1069 ${MACHINE_ARCH} == "i386" || \
1070 ${MACHINE_CPU} == "m68k" || \
1071 ${MACHINE_GNU_ARCH} == "sh" || \
1072 ${MACHINE_GNU_ARCH} == "shle" || \
1073 ${MACHINE_ARCH} == "sparc" || \
1074 ${MACHINE_ARCH} == "vax")
1075 MACHINE_GNU_PLATFORM?
=${MACHINE_GNU_ARCH}--netbsdelf
1077 MACHINE_GNU_PLATFORM?
=${MACHINE_GNU_ARCH}--netbsd
1080 .if defined
(__MINIX
)
1081 # We have a simpler toolchain naming scheme
1082 MACHINE_GNU_PLATFORM
:=${MACHINE_GNU_ARCH}-elf32-minix
1084 # We need to check for HAVE_GOLD after LD has been set
1085 . if
${_HAVE_GOLD
:U
} == ""
1086 _HAVE_GOLD
!= (exec
2>&1; ${LD} --version || echo
"")
1087 _GOLD_MATCH
:=${_HAVE_GOLD
:Mgold
}
1088 _HAVE_GOLD
:= ${_HAVE_GOLD
:M
[0-9]\.
[0-9][0-9]}
1090 . if
${_GOLD_MATCH} != "" && ${_HAVE_GOLD} != ""
1091 HAVE_GOLD?
= ${_HAVE_GOLD}
1093 # Without -Wl,--no-ctors-in-init-array, gold moves the constructors out of
1094 # .ctors into .init_array, which is bad on intel.
1095 LDFLAGS
+= -Wl
,--no-ctors-in-init-array
1099 .
endif # ${_HAVE_GOLD:U} == ""
1100 .
endif # defined(__MINIX)
1102 .if
!empty
(MACHINE_ARCH
:M
*arm
*)
1103 # Flags to pass to CC for using the old APCS ABI on ARM for compat or stand.
1104 ARM_APCS_FLAGS
= -mabi
=apcs-gnu
-mfloat-abi
=soft
1105 ARM_APCS_FLAGS
+=${${ACTIVE_CC} == "gcc":?
-marm
:}
1106 ARM_APCS_FLAGS
+=${${ACTIVE_CC} == "clang":?
-target
${MACHINE_GNU_ARCH}--netbsdelf
-B
${TOOLDIR}/${MACHINE_GNU_PLATFORM}/bin
:}
1109 GENASSYM_CPPFLAGS
+= ${${ACTIVE_CC} == "clang":?
-no-integrated-as
:}
1111 TARGETS
+= all clean cleandir depend dependall includes \
1112 install lint obj regress
tags html analyze
1113 PHONY_NOTMAIN
= all clean cleandir depend dependall
distclean includes \
1114 install lint obj regress beforedepend afterdepend \
1115 beforeinstall afterinstall realinstall realdepend realall \
1116 html subdir-all subdir-install subdir-depend analyze
1117 .PHONY
: ${PHONY_NOTMAIN}
1118 .NOTMAIN
: ${PHONY_NOTMAIN}
1120 .if
${NEED_OWN_INSTALL_TARGET} != "no"
1121 .if
!target
(install)
1122 install: beforeinstall .WAIT subdir-install realinstall .WAIT afterinstall
1128 all: realall subdir-all
1131 depend
: realdepend subdir-depend
1137 dependall
: .NOTMAIN realdepend .MAKE
1138 @cd
"${.CURDIR}"; ${MAKE} realall
1142 # Define MKxxx variables (which are either yes or no) for users
1143 # to set in /etc/mk.conf and override in the make environment.
1144 # These should be tested with `== "no"' or `!= "no"'.
1145 # The NOxxx variables should only be set by Makefiles.
1147 # Please keep etc/Makefile and share/man/man5/mk.conf.5 in sync
1148 # with changes to the MK* variables here.
1152 # Supported NO* options (if defined, MK* will be forced to "no",
1153 # regardless of user's mk.conf setting).
1155 # Source makefiles should set NO*, and not MK*, and must do so before
1156 # including bsd.own.mk.
1159 NOCRYPTO NODOC NOHTML NOINFO NOLINKLIB NOLINT NOMAN NONLS NOOBJ NOPIC \
1160 NOPICINSTALL NOPROFILE NOSHARE NOSTATICLIB
1162 MK
${var
:S
/^NO
//}:= no
1167 # Older-style variables that enabled behaviour when set.
1169 .for var in MANZ UNPRIVED UPDATE
1176 # MK* options which have variable defaults.
1178 .if
${MACHINE_ARCH} == "x86_64" ||
${MACHINE_ARCH} == "sparc64" \
1179 ||
${MACHINE_ARCH} == "mips64eb" ||
${MACHINE_ARCH} == "mips64el" \
1180 ||
${MACHINE_ARCH} == "powerpc64" ||
${MACHINE_CPU} == "aarch64" \
1181 ||
${MACHINE_ARCH} == "riscv64" \
1182 ||
!empty
(MACHINE_ARCH
:Mearm
*)
1185 # Don't let this build where it really isn't supported.
1191 .if
${MACHINE_ARCH} == "x86_64" ||
${MACHINE_ARCH} == "i386" \
1192 ||
${MACHINE_ARCH} == "mips64eb" ||
${MACHINE_ARCH} == "mips64el" \
1193 ||
(${MACHINE} == "evbppc" && ${MACHINE_ARCH} == "powerpc")
1194 MKCOMPATMODULES?
= yes
1196 MKCOMPATMODULES
:= no
1200 # Default mips64 to softfloat now.
1201 # arm is always softfloat unless it isn't
1202 # emips is always softfloat.
1203 # coldfire is always softfloat
1204 # or1k is always softfloat
1206 .if
${MACHINE_ARCH} == "mips64eb" ||
${MACHINE_ARCH} == "mips64el" || \
1207 (${MACHINE_CPU} == "arm" && ${MACHINE_ARCH
:M
*hf
*} == "") || \
1208 ${MACHINE_ARCH} == "coldfire" ||
${MACHINE_CPU} == "or1k" || \
1209 ${MACHINE} == "emips"
1213 .if
${MACHINE} == "emips"
1217 .if
${MACHINE_ARCH} == "i386" || \
1218 ${MACHINE_ARCH} == "x86_64" || \
1219 ${MACHINE_ARCH} == "sparc"
1226 # MK* backward compatibility.
1229 MKBINUTILS?
= ${MKBFD}
1233 # We want to build zfs only for amd64 by default for now.
1235 .if
${MACHINE} == "amd64"
1240 # MK* options which default to "yes".
1245 MKCRYPTO MKCOMPLEX MKCVS MKCXX \
1247 MKGCC MKGDB MKGROFF \
1249 MKIEEEFP MKINET6 MKINFO MKIPFILTER MKISCSI \
1252 MKLDAP MKLIBSTDCXX MKLINKLIB MKLVM \
1260 MKPF MKPIC MKPICINSTALL MKPICLIB MKPOSTFIX MKPROFILE \
1262 MKSHARE MKSKEY MKSTATICLIB \
1266 #MINIX-specific vars
1268 MKSYSDEBUG MKLIVEUPDATE MKLWIP MKLLVMCMDS
1269 .if
(${MACHINE_ARCH} == "i386")
1271 MKWATCHDOG MKACPI MKAPIC MKDEBUGREG MKINSTALLBOOT MKPCI
1274 .for var in
${_MKVARS.yes
}
1275 ${var}?
= ${${var}.
${MACHINE_ARCH}:Uyes
}
1279 # MKGCCCMDS is only valid if we are building GCC so make it dependent on that.
1281 _MKVARS.yes
+= MKGCCCMDS
1282 MKGCCCMDS?
= ${MKGCC}
1285 # Exceptions to the above:
1287 .if
${MACHINE} == "acorn26" # page size is prohibitive
1292 # MK* options which default to "no". Note that MKZFS has a different
1293 # default for some platforms, see above.
1296 MKBSDGREP MKBSDTAR \
1297 MKCATPAGES MKCOMPATTESTS MKCOMPATX11 MKCRYPTO_RC5 MKCTF MKDEBUG \
1298 MKDEBUGLIB MKDTRACE MKEXTSRC MKGROFFHTMLDOC \
1299 MKKYUA MKLLD MKLLDB MKLINT \
1300 MKMANZ MKMCLINKER MKOBJDIRS \
1301 MKLIBCXX MKLLVM MKPCC \
1304 MKSOFTFLOAT MKSTRIPIDENT MKTPM \
1305 MKUNPRIVED MKUPDATE MKX11 MKX11MOTIF MKZFS
1307 #MINIX-specific vars
1309 MKIMAGEONLY MKSMALL MKBITCODE MKMAGIC MKPAE MKASR MKSRC
1310 .if
!empty
(MACHINE_ARCH
:Mearm
*)
1312 MKWATCHDOG MKPAE MKACPI MKAPIC MKDEBUGREG MKINSTALLBOOT MKPCI
1315 .for var in
${_MKVARS.no
}
1316 ${var}?
= ${${var}.
${MACHINE_ARCH}:Uno
}
1320 # Which platforms build the xorg-server drivers (as opposed
1321 # to just Xnest and Xvfb.)
1323 .if
${MACHINE} == "alpha" || \
1324 ${MACHINE} == "amd64" || \
1325 ${MACHINE} == "bebox" || \
1326 ${MACHINE} == "cats" || \
1327 ${MACHINE} == "dreamcast" || \
1328 ${MACHINE} == "ews4800mips" || \
1329 ${MACHINE} == "evbarm" || \
1330 ${MACHINE} == "evbmips" || \
1331 ${MACHINE} == "hp300" || \
1332 ${MACHINE} == "hpcarm" || \
1333 ${MACHINE} == "hpcmips" || \
1334 ${MACHINE} == "hpcsh" || \
1335 ${MACHINE} == "i386" || \
1336 ${MACHINE} == "luna68k" || \
1337 ${MACHINE} == "mac68k" || \
1338 ${MACHINE} == "macppc" || \
1339 ${MACHINE} == "netwinder" || \
1340 ${MACHINE} == "newsmips" || \
1341 ${MACHINE} == "prep" || \
1342 ${MACHINE} == "ofppc" || \
1343 ${MACHINE} == "sgimips" || \
1344 ${MACHINE} == "shark" || \
1345 ${MACHINE} == "sparc" || \
1346 ${MACHINE} == "sparc64" || \
1347 ${MACHINE} == "vax" || \
1348 ${MACHINE} == "zaurus"
1355 # Force some options off if their dependencies are off.
1358 .if
${MKCXX} == "no"
1364 .if
${MKCRYPTO} == "no"
1369 .if
${MKMAN} == "no"
1374 _MANINSTALL
= maninstall
1375 .if
${MKCATPAGES} != "no"
1376 _MANINSTALL
+= catinstall
1378 .if
${MKHTML} != "no"
1379 _MANINSTALL
+= htmlinstall
1382 .if
${MKLINKLIB} == "no"
1388 .if
${MKPIC} == "no"
1392 .if
${MKOBJ} == "no"
1396 .if
${MKSHARE} == "no"
1406 .if
${MKSMALL} == "yes"
1415 # MINIX: MKASR implies MKMAGIC
1416 .if
${MKASR} == "yes"
1420 # MINIX: MKMAGIC implies MKBITCODE
1421 .if
${MKMAGIC} == "yes"
1425 .if
!empty
(MACHINE_ARCH
:Mearm
*)
1426 _NEEDS_LIBCXX.
${MACHINE_ARCH}= yes
1428 _NEEDS_LIBCXX.i386
= yes
1429 _NEEDS_LIBCXX.powerpc
= yes
1430 _NEEDS_LIBCXX.powerpc64
= yes
1431 _NEEDS_LIBCXX.x86_64
= yes
1432 _NEEDS_LIBCXX.aarch64
= yes
1434 .if
${MKLLVM} == "yes" && ${_NEEDS_LIBCXX.
${MACHINE_ARCH}:Uno
} == "yes"
1439 # install(1) parameters.
1442 .if
${MKUPDATE} == "no"
1451 METALOG?
= ${DESTDIR}/METALOG
1452 METALOG.add?
= ${TOOL_CAT} -l
>> ${METALOG}
1453 .if
(${_SRC_TOP_} != "") # only set INSTPRIV if inside ${NETBSDSRCDIR}
1454 .if
${MKUNPRIVED} != "no"
1455 INSTPRIV.unpriv
=-U
-M
${METALOG} -D
${DESTDIR} -h sha256
1459 INSTPRIV?
= ${INSTPRIV.unpriv
} -N
${NETBSDSRCDIR}/etc
1463 .if
${NEED_OWN_INSTALL_TARGET} != "no"
1464 INSTALL_DIR?
= ${INSTALL} ${INSTPRIV} -d
1465 INSTALL_FILE?
= ${INSTALL} ${INSTPRIV} ${COPY} ${PRESERVE} ${RENAME}
1466 INSTALL_LINK?
= ${INSTALL} ${INSTPRIV} ${HRDLINK} ${RENAME}
1467 INSTALL_SYMLINK?
= ${INSTALL} ${INSTPRIV} ${SYMLINK} ${RENAME}
1471 # Set defaults for the USE_xxx variables.
1475 # USE_* options which default to "no" and will be forced to "no" if their
1476 # corresponding MK* variable is set to "no".
1478 .for var in USE_SKEY
1479 .if
(${${var
:S
/USE_
/MK
/}} == "no")
1487 # USE_* options which default to "yes" unless their corresponding MK*
1488 # variable is set to "no".
1490 .for var in USE_HESIOD USE_INET6 USE_KERBEROS USE_LDAP USE_PAM USE_YP
1491 .if
(${${var
:S
/USE_
/MK
/}} == "no")
1498 #MINIX-specific vars
1500 USE_WATCHDOG USE_ACPI USE_PAE USE_APIC USE_DEBUGREG USE_SYSDEBUG \
1501 USE_LIVEUPDATE USE_PCI USE_BITCODE USE_MAGIC USE_ASR
1502 .if
(${${var
:S
/USE_
/MK
/}} == "no")
1510 # USE_* options which default to "yes".
1512 .for var in USE_JEMALLOC
1517 # USE_* options which default to "no".
1519 # For now, disable pigz as compressor by default
1520 .for var in USE_PIGZGZIP USE_LIBTRE
1525 # TOOL_GZIP and friends. These might refer to TOOL_PIGZ or to the host gzip.
1527 .if
${USE_PIGZGZIP} != "no"
1528 TOOL_GZIP
= ${TOOL_PIGZ}
1534 TOOL_GZIP_N
= ${TOOL_GZIP} ${GZIP_N_FLAG}
1537 # Where X11 sources are and where it is installed to.
1539 .if
!defined
(X11SRCDIR
)
1540 .if exists
(${NETBSDSRCDIR}/..
/xsrc
)
1541 X11SRCDIR
!= cd
"${NETBSDSRCDIR}/../xsrc" && pwd
1543 X11SRCDIR
= /usr
/xsrc
1545 .
endif # !defined(X11SRCDIR)
1547 X11SRCDIR.local?
= ${X11SRCDIR}/local
1548 X11ROOTDIR?
= /usr
/X11R7
1549 X11BINDIR?
= ${X11ROOTDIR}/bin
1550 X11ETCDIR?
= /etc
/X11
1551 X11FONTDIR?
= ${X11ROOTDIR}/lib
/X11
/fonts
1552 X11INCDIR?
= ${X11ROOTDIR}/include
1553 X11LIBDIR?
= ${X11ROOTDIR}/lib
/X11
1554 X11MANDIR?
= ${X11ROOTDIR}/man
1555 X11SHAREDIR?
= ${X11ROOTDIR}/share
1556 X11USRLIBDIR?
= ${X11ROOTDIR}/lib
${MLIBDIR
:D
/${MLIBDIR}}
1559 # New modular-xorg based builds
1561 X11SRCDIRMIT?
= ${X11SRCDIR}/external
/mit
1563 FS ICE SM X11 XScrnSaver XTrap Xau Xcomposite Xcursor Xdamage \
1564 Xdmcp Xevie Xext Xfixes Xfont Xft Xi Xinerama Xmu Xpresent Xpm \
1565 Xrandr Xrender Xres Xt Xtst Xv XvMC Xxf86dga Xxf86misc Xxf86vm drm \
1566 fontenc xkbfile xkbui Xaw Xfontcache pciaccess xcb \
1568 X11SRCDIR.
${_lib}?
= ${X11SRCDIRMIT}/lib
${_lib}/dist
1572 xcmisc xext xf86bigfont bigreqs input kb x fonts fixes scrnsaver \
1573 xinerama dri2 dri3 render resource record video xf86dga xf86misc \
1574 xf86vidmode composite damage trap gl randr fontcache xf86dri \
1576 X11SRCDIR.
${_proto}proto?
= ${X11SRCDIRMIT}/${_proto}proto
/dist
1580 xtrans fontconfig freetype evieext mkfontscale bdftopcf \
1581 xkbcomp xorg-cf-files imake xorg-server xbiff xkeyboard-config \
1582 xbitmaps appres xeyes xev xedit sessreg pixman \
1583 beforelight bitmap editres makedepend fonttosfnt fslsfonts fstobdf \
1584 glu glw mesa-demos MesaGLUT MesaLib MesaLib7 \
1585 ico iceauth listres lndir \
1586 luit xproxymanagementprotocol mkfontdir oclock proxymngr rgb \
1587 rstart setxkbmap showfont smproxy twm viewres \
1588 x11perf xauth xcalc xclipboard \
1589 xclock xcmsdb xconsole xditview xdpyinfo xdriinfo xdm \
1590 xfd xf86dga xfindproxy xfontsel xfwp xgamma xgc xhost xinit \
1591 xkill xload xlogo xlsatoms xlsclients xlsfonts xmag xmessage \
1592 xmh xmodmap xmore xman xprop xrandr xrdb xrefresh xset \
1593 xsetmode xsetpointer xsetroot xsm xstdcmap xvidtune xvinfo \
1594 xwininfo xwud xkbprint xkbevd \
1595 xterm xwd xfs xfsinfo xtrap xkbutils xkbcomp \
1596 xkeyboard-config xinput xcb-util xorg-docs \
1597 font-adobe-100dpi font-adobe-75dpi font-adobe-utopia-100dpi \
1598 font-adobe-utopia-75dpi font-adobe-utopia-type1 \
1600 font-bh-100dpi font-bh-75dpi font-bh-lucidatypewriter-100dpi \
1601 font-bh-lucidatypewriter-75dpi font-bh-ttf font-bh-type1 \
1602 font-bitstream-100dpi font-bitstream-75dpi font-bitstream-type1 \
1603 font-cursor-misc font-daewoo-misc font-dec-misc font-ibm-type1 \
1604 font-isas-misc font-jis-misc font-misc-misc font-mutt-misc \
1605 font-sony-misc font-util ttf-bitstream-vera encodings
1606 X11SRCDIR.
${_dir}?
= ${X11SRCDIRMIT}/${_dir}/dist
1610 elographics keyboard mouse synaptics vmmouse void ws
1611 X11SRCDIR.xf86-input-
${_i}?
= ${X11SRCDIRMIT}/xf86-input-
${_i}/dist
1615 ag10e apm ark ast ati ati-kms chips cirrus crime \
1616 geode glint i128 i740 igs imstt intel intel-old mach64 mga \
1617 neomagic newport nsc nv nvxbox openchrome pnozz \
1618 r128 radeonhd rendition \
1619 s3 s3virge savage siliconmotion sis suncg14 \
1620 suncg6 sunffb sunleo suntcx \
1621 tdfx tga trident tseng vesa vga vmware wsfb xgi
1622 X11SRCDIR.xf86-video-
${_v}?
= ${X11SRCDIRMIT}/xf86-video-
${_v}/dist
1625 # Only install the radeon firmware on DRM-happy systems.
1626 .if
${MACHINE_ARCH} == "x86_64" ||
${MACHINE_ARCH} == "i386"
1627 MKRADEONFIRMWARE?
= yes
1629 MKRADEONFIRMWARE?
= no
1636 # Where extsrc sources are and where it is installed to.
1638 .if
!defined
(EXTSRCSRCDIR
)
1639 .if exists
(${NETBSDSRCDIR}/..
/extsrc
)
1640 EXTSRCSRCDIR
!= cd
"${NETBSDSRCDIR}/../extsrc" && pwd
1642 EXTSRCSRCDIR
= /usr
/extsrc
1644 .
endif # !defined(EXTSRCSRCDIR)
1646 EXTSRCROOTDIR?
= /usr
/ext
1647 EXTSRCBINDIR?
= ${EXTSRCROOTDIR}/bin
1648 EXTSRCETCDIR?
= /etc
/ext
1649 EXTSRCINCDIR?
= ${EXTSRCROOTDIR}/include
1650 EXTSRCLIBDIR?
= ${EXTSRCROOTDIR}/lib
/ext
1651 EXTSRCMANDIR?
= ${EXTSRCROOTDIR}/man
1652 EXTSRCUSRLIBDIR?
= ${EXTSRCROOTDIR}/lib
1655 # MAKEDIRTARGET dir target [extra make(1) params]
1656 # run "cd $${dir} && ${MAKEDIRTARGETENV} ${MAKE} [params] $${target}", with a pretty message
1660 @_makedirtarget
() { \
1662 target
="$$1"; shift
; \
1664 /*) this
="$${dir}/"; \
1666 .
) this
="${_THISDIR_}"; \
1667 real
="${.CURDIR}" ;; \
1668 *) this
="${_THISDIR_}$${dir}/"; \
1669 real
="${.CURDIR}/$${dir}" ;; \
1672 echo
"$${target} ===> $${show%/}$${1:+ (with: $$@)}"; \
1674 && ${MAKEDIRTARGETENV} ${MAKE} _THISDIR_
="$${this}" "$$@" $${target}; \
1679 # MAKEVERBOSE support. Levels are:
1680 # 0 Minimal output ("quiet")
1681 # 1 Describe what is occurring
1682 # 2 Describe what is occurring and echo the actual command
1683 # 3 Ignore the effect of the "@" prefix in make commands
1684 # 4 Trace shell commands using the shell's -x flag
1688 .if
${MAKEVERBOSE} == 0
1693 .elif
${MAKEVERBOSE} == 1
1698 .
else # MAKEVERBOSE >= 2
1699 _MKMSG?
= @echo
'\# '
1700 _MKSHMSG?
= echo
'\# '
1702 .SILENT
: __makeverbose_dummy_target__
1703 .
endif # MAKEVERBOSE >= 2
1704 .if
${MAKEVERBOSE} >= 3
1706 .
endif # ${MAKEVERBOSE} >= 3
1707 .if
${MAKEVERBOSE} >= 4
1709 .
endif # ${MAKEVERBOSE} >= 4
1711 _MKMSG_BUILD?
= ${_MKMSG} " build "
1712 _MKMSG_CREATE?
= ${_MKMSG} " create "
1713 _MKMSG_COMPILE?
= ${_MKMSG} "compile "
1714 _MKMSG_FORMAT?
= ${_MKMSG} " format "
1715 _MKMSG_INSTALL?
= ${_MKMSG} "install "
1716 _MKMSG_LINK?
= ${_MKMSG} " link "
1717 _MKMSG_LEX?
= ${_MKMSG} " lex "
1718 _MKMSG_REMOVE?
= ${_MKMSG} " remove "
1719 _MKMSG_YACC?
= ${_MKMSG} " yacc "
1721 _MKSHMSG_CREATE?
= ${_MKSHMSG} " create "
1722 _MKSHMSG_INSTALL?
= ${_MKSHMSG} "install "
1724 _MKTARGET_BUILD?
= ${_MKMSG_BUILD} ${.CURDIR
:T
}/${.TARGET
}
1725 _MKTARGET_CREATE?
= ${_MKMSG_CREATE} ${.CURDIR
:T
}/${.TARGET
}
1726 _MKTARGET_COMPILE?
= ${_MKMSG_COMPILE} ${.CURDIR
:T
}/${.TARGET
}
1727 _MKTARGET_FORMAT?
= ${_MKMSG_FORMAT} ${.CURDIR
:T
}/${.TARGET
}
1728 _MKTARGET_INSTALL?
= ${_MKMSG_INSTALL} ${.TARGET
}
1729 _MKTARGET_LINK?
= ${_MKMSG_LINK} ${.CURDIR
:T
}/${.TARGET
}
1730 _MKTARGET_LEX?
= ${_MKMSG_LEX} ${.CURDIR
:T
}/${.TARGET
}
1731 _MKTARGET_REMOVE?
= ${_MKMSG_REMOVE} ${.TARGET
}
1732 _MKTARGET_YACC?
= ${_MKMSG_YACC} ${.CURDIR
:T
}/${.TARGET
}
1734 .if
${MKMANDOC} == "yes"
1735 TARGETS
+= lintmanpages
1738 TESTSBASE
= /usr
/tests
${MLIBDIR
:D
/${MLIBDIR}}
1740 .
endif # !defined(_BSD_OWN_MK_)