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
30 #MINIX-specific variables
33 # LSC MINIX does not support these features ATM.
58 WEAKALIASOVERRIDEPASS?
=${NETBSDSRCDIR}/minix
/llvm
/bin
/weak-alias-module-override.so
59 GOLD_PLUGIN?
=${NETBSDSRCDIR}/minix
/llvm
/bin
/LLVMgold.so
61 # By default when running LLVM passes:
62 # - do not run optimization while running LLVM passes
63 # - run the passe which allows assembly weak symbols to be
64 # overriden by bitcode functions
65 OPTFLAGS?
= -disable-opt \
67 -load
${WEAKALIASOVERRIDEPASS} -weak-alias-module-override
69 BITCODE_LD_FLAGS_1ST?
= \
70 -Wl
,-plugin
=${GOLD_PLUGIN} \
71 -Wl
,-plugin-opt
=-disable-opt \
72 -Wl
,-plugin-opt
=-disable-inlining
74 BITCODE_LD_FLAGS_2ND?
=${BITCODE_LD_FLAGS_1ST}
77 SMP_FLAGS
+= -DCONFIG_SMP
78 .
ifdef CONFIG_MAX_CPUS
79 SMP_FLAGS
+= -DCONFIG_MAX_CPUS
=${CONFIG_MAX_CPUS}
83 CPPFLAGS
+= ${SMP_FLAGS}
85 # Disabled unaligned accesses on ARM
86 .if
!empty
(MACHINE_ARCH
:Mearm
*)
87 CFLAGS
+= -mno-unaligned-access
91 .if
${__uname_s
:Uunknown
} == "Minix"
93 . if
${USETOOLS
:Uno
} != "yes"
96 # If DESTDIR was specified, and we are not using the tools, then make sure to
97 # build out-of-tree and to refer only DESTDIR for target binaries
98 # The case when using tools is already handled below.
99 . if
${DESTDIR
:U
} != ""
100 CPPFLAGS
+= --sysroot
=${DESTDIR}
101 LDFLAGS
+= --sysroot
=${DESTDIR}
102 .
endif # ${DESTDIR:U} != ""
105 .
endif # ${USETOOLS:Uno} != "yes"
107 . if
!defined
(HOSTPROG
) && !defined
(HOSTLIB
)
108 # LSC FIXME: Override MACHINE as the native minix host make command will set
110 . if
${MACHINE_ARCH} == "i386"
113 # LSC FIXME: On a native ARM system MACHINE_ARCH is earmv7 instead of earm...
114 . if
!empty
(MACHINE_ARCH
:Mearm
*)
117 .
endif # !defined(HOSTPROG) && !defined(HOSTLIB)
118 .
endif # __uname_s == "Minix"
120 # LSC FIXME: RELEASEMACHINEDIR is set to evbarm, instead of evbearm-el
121 .if
!empty
(MACHINE
:Mevbarm
*)
122 RELEASEMACHINEDIR
:= evbearm-el
125 .if
${HAVE_GCC
:Dyes
} == "yes" || \
126 (${MKGCCCMDS
:Uno
} == "yes" && ${MKLLVM
:Uyes
} == "no")
127 # We are building with GCC, means we cannot build LIBCXX, and need LIBSTDCXX
128 MKLIBCXX?
= no
# Can't compile with GCC.
130 . if
${USETOOLS
:Uno
} == "yes" ||
${MKLIBSTDCXX
:Uno
} == "yes"
131 # When cross-compiling, or building MKLIBSTDCXX, use the in-tree LIBSTDCXX
133 CXXFLAGS
+= -I
${DESTDIR}/usr
/include/g
++
134 .
endif # ${USETOOLS:Uno} == "yes"
136 . if
${MKLIBSTDCXX
:Uno
} == "no"
137 # Specify the C++ system header for the host libstdc++, as we are not building
139 CXXFLAGS
+= -I
/usr
/include/g
++
140 .
endif # ${MKLIBSTDCXX:Uno} == "no"
142 .
endif # ${HAVE_GCC:Dyes} == "yes" || \
143 # (${MKGCCCMDS:Uno} == "yes" && ${MKLLVM:Uyes} == "no")
145 # MKGCCCMDS == yes implies MKGCC == yes
146 .if
${MKGCCCMDS} == "yes"
148 MKBINUTILS?
= yes
# We are installing GCC, so trigger binutils.
149 MKLIBSTDCXX?
= yes
# Also install the GNU C++ library
150 .
endif # ${MKGCCCMDS} == "yes"
152 # The default value of MKLIBSTDCXX cannot be set before the previous test.
155 .if
${MKGCC} == "yes"
156 HAVE_GCC?
= 5 # Not really, but that's the setting.
159 .
endif # ${MKGCC} == "yes"
161 .if
${USETOOLS
:Uno
} == "yes"
163 .
endif # ${USETOOLS:Uno} == "yes"
165 .if
${MKLLVM
:Uno
} == "yes"
167 MKBINUTILS?
= yes
# We are installing clang, so trigger binutils.
168 .
endif # ${MKLLVM:Uno} == "yes"
170 .if
${HAVE_LLVM
:Dyes
} == "yes"
172 .
endif # ${HAVE_LLVM:Dyes} == "yes"
174 # The default value has to be set after we have figured out if we are using GCC
176 MKLIBCXX?
= yes
# Build by default libc++
178 # The default value of MKBINUTILS cannot be set before the previous test.
181 .
endif # defined(__MINIX)
183 MAKECONF?
= /etc
/mk.conf
184 .
-include "${MAKECONF}"
187 # CPU model, derived from MACHINE_ARCH
189 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
/}
192 # Subdirectory used below ${RELEASEDIR} when building a release
194 RELEASEMACHINEDIR?
= ${MACHINE}
197 # Subdirectory or path component used for the following paths:
198 # distrib/${RELEASEMACHINE}
199 # distrib/notes/${RELEASEMACHINE}
200 # etc/etc.${RELEASEMACHINE}
201 # Used when building a release.
203 RELEASEMACHINE?
= ${MACHINE}
206 # NEED_OWN_INSTALL_TARGET is set to "no" by pkgsrc/mk/bsd.pkg.mk to
207 # ensure that things defined by <bsd.own.mk> (default targets,
208 # INSTALL_FILE, etc.) are not conflicting with bsd.pkg.mk.
210 NEED_OWN_INSTALL_TARGET?
= yes
213 # This lists the platforms which do not have working in-tree toolchains. For
214 # the in-tree gcc toolchain, this list is empty.
216 # If some future port is not supported by the in-tree toolchain, this should
217 # be set to "yes" for that port only.
219 .if
${MACHINE} == "playstation2"
220 TOOLCHAIN_MISSING?
= yes
223 TOOLCHAIN_MISSING?
= no
225 .if
${MACHINE_CPU} == "aarch64" && !defined
(EXTERNAL_TOOLCHAIN
) && ${MKLLVM
:Uyes
} != "no"
232 # GCC Using platforms.
234 .if
${MKGCC
:Uyes
} != "no"
236 .if
${MACHINE} == "playstation2" ||
${MACHINE_CPU} == "aarch64"
239 # Otherwise, default to GCC4.8
244 # Platforms that can't run a modern GCC natively
245 .if
${MACHINE_ARCH} == "m68000"
250 # We import the old gcc as "gcc.old" when upgrading. EXTERNAL_GCC_SUBDIR is
251 # set to the relevant subdirectory in src/external/gpl3 for his HAVE_GCC.
254 EXTERNAL_GCC_SUBDIR
= gcc
255 .elif
${HAVE_GCC} == 48
256 EXTERNAL_GCC_SUBDIR
= gcc.old
258 EXTERNAL_GCC_SUBDIR
= /does
/not
/exist
264 .if
!empty
(MACHINE_ARCH
:Mearm
*)
265 _LIBC_COMPILER_RT.
${MACHINE_ARCH}= yes
268 _LIBC_COMPILER_RT.aarch64
= yes
269 _LIBC_COMPILER_RT.i386
= yes
270 _LIBC_COMPILER_RT.powerpc
= yes
271 _LIBC_COMPILER_RT.powerpc64
= yes
272 _LIBC_COMPILER_RT.x86_64
= yes
274 .if
${HAVE_LLVM
:Uno
} == "yes" && ${_LIBC_COMPILER_RT.
${MACHINE_ARCH}:Uno
} == "yes"
281 # ia64 is not support
282 .if
${HAVE_LLVM
:Uno
} == "yes" ||
!empty
(MACHINE_ARCH
:Mearm
*)
290 .if
(${MACHINE_ARCH} == "alpha") || \
291 (${MACHINE_ARCH} == "hppa") || \
292 (${MACHINE_ARCH} == "ia64") || \
293 (${MACHINE_CPU} == "mips")
297 .if
${USE_FORT
:Uno
} != "no"
302 .if empty
(.MAKEFLAGS
:tW
:M
*-V .OBJDIR
*)
303 .if defined
(MAKEOBJDIRPREFIX
) || defined
(MAKEOBJDIR
)
304 PRINTOBJDIR
= ${MAKE} -r
-V .OBJDIR
-f
/dev
/null xxx
306 PRINTOBJDIR
= ${MAKE} -V .OBJDIR
309 PRINTOBJDIR
= echo
/error
/bsd.own.mk
/PRINTOBJDIR
# avoid infinite recursion
313 # Determine if running in the NetBSD source tree by checking for the
314 # existence of build.sh and tools/ in the current or a parent directory,
315 # and setting _SRC_TOP_ to the result.
317 .if
!defined
(_SRC_TOP_
) # {
318 _SRC_TOP_
!= cd
"${.CURDIR}"; while
:; do \
320 [ -f build.sh
] && [ -d tools
] && { echo
$$here; break
; }; \
321 case
$$here in
/) echo
""; break
;; esac
; \
324 .MAKEOVERRIDES
+= _SRC_TOP_
329 # If _SRC_TOP_ != "", we're within the NetBSD source tree.
330 # * Set defaults for NETBSDSRCDIR and _SRC_TOP_OBJ_.
331 # * Define _NETBSD_VERSION_DEPENDS. Targets that depend on the
332 # NetBSD version, or on variables defined at build time, can
333 # declare a dependency on ${_NETBSD_VERSION_DEPENDS}.
335 .if
(${_SRC_TOP_} != "") # {
337 NETBSDSRCDIR?
= ${_SRC_TOP_}
339 .if
!defined
(_SRC_TOP_OBJ_
)
340 _SRC_TOP_OBJ_
!= cd
"${_SRC_TOP_}" && ${PRINTOBJDIR}
341 .MAKEOVERRIDES
+= _SRC_TOP_OBJ_
344 _NETBSD_VERSION_DEPENDS
= ${_SRC_TOP_OBJ_}/params
345 _NETBSD_VERSION_DEPENDS
+= ${NETBSDSRCDIR}/sys
/sys
/param.h
346 _NETBSD_VERSION_DEPENDS
+= ${NETBSDSRCDIR}/sys
/conf
/newvers.sh
347 _NETBSD_VERSION_DEPENDS
+= ${NETBSDSRCDIR}/sys
/conf
/osrelease.sh
348 ${_SRC_TOP_OBJ_}/params
: .NOTMAIN .OPTIONAL
# created by top level "make build"
350 .
endif # _SRC_TOP_ != "" # }
353 .if
(${_SRC_TOP_} != "") && \
354 (${TOOLCHAIN_MISSING} == "no" || defined
(EXTERNAL_TOOLCHAIN
))
360 .if
${MACHINE_ARCH} == "mips" ||
${MACHINE_ARCH} == "mips64" || \
361 ${MACHINE_ARCH} == "sh3"
363 @echo
"Must set MACHINE_ARCH to one of ${MACHINE_ARCH}eb or ${MACHINE_ARCH}el"
365 .elif defined
(REQUIRETOOLS
) && \
366 (${TOOLCHAIN_MISSING} == "no" || defined
(EXTERNAL_TOOLCHAIN
)) && \
369 @echo
"USETOOLS=no, but this component requires a version-specific host toolchain"
374 # Host platform information; may be overridden
376 .
include <bsd.host.mk
>
378 .if
${USETOOLS} == "yes" # {
381 # Provide a default for TOOLDIR.
383 .if
!defined
(TOOLDIR
)
384 TOOLDIR
:= ${_SRC_TOP_OBJ_}/tooldir.
${HOST_OSTYPE}
385 .MAKEOVERRIDES
+= TOOLDIR
389 # This is the prefix used for the NetBSD-sourced tools.
394 # If an external toolchain base is specified, use it.
396 .if defined
(EXTERNAL_TOOLCHAIN
) # {
397 AR
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-ar
398 AS
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-as
399 LD
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-ld
400 NM
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-nm
401 OBJCOPY
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-objcopy
402 OBJDUMP
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-objdump
403 RANLIB
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-ranlib
404 READELF
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-readelf
405 SIZE
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-size
406 STRINGS
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-strings
407 STRIP
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-strip
409 TOOL_CC.gcc
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-gcc
410 TOOL_CPP.gcc
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-cpp
411 TOOL_CXX.gcc
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-c
++
412 TOOL_FC.gcc
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-g77
413 TOOL_OBJC.gcc
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-gcc
415 TOOL_CC.clang
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-clang
416 TOOL_CPP.clang
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-clang-cpp
417 TOOL_CXX.clang
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-clang
++
418 TOOL_OBJC.clang
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-clang
419 TOOL_OPT.clang
= ${EXTERNAL_TOOLCHAIN}/bin
/opt
420 TOOL_LLC.clang
= ${EXTERNAL_TOOLCHAIN}/bin
/llc
422 # Define default locations for common tools.
423 .if
${USETOOLS_BINUTILS
:Uyes
} == "yes" # {
424 AR
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-ar
425 AS
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-as
426 LD
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-ld
427 NM
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-nm
428 OBJCOPY
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-objcopy
429 OBJDUMP
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-objdump
430 RANLIB
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-ranlib
431 READELF
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-readelf
432 SIZE
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-size
433 STRINGS
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-strings
434 STRIP
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-strip
436 # GCC supports C, C++, Fortran and Objective C
437 TOOL_CC.gcc
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-gcc
438 TOOL_CPP.gcc
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-cpp
439 TOOL_CXX.gcc
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-c
++
440 TOOL_FC.gcc
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-g77
441 TOOL_OBJC.gcc
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-gcc
444 # Clang supports C, C++ and Objective C
445 TOOL_CC.clang
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-clang
446 TOOL_CPP.clang
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-clang-cpp
447 TOOL_CXX.clang
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-clang
++
448 TOOL_OBJC.clang
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-clang
449 TOOL_OPT.clang
= ${TOOLDIR}/bin
/opt
450 TOOL_LLC.clang
= ${TOOLDIR}/bin
/llc
452 # PCC supports C and Fortran
453 TOOL_CC.pcc
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-pcc
454 TOOL_CPP.pcc
= ${TOOLDIR}/libexec
/${MACHINE_GNU_PLATFORM}-cpp
455 TOOL_CXX.pcc
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-p
++
458 # Make sure DESTDIR is set, so that builds with these tools always
459 # get appropriate -nostdinc, -nostdlib, etc. handling. The default is
460 # <empty string>, meaning start from /, the root directory.
464 .if
!defined
(HOSTPROG
) && !defined
(HOSTLIB
)
465 . if
${DESTDIR} != ""
466 CPPFLAGS
+= --sysroot
=${DESTDIR}
467 LDFLAGS
+= --sysroot
=${DESTDIR}
469 CPPFLAGS
+= --sysroot
=/
470 LDFLAGS
+= --sysroot
=/
473 .
endif # EXTERNAL_TOOLCHAIN # }
475 DBSYM
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-dbsym
476 ELF2AOUT
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}m68k-elf2aout
477 ELF2ECOFF
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}mips-elf2ecoff
478 INSTALL
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-install
479 LEX
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}lex
480 LINT
= CC
=${CC
:Q
} ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-lint
481 LORDER
= NM
=${NM
:Q
} MKTEMP
=${TOOL_MKTEMP
:Q
} ${TOOLDIR}/bin
/${_TOOL_PREFIX}lorder
482 MKDEP
= CC
=${CC
:Q
} ${TOOLDIR}/bin
/${_TOOL_PREFIX}mkdep
483 MKDEPCXX
= CC
=${CXX
:Q
} ${TOOLDIR}/bin
/${_TOOL_PREFIX}mkdep
484 PAXCTL
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}paxctl
485 TSORT
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}tsort
-q
486 YACC
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}yacc
488 TOOL_AMIGAAOUT2BB
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}amiga-aout2bb
489 TOOL_AMIGAELF2BB
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}amiga-elf2bb
490 TOOL_AMIGATXLT
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}amiga-txlt
491 TOOL_ASN1_COMPILE
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}asn1_compile
492 TOOL_AWK
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}awk
493 TOOL_CAP_MKDB
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}cap_mkdb
494 TOOL_CAT
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}cat
495 TOOL_CKSUM
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}cksum
496 TOOL_CLANG_TBLGEN
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}clang-tblgen
497 TOOL_COMPILE_ET
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}compile_et
498 TOOL_CONFIG
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}config
499 TOOL_CRUNCHGEN
= MAKE
=${.MAKE
:Q
} ${TOOLDIR}/bin
/${_TOOL_PREFIX}crunchgen
500 TOOL_CTAGS
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}ctags
501 TOOL_CTFCONVERT
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}ctfconvert
502 TOOL_CTFMERGE
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}ctfmerge
503 TOOL_DB
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}db
504 TOOL_DISKLABEL
= ${TOOLDIR}/bin
/nbdisklabel
505 TOOL_EQN
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}eqn
506 TOOL_FDISK
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-fdisk
507 TOOL_FGEN
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}fgen
508 TOOL_GENASSYM
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}genassym
509 TOOL_GENCAT
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}gencat
510 TOOL_GMAKE
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}gmake
511 TOOL_GREP
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}grep
512 TOOL_GROFF
= PATH
=${TOOLDIR}/lib
/groff
:$${PATH} ${TOOLDIR}/bin
/${_TOOL_PREFIX}groff
513 TOOL_HEXDUMP
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}hexdump
514 TOOL_HP300MKBOOT
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}hp300-mkboot
515 TOOL_HPPAMKBOOT
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}hppa-mkboot
516 TOOL_INDXBIB
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}indxbib
517 TOOL_INSTALLBOOT
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}installboot
518 TOOL_INSTALL_INFO
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}install-info
519 TOOL_JOIN
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}join
520 TOOL_LLVM_TBLGEN
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}llvm-tblgen
521 TOOL_M4
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}m4
522 TOOL_MACPPCFIXCOFF
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}macppc-fixcoff
523 TOOL_MAKEFS
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}makefs
524 TOOL_MAKEINFO
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}makeinfo
525 TOOL_MAKEKEYS
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}makekeys
526 TOOL_MAKESTRS
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}makestrs
527 TOOL_MAKEWHATIS
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}makewhatis
528 TOOL_MANDOC_ASCII
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}mandoc
-Tascii
529 TOOL_MANDOC_HTML
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}mandoc
-Thtml
530 TOOL_MANDOC_LINT
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}mandoc
-Tlint
531 TOOL_MDSETIMAGE
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-mdsetimage
532 TOOL_MENUC
= MENUDEF
=${TOOLDIR}/share
/misc
${TOOLDIR}/bin
/${_TOOL_PREFIX}menuc
533 TOOL_M68KELF2AOUT
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}m68k-elf2aout
534 TOOL_MIPSELF2ECOFF
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}mips-elf2ecoff
535 TOOL_MKCSMAPPER
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}mkcsmapper
536 TOOL_MKESDB
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}mkesdb
537 TOOL_MKFSMFS
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}mkfs.mfs
538 TOOL_MKLOCALE
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}mklocale
539 TOOL_MKMAGIC
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}file
540 TOOL_MKNOD
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}mknod
541 TOOL_MKTEMP
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}mktemp
542 TOOL_MKUBOOTIMAGE
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}mkubootimage
543 TOOL_ELFTOSB
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}elftosb
544 TOOL_MSGC
= MSGDEF
=${TOOLDIR}/share
/misc
${TOOLDIR}/bin
/${_TOOL_PREFIX}msgc
545 TOOL_MTREE
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}mtree
546 TOOL_NBPERF
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}perf
547 TOOL_NCDCS
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}ibmnws-ncdcs
548 TOOL_PAX
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}pax
549 TOOL_PIC
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}pic
550 TOOL_PIGZ
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}pigz
551 TOOL_PKG_CREATE
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}pkg_create
552 TOOL_POWERPCMKBOOTIMAGE
=${TOOLDIR}/bin
/${_TOOL_PREFIX}powerpc-mkbootimage
553 TOOL_PWD_MKDB
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}pwd_mkdb
554 TOOL_REFER
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}refer
555 TOOL_ROFF_ASCII
= PATH
=${TOOLDIR}/lib
/groff
:$${PATH} ${TOOLDIR}/bin
/${_TOOL_PREFIX}nroff
556 TOOL_ROFF_DOCASCII
= ${TOOL_GROFF} -Tascii
557 TOOL_ROFF_DOCHTML
= ${TOOL_GROFF} -Thtml
558 TOOL_ROFF_DVI
= ${TOOL_GROFF} -Tdvi
559 TOOL_ROFF_HTML
= ${TOOL_GROFF} -Tlatin1
-mdoc2html
560 TOOL_ROFF_PS
= ${TOOL_GROFF} -Tps
561 TOOL_ROFF_RAW
= ${TOOL_GROFF} -Z
562 TOOL_RPCGEN
= RPCGEN_CPP
=${CPP
:Q
} ${TOOLDIR}/bin
/${_TOOL_PREFIX}rpcgen
563 TOOL_SED
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}sed
564 TOOL_SLC
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}slc
565 TOOL_SOELIM
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}soelim
566 TOOL_SPARKCRC
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}sparkcrc
567 TOOL_STAT
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}stat
568 TOOL_STRFILE
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}strfile
569 TOOL_SUNLABEL
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}sunlabel
570 TOOL_TBL
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}tbl
571 TOOL_TIC
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}tic
572 TOOL_TOPROTO
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}toproto
573 TOOL_UUDECODE
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}uudecode
574 TOOL_VGRIND
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}vgrind
-f
575 TOOL_VFONTEDPR
= ${TOOLDIR}/libexec
/${_TOOL_PREFIX}vfontedpr
576 TOOL_ZIC
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}zic
578 .
else # USETOOLS != yes # } {
580 # Clang supports C, C++ and Objective C
583 TOOL_CPP.clang
= clang
-E
585 TOOL_CPP.clang
= clang-cpp
586 .
endif # defined(__MINIX)
587 TOOL_CXX.clang
= clang
++
588 TOOL_OBJC.clang
= clang
592 # GCC supports C, C++, Fortran and Objective C
599 # PCC supports C and Fortran
601 TOOL_CPP.pcc
= /usr
/libexec
/pcpp
604 TOOL_AMIGAAOUT2BB
= amiga-aout2bb
605 TOOL_AMIGAELF2BB
= amiga-elf2bb
606 TOOL_AMIGATXLT
= amiga-txlt
607 TOOL_ASN1_COMPILE
= asn1_compile
609 TOOL_CAP_MKDB
= cap_mkdb
613 # LSC: A full path has to be provided, as this is also used as a make
615 . if exists
(/usr
/pkg
/bin
/clang-tblgen
)
616 TOOL_CLANG_TBLGEN
= /usr
/pkg
/bin
/clang-tblgen
618 TOOL_CLANG_TBLGEN
= /usr
/bin
/clang-tblgen
619 .
endif # exists(/usr/pkg/bin/clang-tblgen)
621 TOOL_CLANG_TBLGEN
= clang-tblgen
622 .
endif # defined(__MINIX)
623 TOOL_COMPILE_ET
= compile_et
625 TOOL_CRUNCHGEN
= crunchgen
627 TOOL_CTFCONVERT
= ctfconvert
628 TOOL_CTFMERGE
= ctfmerge
630 TOOL_DISKLABEL
= disklabel
634 TOOL_GENASSYM
= genassym
639 TOOL_HEXDUMP
= hexdump
640 TOOL_HP300MKBOOT
= hp300-mkboot
641 TOOL_HPPAMKBOOT
= hppa-mkboot
642 TOOL_INDXBIB
= indxbib
643 TOOL_INSTALLBOOT
= installboot
644 TOOL_INSTALL_INFO
= install-info
647 # LSC: A full path has to be provided, as this is also used as a make
649 . if exists
(/usr
/pkg
/bin
/llvm-tblgen
)
650 TOOL_LLVM_TBLGEN
= /usr
/pkg
/bin
/llvm-tblgen
652 TOOL_LLVM_TBLGEN
= /usr
/bin
/llvm-tblgen
653 .
endif # exists(/usr/pkg/bin/llvm-tblgen)
655 TOOL_LLVM_TBLGEN
= llvm-tblgen
656 .
endif # defined(__MINIX)
658 TOOL_MACPPCFIXCOFF
= macppc-fixcoff
660 TOOL_MAKEINFO
= makeinfo
662 # LSC: A full path has to be provided, as this is also used as a make
664 TOOL_MAKEKEYS
= /usr
/X11R7
/bin
/makekeys
666 TOOL_MAKEKEYS
= makekeys
667 .
endif # defined(__MINIX)
669 # LSC: A full path has to be provided, as this is also used as a make
671 TOOL_MAKESTRS
= /usr
/X11R7
/bin
/makestrs
673 TOOL_MAKESTRS
= makestrs
674 .
endif # defined(__MINIX)
675 TOOL_MAKEWHATIS
= /usr
/libexec
/makewhatis
676 TOOL_MANDOC_ASCII
= mandoc
-Tascii
677 TOOL_MANDOC_HTML
= mandoc
-Thtml
678 TOOL_MANDOC_LINT
= mandoc
-Tlint
679 TOOL_MDSETIMAGE
= mdsetimage
681 TOOL_M68KELF2AOUT
= m68k-elf2aout
682 TOOL_MIPSELF2ECOFF
= mips-elf2ecoff
683 TOOL_MKCSMAPPER
= mkcsmapper
685 TOOL_MKFSMFS
= mkfs.mfs
686 TOOL_MKLOCALE
= mklocale
690 TOOL_MKUBOOTIMAGE
= mkubootimage
691 TOOL_ELFTOSB
= elftosb
699 TOOL_PKG_CREATE
= pkg_create
700 TOOL_POWERPCMKBOOTIMAGE
= powerpc-mkbootimage
701 TOOL_PWD_MKDB
= pwd_mkdb
703 TOOL_ROFF_ASCII
= nroff
704 TOOL_ROFF_DOCASCII
= ${TOOL_GROFF} -Tascii
705 TOOL_ROFF_DOCHTML
= ${TOOL_GROFF} -Thtml
706 TOOL_ROFF_DVI
= ${TOOL_GROFF} -Tdvi
707 TOOL_ROFF_HTML
= ${TOOL_GROFF} -Tlatin1
-mdoc2html
708 TOOL_ROFF_PS
= ${TOOL_GROFF} -Tps
709 TOOL_ROFF_RAW
= ${TOOL_GROFF} -Z
713 TOOL_SPARKCRC
= sparkcrc
716 TOOL_STRFILE
= /usr
/games
/strfile
718 TOOL_STRFILE
= strfile
719 .
endif # defined(__MINIX)
720 TOOL_SUNLABEL
= sunlabel
723 # LSC: There is a tic packaged, which has a completly different set of
724 # options, so make sure to use the base system one, always.
725 TOOL_TIC
= /usr
/bin
/tic
728 .
endif # defined(__MINIX)
729 TOOL_TOPROTO
= toproto
730 TOOL_UUDECODE
= uudecode
731 TOOL_VGRIND
= vgrind
-f
732 TOOL_VFONTEDPR
= /usr
/libexec
/vfontedpr
735 .
endif # USETOOLS != yes # }
737 # Fallback to ensure that all variables are defined to something
739 TOOL_CPP.false
= false
740 TOOL_CXX.false
= false
742 TOOL_OBJC.false
= false
743 TOOL_OPT.false
= false
744 TOOL_LLC.false
= false
746 AVAILABLE_COMPILER?
= ${HAVE_PCC
:Dpcc
} ${HAVE_LLVM
:Dclang
} ${HAVE_GCC
:Dgcc
} ${EXTERNAL_TOOLCHAIN
:Dgcc
} false
748 .for _t in CC CPP CXX FC OBJC OPT LLC
749 ACTIVE_
${_t}= ${AVAILABLE_COMPILER
:@.c.@
${ !defined
(UNSUPPORTED_COMPILER.
${.c.
}) && defined
(TOOL_
${_t}.
${.c.
}) :?
${.c.
} : }@
:[1]}
750 SUPPORTED_
${_t}=${AVAILABLE_COMPILER
:Nfalse
:@.c.@
${ !defined
(UNSUPPORTED_COMPILER.
${.c.
}) && defined
(TOOL_
${_t}.
${.c.
}) :?
${.c.
} : }@
}
752 # make bugs prevent moving this into the .for loop
753 CC
= ${TOOL_CC.
${ACTIVE_CC}}
754 CPP
= ${TOOL_CPP.
${ACTIVE_CPP}}
755 CXX
= ${TOOL_CXX.
${ACTIVE_CXX}}
756 FC
= ${TOOL_FC.
${ACTIVE_FC}}
757 OBJC
= ${TOOL_OBJC.
${ACTIVE_OBJC}}
758 OPT
= ${TOOL_OPT.
${ACTIVE_OPT}}
759 LLC
= ${TOOL_LLC.
${ACTIVE_LLC}}
761 # Override with tools versions if needed
762 .if
${MKCTF
:Uno
} != "no" && !defined
(NOCTF
)
763 CTFCONVERT
= ${TOOL_CTFCONVERT}
764 CTFMERGE
= ${TOOL_CTFMERGE}
767 # For each ${MACHINE_CPU}, list the ports that use it.
768 MACHINES.aarch64
= evbarm64
769 MACHINES.alpha
= alpha
770 MACHINES.arm
= acorn26 acorn32 cats epoc32 evbarm hpcarm \
771 iyonix netwinder shark zaurus
772 MACHINES.coldfire
= evbcf
776 MACHINES.m68000
= sun2
777 MACHINES.m68k
= amiga atari cesfic hp300 luna68k mac68k \
778 news68k next68k sun3 x68k
779 MACHINES.mips
= arc cobalt algor cobalt emips evbmips ews4800mips \
780 hpcmips mipsco newsmips pmax sbmips sgimips
782 MACHINES.powerpc
= amigappc bebox evbppc ibmnws macppc mvmeppc \
783 ofppc prep rs6000 sandpoint
784 MACHINES.riscv
= riscv
785 MACHINES.sh3
= dreamcast evbsh3 hpcsh landisk mmeye
786 MACHINES.sparc
= sparc sparc64
787 MACHINES.sparc64
= sparc64
789 MACHINES.x86_64
= amd64
791 # for crunchide & ldd, define the OBJECT_FMTS used by a MACHINE_ARCH
794 .if
${MACHINE_ARCH} != "alpha"
797 .if
${MACHINE_ARCH} == "alpha" ||
${MACHINE_ARCH
:M
*64*} != ""
801 # OBJCOPY flags to create a.out binaries for old firmware
802 # shared among src/distrib and ${MACHINE}/conf/Makefile.${MACHINE}.inc
803 .if
${MACHINE_CPU} == "arm"
804 OBJCOPY_ELF2AOUT_FLAGS?
= \
805 -O a.out-arm-netbsd \
823 -R .note.netbsd.ident
827 # Targets to check if DESTDIR or RELEASEDIR is provided
829 .if
!target
(check_DESTDIR
)
830 check_DESTDIR
: .PHONY .NOTMAIN
831 .if
!defined
(DESTDIR
)
832 @echo
"setenv DESTDIR before doing that!"
839 .if
!target
(check_RELEASEDIR
)
840 check_RELEASEDIR
: .PHONY .NOTMAIN
841 .if
!defined
(RELEASEDIR
)
842 @echo
"setenv RELEASEDIR before doing that!"
850 # Build a dynamically linked /bin and /sbin, with the necessary shared
851 # libraries moved from /usr/lib to /lib and the shared linker moved
852 # from /usr/libexec to /lib
854 # Note that if the BINDIR is not /bin or /sbin, then we always use the
855 # non-DYNAMICROOT behavior (i.e. it is only enabled for programs in /bin
856 # and /sbin). See <bsd.shlib.mk>.
861 # Where the system object and source trees are kept; can be configurable
862 # by the user in case they want them in ~/foosrc and ~/fooobj (for example).
866 NETBSDSRCDIR?
= ${BSDSRCDIR}
873 # These are here mainly because we don't want suid root in case
874 # a Makefile defines BINMODE.
880 MANDIR?
= /usr
/share
/man
883 MANMODE?
= ${NONBINMODE}
884 MANINSTALL?
= ${_MANINSTALL}
886 INFODIR?
= /usr
/share
/info
889 INFOMODE?
= ${NONBINMODE}
893 LINTLIBDIR?
= /usr
/libdata
/lint
896 LIBMODE?
= ${NONBINMODE}
898 DOCDIR?
= /usr
/share
/doc
901 DOCMODE?
= ${NONBINMODE}
903 NLSDIR?
= /usr
/share
/nls
906 NLSMODE?
= ${NONBINMODE}
910 KMODULEMODE?
= ${NONBINMODE}
912 LOCALEDIR?
= /usr
/share
/locale
915 LOCALEMODE?
= ${NONBINMODE}
917 FIRMWAREDIR?
= /libdata
/firmware
920 FIRMWAREMODE?
= ${NONBINMODE}
922 DEBUGDIR?
= /usr
/libdata
/debug
925 DEBUGMODE?
= ${NONBINMODE}
928 # Data-driven table using make variables to control how
929 # toolchain-dependent targets and shared libraries are built
930 # for different platforms and object formats.
932 # OBJECT_FMT: currently either "ELF" or "a.out".
934 # All platforms are ELF.
939 # If this platform's toolchain is missing, we obviously cannot build it.
941 .if
${TOOLCHAIN_MISSING} != "no"
948 # If we are using an external toolchain, we can still build the target's
949 # binutils, but we cannot build GCC's support libraries, since those are
950 # tightly-coupled to the version of GCC being used.
952 .if defined
(EXTERNAL_TOOLCHAIN
)
956 # No GDB support for aarch64
962 # No kernel modules for or1k (yet)
967 # No profiling for or1k (yet)
973 # The m68000 port is incomplete.
975 .if
${MACHINE_ARCH} == "m68000"
978 # XXX GCC 4 outputs mcount() calling sequences that try to load values
979 # from over 64KB away and this fails to assemble.
980 .if defined
(HAVE_GCC
)
986 # The ia64 port is incomplete.
992 # On the MIPS, all libs are compiled with ABIcalls (and are thus PIC),
993 # not just shared libraries, so don't build the _pic version.
995 .if
${MACHINE_ARCH} == "mipsel" ||
${MACHINE_ARCH} == "mipseb" || \
996 ${MACHINE_ARCH} == "mips64el" ||
${MACHINE_ARCH} == "mips64eb"
1000 # PowerPC64 and AArch64 ABI's are PIC
1001 MKPICLIB.powerpc64
= no
1002 #MKPICLIB.aarch64= no
1005 # On VAX using ELF, all objects are PIC, not just shared libraries,
1006 # so don't build the _pic version.
1011 # Location of the file that contains the major and minor numbers of the
1012 # version of a shared library. If this file exists a shared library
1013 # will be built by <bsd.lib.mk>.
1015 SHLIB_VERSION_FILE?
= ${.CURDIR
}/shlib_version
1018 # GNU sources and packages sometimes see architecture names differently.
1020 GNU_ARCH.aarch64eb
=aarch64_be
1021 GNU_ARCH.coldfire
=m5407
1024 GNU_ARCH.earmeb
=armeb
1025 GNU_ARCH.earmhfeb
=armeb
1026 GNU_ARCH.earmv4
=armv4
1027 GNU_ARCH.earmv4eb
=armv4eb
1029 GNU_ARCH.earmv5eb
=armeb
1030 GNU_ARCH.earmv6
=armv6
1031 GNU_ARCH.earmv6hf
=armv6
1032 GNU_ARCH.earmv6eb
=armv6eb
1033 GNU_ARCH.earmv6hfeb
=armv6eb
1034 GNU_ARCH.earmv7
=armv7
1035 GNU_ARCH.earmv7hf
=armv7
1036 GNU_ARCH.earmv7eb
=armv7eb
1037 GNU_ARCH.earmv7hfeb
=armv7eb
1039 GCC_CONFIG_ARCH.i386
=i486
1040 GCC_CONFIG_TUNE.i386
=nocona
1041 GCC_CONFIG_TUNE.x86_64
=nocona
1042 GNU_ARCH.m68000
=m68010
1045 GNU_ARCH.mips64eb
=mips64
1047 .if defined
(__MINIX
)
1049 GCC_CONFIG_ARCH.earm
=armv7-a
1051 # MINIX/intel default
1053 GCC_CONFIG_ARCH.i386
=i586
1055 .
endif # defined(__MINIX)
1057 MACHINE_GNU_ARCH
=${GNU_ARCH.
${MACHINE_ARCH}:U
${MACHINE_ARCH}}
1060 # In order to identify NetBSD to GNU packages, we sometimes need
1061 # an "elf" tag for historically a.out platforms.
1063 .if
(!empty
(MACHINE_ARCH
:Mearm
*))
1064 MACHINE_GNU_PLATFORM?
=${MACHINE_GNU_ARCH}--netbsdelf-
${MACHINE_ARCH
:C
/eb
//:C
/v
[4-7]//:S
/earm
/eabi
/}
1065 .elif
(${MACHINE_GNU_ARCH} == "arm" || \
1066 ${MACHINE_GNU_ARCH} == "armeb" || \
1067 ${MACHINE_ARCH} == "i386" || \
1068 ${MACHINE_CPU} == "m68k" || \
1069 ${MACHINE_GNU_ARCH} == "sh" || \
1070 ${MACHINE_GNU_ARCH} == "shle" || \
1071 ${MACHINE_ARCH} == "sparc" || \
1072 ${MACHINE_ARCH} == "vax")
1073 MACHINE_GNU_PLATFORM?
=${MACHINE_GNU_ARCH}--netbsdelf
1075 MACHINE_GNU_PLATFORM?
=${MACHINE_GNU_ARCH}--netbsd
1078 .if defined
(__MINIX
)
1079 # We have a simpler toolchain naming scheme
1080 MACHINE_GNU_PLATFORM
:=${MACHINE_GNU_ARCH}-elf32-minix
1082 # We need to check for HAVE_GOLD after LD has been set
1083 . if
${_HAVE_GOLD
:U
} == ""
1084 _HAVE_GOLD
!= (exec
2>&1; ${LD} --version || echo
"")
1085 _GOLD_MATCH
:=${_HAVE_GOLD
:Mgold
}
1086 _HAVE_GOLD
:= ${_HAVE_GOLD
:M
[0-9]\.
[0-9][0-9]}
1088 . if
${_GOLD_MATCH} != "" && ${_HAVE_GOLD} != ""
1089 HAVE_GOLD?
= ${_HAVE_GOLD}
1091 # Without -Wl,--no-ctors-in-init-array, gold moves the constructors out of
1092 # .ctors into .init_array, which is bad on intel.
1093 LDFLAGS
+= -Wl
,--no-ctors-in-init-array
1097 .
endif # ${_HAVE_GOLD:U} == ""
1098 .
endif # defined(__MINIX)
1100 .if
!empty
(MACHINE_ARCH
:M
*arm
*)
1101 # Flags to pass to CC for using the old APCS ABI on ARM for compat or stand.
1102 ARM_APCS_FLAGS
= -mabi
=apcs-gnu
-mfloat-abi
=soft
1103 ARM_APCS_FLAGS
+=${${ACTIVE_CC} == "gcc":?
-marm
:}
1104 ARM_APCS_FLAGS
+=${${ACTIVE_CC} == "clang":?
-target
${MACHINE_GNU_ARCH}--netbsdelf
-B
${TOOLDIR}/${MACHINE_GNU_PLATFORM}/bin
:}
1107 GENASSYM_CPPFLAGS
+= ${${ACTIVE_CC} == "clang":?
-no-integrated-as
:}
1109 TARGETS
+= all clean cleandir depend dependall includes \
1110 install lint obj regress
tags html analyze
1111 PHONY_NOTMAIN
= all clean cleandir depend dependall
distclean includes \
1112 install lint obj regress beforedepend afterdepend \
1113 beforeinstall afterinstall realinstall realdepend realall \
1114 html subdir-all subdir-install subdir-depend analyze
1115 .PHONY
: ${PHONY_NOTMAIN}
1116 .NOTMAIN
: ${PHONY_NOTMAIN}
1118 .if
${NEED_OWN_INSTALL_TARGET} != "no"
1119 .if
!target
(install)
1120 install: beforeinstall .WAIT subdir-install realinstall .WAIT afterinstall
1126 all: realall subdir-all
1129 depend
: realdepend subdir-depend
1135 dependall
: .NOTMAIN realdepend .MAKE
1136 @cd
"${.CURDIR}"; ${MAKE} realall
1140 # Define MKxxx variables (which are either yes or no) for users
1141 # to set in /etc/mk.conf and override in the make environment.
1142 # These should be tested with `== "no"' or `!= "no"'.
1143 # The NOxxx variables should only be set by Makefiles.
1145 # Please keep etc/Makefile and share/man/man5/mk.conf.5 in sync
1146 # with changes to the MK* variables here.
1150 # Supported NO* options (if defined, MK* will be forced to "no",
1151 # regardless of user's mk.conf setting).
1153 # Source makefiles should set NO*, and not MK*, and must do so before
1154 # including bsd.own.mk.
1157 NOCRYPTO NODOC NOHTML NOINFO NOLINKLIB NOLINT NOMAN NONLS NOOBJ NOPIC \
1158 NOPICINSTALL NOPROFILE NOSHARE NOSTATICLIB
1160 MK
${var
:S
/^NO
//}:= no
1165 # Older-style variables that enabled behaviour when set.
1167 .for var in MANZ UNPRIVED UPDATE
1174 # MK* options which have variable defaults.
1176 .if
${MACHINE_ARCH} == "x86_64" ||
${MACHINE_ARCH} == "sparc64" \
1177 ||
${MACHINE_ARCH} == "mips64eb" ||
${MACHINE_ARCH} == "mips64el" \
1178 ||
${MACHINE_ARCH} == "powerpc64" ||
${MACHINE_CPU} == "aarch64" \
1179 ||
${MACHINE_ARCH} == "riscv64" \
1180 ||
!empty
(MACHINE_ARCH
:Mearm
*)
1183 # Don't let this build where it really isn't supported.
1189 .if
${MACHINE_ARCH} == "x86_64" ||
${MACHINE_ARCH} == "i386" \
1190 ||
${MACHINE_ARCH} == "mips64eb" ||
${MACHINE_ARCH} == "mips64el" \
1191 ||
(${MACHINE} == "evbppc" && ${MACHINE_ARCH} == "powerpc")
1192 MKCOMPATMODULES?
= yes
1194 MKCOMPATMODULES
:= no
1198 # Default mips64 to softfloat now.
1199 # arm is always softfloat unless it isn't
1200 # emips is always softfloat.
1201 # coldfire is always softfloat
1202 # or1k is always softfloat
1204 .if
${MACHINE_ARCH} == "mips64eb" ||
${MACHINE_ARCH} == "mips64el" || \
1205 (${MACHINE_CPU} == "arm" && ${MACHINE_ARCH
:M
*hf
*} == "") || \
1206 ${MACHINE_ARCH} == "coldfire" ||
${MACHINE_CPU} == "or1k" || \
1207 ${MACHINE} == "emips"
1211 .if
${MACHINE} == "emips"
1215 .if
${MACHINE_ARCH} == "i386" || \
1216 ${MACHINE_ARCH} == "x86_64" || \
1217 ${MACHINE_ARCH} == "sparc"
1224 # MK* backward compatibility.
1227 MKBINUTILS?
= ${MKBFD}
1231 # We want to build zfs only for amd64 by default for now.
1233 .if
${MACHINE} == "amd64"
1238 # MK* options which default to "yes".
1243 MKCRYPTO MKCOMPLEX MKCVS MKCXX \
1245 MKGCC MKGDB MKGROFF \
1247 MKIEEEFP MKINET6 MKINFO MKIPFILTER MKISCSI \
1250 MKLDAP MKLIBSTDCXX MKLINKLIB MKLVM \
1258 MKPF MKPIC MKPICINSTALL MKPICLIB MKPOSTFIX MKPROFILE \
1260 MKSHARE MKSKEY MKSTATICLIB \
1264 #MINIX-specific vars
1266 MKSYSDEBUG MKLIVEUPDATE MKLLVMCMDS
1267 .if
(${MACHINE_ARCH} == "i386")
1269 MKWATCHDOG MKACPI MKAPIC MKDEBUGREG MKINSTALLBOOT MKPCI
1272 .for var in
${_MKVARS.yes
}
1273 ${var}?
= ${${var}.
${MACHINE_ARCH}:Uyes
}
1277 # MKGCCCMDS is only valid if we are building GCC so make it dependent on that.
1279 _MKVARS.yes
+= MKGCCCMDS
1280 MKGCCCMDS?
= ${MKGCC}
1283 # Exceptions to the above:
1285 .if
${MACHINE} == "acorn26" # page size is prohibitive
1290 # MK* options which default to "no". Note that MKZFS has a different
1291 # default for some platforms, see above.
1294 MKBSDGREP MKBSDTAR \
1295 MKCATPAGES MKCOMPATTESTS MKCOMPATX11 MKCRYPTO_RC5 MKCTF MKDEBUG \
1296 MKDEBUGLIB MKDTRACE MKEXTSRC MKGROFFHTMLDOC \
1297 MKKYUA MKLLD MKLLDB MKLINT \
1298 MKMANZ MKMCLINKER MKOBJDIRS \
1299 MKLIBCXX MKLLVM MKPCC \
1302 MKSOFTFLOAT MKSTRIPIDENT MKTPM \
1303 MKUNPRIVED MKUPDATE MKX11 MKX11MOTIF MKZFS
1305 #MINIX-specific vars
1307 MKIMAGEONLY MKSMALL MKBITCODE MKMAGIC MKPAE MKASR MKSRC
1308 .if
!empty
(MACHINE_ARCH
:Mearm
*)
1310 MKWATCHDOG MKPAE MKACPI MKAPIC MKDEBUGREG MKINSTALLBOOT MKPCI
1313 .for var in
${_MKVARS.no
}
1314 ${var}?
= ${${var}.
${MACHINE_ARCH}:Uno
}
1318 # Which platforms build the xorg-server drivers (as opposed
1319 # to just Xnest and Xvfb.)
1321 .if
${MACHINE} == "alpha" || \
1322 ${MACHINE} == "amd64" || \
1323 ${MACHINE} == "bebox" || \
1324 ${MACHINE} == "cats" || \
1325 ${MACHINE} == "dreamcast" || \
1326 ${MACHINE} == "ews4800mips" || \
1327 ${MACHINE} == "evbarm" || \
1328 ${MACHINE} == "evbmips" || \
1329 ${MACHINE} == "hp300" || \
1330 ${MACHINE} == "hpcarm" || \
1331 ${MACHINE} == "hpcmips" || \
1332 ${MACHINE} == "hpcsh" || \
1333 ${MACHINE} == "i386" || \
1334 ${MACHINE} == "luna68k" || \
1335 ${MACHINE} == "mac68k" || \
1336 ${MACHINE} == "macppc" || \
1337 ${MACHINE} == "netwinder" || \
1338 ${MACHINE} == "newsmips" || \
1339 ${MACHINE} == "prep" || \
1340 ${MACHINE} == "ofppc" || \
1341 ${MACHINE} == "sgimips" || \
1342 ${MACHINE} == "shark" || \
1343 ${MACHINE} == "sparc" || \
1344 ${MACHINE} == "sparc64" || \
1345 ${MACHINE} == "vax" || \
1346 ${MACHINE} == "zaurus"
1353 # Force some options off if their dependencies are off.
1356 .if
${MKCXX} == "no"
1362 .if
${MKCRYPTO} == "no"
1367 .if
${MKMAN} == "no"
1372 _MANINSTALL
= maninstall
1373 .if
${MKCATPAGES} != "no"
1374 _MANINSTALL
+= catinstall
1376 .if
${MKHTML} != "no"
1377 _MANINSTALL
+= htmlinstall
1380 .if
${MKLINKLIB} == "no"
1386 .if
${MKPIC} == "no"
1390 .if
${MKOBJ} == "no"
1394 .if
${MKSHARE} == "no"
1404 .if
${MKSMALL} == "yes"
1413 # MINIX: MKASR implies MKMAGIC
1414 .if
${MKASR} == "yes"
1418 # MINIX: MKMAGIC implies MKBITCODE
1419 .if
${MKMAGIC} == "yes"
1423 .if
!empty
(MACHINE_ARCH
:Mearm
*)
1424 _NEEDS_LIBCXX.
${MACHINE_ARCH}= yes
1426 _NEEDS_LIBCXX.i386
= yes
1427 _NEEDS_LIBCXX.powerpc
= yes
1428 _NEEDS_LIBCXX.powerpc64
= yes
1429 _NEEDS_LIBCXX.x86_64
= yes
1430 _NEEDS_LIBCXX.aarch64
= yes
1432 .if
${MKLLVM} == "yes" && ${_NEEDS_LIBCXX.
${MACHINE_ARCH}:Uno
} == "yes"
1437 # install(1) parameters.
1440 .if
${MKUPDATE} == "no"
1449 METALOG?
= ${DESTDIR}/METALOG
1450 METALOG.add?
= ${TOOL_CAT} -l
>> ${METALOG}
1451 .if
(${_SRC_TOP_} != "") # only set INSTPRIV if inside ${NETBSDSRCDIR}
1452 .if
${MKUNPRIVED} != "no"
1453 INSTPRIV.unpriv
=-U
-M
${METALOG} -D
${DESTDIR} -h sha256
1457 INSTPRIV?
= ${INSTPRIV.unpriv
} -N
${NETBSDSRCDIR}/etc
1461 .if
${NEED_OWN_INSTALL_TARGET} != "no"
1462 INSTALL_DIR?
= ${INSTALL} ${INSTPRIV} -d
1463 INSTALL_FILE?
= ${INSTALL} ${INSTPRIV} ${COPY} ${PRESERVE} ${RENAME}
1464 INSTALL_LINK?
= ${INSTALL} ${INSTPRIV} ${HRDLINK} ${RENAME}
1465 INSTALL_SYMLINK?
= ${INSTALL} ${INSTPRIV} ${SYMLINK} ${RENAME}
1469 # Set defaults for the USE_xxx variables.
1473 # USE_* options which default to "no" and will be forced to "no" if their
1474 # corresponding MK* variable is set to "no".
1476 .for var in USE_SKEY
1477 .if
(${${var
:S
/USE_
/MK
/}} == "no")
1485 # USE_* options which default to "yes" unless their corresponding MK*
1486 # variable is set to "no".
1488 .for var in USE_HESIOD USE_INET6 USE_KERBEROS USE_LDAP USE_PAM USE_YP
1489 .if
(${${var
:S
/USE_
/MK
/}} == "no")
1496 #MINIX-specific vars
1498 USE_WATCHDOG USE_ACPI USE_PAE USE_APIC USE_DEBUGREG USE_SYSDEBUG \
1499 USE_LIVEUPDATE USE_PCI USE_BITCODE USE_MAGIC USE_ASR
1500 .if
(${${var
:S
/USE_
/MK
/}} == "no")
1508 # USE_* options which default to "yes".
1510 .for var in USE_JEMALLOC
1515 # USE_* options which default to "no".
1517 # For now, disable pigz as compressor by default
1518 .for var in USE_PIGZGZIP USE_LIBTRE
1523 # TOOL_GZIP and friends. These might refer to TOOL_PIGZ or to the host gzip.
1525 .if
${USE_PIGZGZIP} != "no"
1526 TOOL_GZIP
= ${TOOL_PIGZ}
1532 TOOL_GZIP_N
= ${TOOL_GZIP} ${GZIP_N_FLAG}
1535 # Where X11 sources are and where it is installed to.
1537 .if
!defined
(X11SRCDIR
)
1538 .if exists
(${NETBSDSRCDIR}/..
/xsrc
)
1539 X11SRCDIR
!= cd
"${NETBSDSRCDIR}/../xsrc" && pwd
1541 X11SRCDIR
= /usr
/xsrc
1543 .
endif # !defined(X11SRCDIR)
1545 X11SRCDIR.local?
= ${X11SRCDIR}/local
1546 X11ROOTDIR?
= /usr
/X11R7
1547 X11BINDIR?
= ${X11ROOTDIR}/bin
1548 X11ETCDIR?
= /etc
/X11
1549 X11FONTDIR?
= ${X11ROOTDIR}/lib
/X11
/fonts
1550 X11INCDIR?
= ${X11ROOTDIR}/include
1551 X11LIBDIR?
= ${X11ROOTDIR}/lib
/X11
1552 X11MANDIR?
= ${X11ROOTDIR}/man
1553 X11SHAREDIR?
= ${X11ROOTDIR}/share
1554 X11USRLIBDIR?
= ${X11ROOTDIR}/lib
${MLIBDIR
:D
/${MLIBDIR}}
1557 # New modular-xorg based builds
1559 X11SRCDIRMIT?
= ${X11SRCDIR}/external
/mit
1561 FS ICE SM X11 XScrnSaver XTrap Xau Xcomposite Xcursor Xdamage \
1562 Xdmcp Xevie Xext Xfixes Xfont Xft Xi Xinerama Xmu Xpresent Xpm \
1563 Xrandr Xrender Xres Xt Xtst Xv XvMC Xxf86dga Xxf86misc Xxf86vm drm \
1564 fontenc xkbfile xkbui Xaw Xfontcache pciaccess xcb \
1566 X11SRCDIR.
${_lib}?
= ${X11SRCDIRMIT}/lib
${_lib}/dist
1570 xcmisc xext xf86bigfont bigreqs input kb x fonts fixes scrnsaver \
1571 xinerama dri2 dri3 render resource record video xf86dga xf86misc \
1572 xf86vidmode composite damage trap gl randr fontcache xf86dri \
1574 X11SRCDIR.
${_proto}proto?
= ${X11SRCDIRMIT}/${_proto}proto
/dist
1578 xtrans fontconfig freetype evieext mkfontscale bdftopcf \
1579 xkbcomp xorg-cf-files imake xorg-server xbiff xkeyboard-config \
1580 xbitmaps appres xeyes xev xedit sessreg pixman \
1581 beforelight bitmap editres makedepend fonttosfnt fslsfonts fstobdf \
1582 glu glw mesa-demos MesaGLUT MesaLib MesaLib7 \
1583 ico iceauth listres lndir \
1584 luit xproxymanagementprotocol mkfontdir oclock proxymngr rgb \
1585 rstart setxkbmap showfont smproxy twm viewres \
1586 x11perf xauth xcalc xclipboard \
1587 xclock xcmsdb xconsole xditview xdpyinfo xdriinfo xdm \
1588 xfd xf86dga xfindproxy xfontsel xfwp xgamma xgc xhost xinit \
1589 xkill xload xlogo xlsatoms xlsclients xlsfonts xmag xmessage \
1590 xmh xmodmap xmore xman xprop xrandr xrdb xrefresh xset \
1591 xsetmode xsetpointer xsetroot xsm xstdcmap xvidtune xvinfo \
1592 xwininfo xwud xkbprint xkbevd \
1593 xterm xwd xfs xfsinfo xtrap xkbutils xkbcomp \
1594 xkeyboard-config xinput xcb-util xorg-docs \
1595 font-adobe-100dpi font-adobe-75dpi font-adobe-utopia-100dpi \
1596 font-adobe-utopia-75dpi font-adobe-utopia-type1 \
1598 font-bh-100dpi font-bh-75dpi font-bh-lucidatypewriter-100dpi \
1599 font-bh-lucidatypewriter-75dpi font-bh-ttf font-bh-type1 \
1600 font-bitstream-100dpi font-bitstream-75dpi font-bitstream-type1 \
1601 font-cursor-misc font-daewoo-misc font-dec-misc font-ibm-type1 \
1602 font-isas-misc font-jis-misc font-misc-misc font-mutt-misc \
1603 font-sony-misc font-util ttf-bitstream-vera encodings
1604 X11SRCDIR.
${_dir}?
= ${X11SRCDIRMIT}/${_dir}/dist
1608 elographics keyboard mouse synaptics vmmouse void ws
1609 X11SRCDIR.xf86-input-
${_i}?
= ${X11SRCDIRMIT}/xf86-input-
${_i}/dist
1613 ag10e apm ark ast ati ati-kms chips cirrus crime \
1614 geode glint i128 i740 igs imstt intel intel-old mach64 mga \
1615 neomagic newport nsc nv nvxbox openchrome pnozz \
1616 r128 radeonhd rendition \
1617 s3 s3virge savage siliconmotion sis suncg14 \
1618 suncg6 sunffb sunleo suntcx \
1619 tdfx tga trident tseng vesa vga vmware wsfb xgi
1620 X11SRCDIR.xf86-video-
${_v}?
= ${X11SRCDIRMIT}/xf86-video-
${_v}/dist
1623 # Only install the radeon firmware on DRM-happy systems.
1624 .if
${MACHINE_ARCH} == "x86_64" ||
${MACHINE_ARCH} == "i386"
1625 MKRADEONFIRMWARE?
= yes
1627 MKRADEONFIRMWARE?
= no
1634 # Where extsrc sources are and where it is installed to.
1636 .if
!defined
(EXTSRCSRCDIR
)
1637 .if exists
(${NETBSDSRCDIR}/..
/extsrc
)
1638 EXTSRCSRCDIR
!= cd
"${NETBSDSRCDIR}/../extsrc" && pwd
1640 EXTSRCSRCDIR
= /usr
/extsrc
1642 .
endif # !defined(EXTSRCSRCDIR)
1644 EXTSRCROOTDIR?
= /usr
/ext
1645 EXTSRCBINDIR?
= ${EXTSRCROOTDIR}/bin
1646 EXTSRCETCDIR?
= /etc
/ext
1647 EXTSRCINCDIR?
= ${EXTSRCROOTDIR}/include
1648 EXTSRCLIBDIR?
= ${EXTSRCROOTDIR}/lib
/ext
1649 EXTSRCMANDIR?
= ${EXTSRCROOTDIR}/man
1650 EXTSRCUSRLIBDIR?
= ${EXTSRCROOTDIR}/lib
1653 # MAKEDIRTARGET dir target [extra make(1) params]
1654 # run "cd $${dir} && ${MAKEDIRTARGETENV} ${MAKE} [params] $${target}", with a pretty message
1658 @_makedirtarget
() { \
1660 target
="$$1"; shift
; \
1662 /*) this
="$${dir}/"; \
1664 .
) this
="${_THISDIR_}"; \
1665 real
="${.CURDIR}" ;; \
1666 *) this
="${_THISDIR_}$${dir}/"; \
1667 real
="${.CURDIR}/$${dir}" ;; \
1670 echo
"$${target} ===> $${show%/}$${1:+ (with: $$@)}"; \
1672 && ${MAKEDIRTARGETENV} ${MAKE} _THISDIR_
="$${this}" "$$@" $${target}; \
1677 # MAKEVERBOSE support. Levels are:
1678 # 0 Minimal output ("quiet")
1679 # 1 Describe what is occurring
1680 # 2 Describe what is occurring and echo the actual command
1681 # 3 Ignore the effect of the "@" prefix in make commands
1682 # 4 Trace shell commands using the shell's -x flag
1686 .if
${MAKEVERBOSE} == 0
1691 .elif
${MAKEVERBOSE} == 1
1696 .
else # MAKEVERBOSE >= 2
1697 _MKMSG?
= @echo
'\# '
1698 _MKSHMSG?
= echo
'\# '
1700 .SILENT
: __makeverbose_dummy_target__
1701 .
endif # MAKEVERBOSE >= 2
1702 .if
${MAKEVERBOSE} >= 3
1704 .
endif # ${MAKEVERBOSE} >= 3
1705 .if
${MAKEVERBOSE} >= 4
1707 .
endif # ${MAKEVERBOSE} >= 4
1709 _MKMSG_BUILD?
= ${_MKMSG} " build "
1710 _MKMSG_CREATE?
= ${_MKMSG} " create "
1711 _MKMSG_COMPILE?
= ${_MKMSG} "compile "
1712 _MKMSG_FORMAT?
= ${_MKMSG} " format "
1713 _MKMSG_INSTALL?
= ${_MKMSG} "install "
1714 _MKMSG_LINK?
= ${_MKMSG} " link "
1715 _MKMSG_LEX?
= ${_MKMSG} " lex "
1716 _MKMSG_REMOVE?
= ${_MKMSG} " remove "
1717 _MKMSG_YACC?
= ${_MKMSG} " yacc "
1719 _MKSHMSG_CREATE?
= ${_MKSHMSG} " create "
1720 _MKSHMSG_INSTALL?
= ${_MKSHMSG} "install "
1722 _MKTARGET_BUILD?
= ${_MKMSG_BUILD} ${.CURDIR
:T
}/${.TARGET
}
1723 _MKTARGET_CREATE?
= ${_MKMSG_CREATE} ${.CURDIR
:T
}/${.TARGET
}
1724 _MKTARGET_COMPILE?
= ${_MKMSG_COMPILE} ${.CURDIR
:T
}/${.TARGET
}
1725 _MKTARGET_FORMAT?
= ${_MKMSG_FORMAT} ${.CURDIR
:T
}/${.TARGET
}
1726 _MKTARGET_INSTALL?
= ${_MKMSG_INSTALL} ${.TARGET
}
1727 _MKTARGET_LINK?
= ${_MKMSG_LINK} ${.CURDIR
:T
}/${.TARGET
}
1728 _MKTARGET_LEX?
= ${_MKMSG_LEX} ${.CURDIR
:T
}/${.TARGET
}
1729 _MKTARGET_REMOVE?
= ${_MKMSG_REMOVE} ${.TARGET
}
1730 _MKTARGET_YACC?
= ${_MKMSG_YACC} ${.CURDIR
:T
}/${.TARGET
}
1732 .if
${MKMANDOC} == "yes"
1733 TARGETS
+= lintmanpages
1736 TESTSBASE
= /usr
/tests
${MLIBDIR
:D
/${MLIBDIR}}
1738 .
endif # !defined(_BSD_OWN_MK_)