xref: /minix3/share/mk/bsd.own.mk (revision 5e9e5b98f6f1bc482c78412565788f0e34ae42b6)
10a6a1f1dSLionel Sambuc#	$NetBSD: bsd.own.mk,v 1.874 2015/09/30 22:58:02 rjs Exp $
2e1091647SArun Thomas
39152e1c5SLionel Sambuc# This needs to be before bsd.init.mk
49152e1c5SLionel Sambuc.if defined(BSD_MK_COMPAT_FILE)
59152e1c5SLionel Sambuc.include <${BSD_MK_COMPAT_FILE}>
69152e1c5SLionel Sambuc.endif
7e1091647SArun Thomas
89152e1c5SLionel Sambuc.if !defined(_BSD_OWN_MK_)
99152e1c5SLionel Sambuc_BSD_OWN_MK_=1
109152e1c5SLionel Sambuc
11d19d7d58SLionel Sambuc.if defined(__MINIX)
12b8a678efSLionel Sambuc
13b8a678efSLionel Sambuc# Some Minix deviations from NetBSD
14b8a678efSLionel SambucLDSTATIC?=	-static
15b8a678efSLionel SambucMKDYNAMICROOT?=	no
160cdf705cSLionel SambucNO_LIBGOMP?=	yes
17b8a678efSLionel Sambuc
18b8a678efSLionel SambucBINMODE?=	755
19b8a678efSLionel SambucNONBINMODE?=	644
20b8a678efSLionel SambucMANDIR?=	/usr/man
21b8a678efSLionel Sambuc
2284d9c625SLionel SambucMKKYUA?=	yes
23f4a2713aSLionel SambucMKMCLINKER?=	no
24f4a2713aSLionel SambucMKCLANGRT?=	no
25b8a678efSLionel SambucMKGCC?=		no
260cdf705cSLionel SambucMKGCCCMDS?=	no
2784a7c3f4SLionel SambucMKPROFILE?=	no
2811be35a1SLionel SambucMKSLJIT?=	no
29b8a678efSLionel Sambuc
3084a7c3f4SLionel Sambuc#MINIX-specific variables
3184a7c3f4SLionel SambucMKCOVERAGE?=	no
3284a7c3f4SLionel Sambuc
3384a7c3f4SLionel Sambuc# LSC MINIX does not support these features ATM.
3484a7c3f4SLionel SambucUSE_FORT:=	no
3584a7c3f4SLionel SambucUSE_SSP:=	no
360a6a1f1dSLionel SambucMKCOMPAT:=	no
3784a7c3f4SLionel SambucMKGDB:=		no
3884a7c3f4SLionel SambucMKGROFF:=	no
3984a7c3f4SLionel SambucMKHESIOD:=	no
4084a7c3f4SLionel SambucMKHTML:=	no
4184a7c3f4SLionel SambucMKIPFILTER:=	no
4284a7c3f4SLionel SambucMKISCSI:=	no
4384a7c3f4SLionel SambucMKKERBEROS:=	no
4484a7c3f4SLionel SambucMKKMOD:=	no
4584a7c3f4SLionel SambucMKLDAP:=	no
4684a7c3f4SLionel SambucMKLINT:=	no
4784a7c3f4SLionel SambucMKLVM:=		no
4884a7c3f4SLionel SambucMKMDNS:=	no
4984a7c3f4SLionel SambucMKNPF:=		no
5084a7c3f4SLionel SambucMKPAM:=		no
5184a7c3f4SLionel SambucMKPF:=		no
5284a7c3f4SLionel SambucMKPOSTFIX:=	no
5384a7c3f4SLionel SambucMKRUMP:=	no
5484a7c3f4SLionel SambucMKSKEY:=	no
5584a7c3f4SLionel SambucMKYP:=		no
560a6a1f1dSLionel SambucMKCROSSGDB:=	no
5784a7c3f4SLionel Sambuc
58dd859593SKoustubha BhatWEAKALIASOVERRIDEPASS?=${NETBSDSRCDIR}/minix/llvm/bin/weak-alias-module-override.so
595ba302fdSKoustubha BhatGOLD_PLUGIN?=${NETBSDSRCDIR}/minix/llvm/bin/LLVMgold.so
604684ddb6SLionel Sambuc
614684ddb6SLionel Sambuc# By default when running LLVM passes:
624684ddb6SLionel Sambuc#  -  do not run optimization while running LLVM passes
634684ddb6SLionel Sambuc#  -  run the passe which allows assembly weak symbols to be
644684ddb6SLionel Sambuc#     overriden by bitcode functions
654684ddb6SLionel SambucOPTFLAGS?=	-disable-opt \
660a6a1f1dSLionel Sambuc		-disable-inlining \
674684ddb6SLionel Sambuc		-load ${WEAKALIASOVERRIDEPASS} -weak-alias-module-override
684684ddb6SLionel Sambuc
699f6977d2SCristiano GiuffridaBITCODE_LD_FLAGS_1ST?= \
704684ddb6SLionel Sambuc		-Wl,-plugin=${GOLD_PLUGIN} \
714684ddb6SLionel Sambuc		-Wl,-plugin-opt=-disable-opt \
729f6977d2SCristiano Giuffrida		-Wl,-plugin-opt=-disable-inlining
739f6977d2SCristiano Giuffrida
749f6977d2SCristiano GiuffridaBITCODE_LD_FLAGS_2ND?=${BITCODE_LD_FLAGS_1ST}
754684ddb6SLionel Sambuc
7662c66656STomas Hruby.ifdef CONFIG_SMP
7762c66656STomas HrubySMP_FLAGS += -DCONFIG_SMP
7862c66656STomas Hruby.ifdef CONFIG_MAX_CPUS
7962c66656STomas HrubySMP_FLAGS += -DCONFIG_MAX_CPUS=${CONFIG_MAX_CPUS}
8062c66656STomas Hruby.endif
8162c66656STomas Hruby.endif
8262c66656STomas Hruby
83862fb835SArun ThomasCPPFLAGS+= ${SMP_FLAGS}
8462c66656STomas Hruby
85*5e9e5b98SArne Welzel# Disabled unaligned accesses on ARM
86*5e9e5b98SArne Welzel.if !empty(MACHINE_ARCH:Mearm*)
87*5e9e5b98SArne WelzelCFLAGS+= -mno-unaligned-access
88*5e9e5b98SArne Welzel.endif
89*5e9e5b98SArne Welzel
90b8a678efSLionel Sambuc__uname_s!= uname -s
91b8a678efSLionel Sambuc.if ${__uname_s:Uunknown} == "Minix"
92b8a678efSLionel SambucUSETOOLS?=	never
931d71e39bSAnton Kuijsten.  if ${USETOOLS:Uno} != "yes"
940a6a1f1dSLionel Sambuc     HAVE_LLVM?= yes
951d71e39bSAnton Kuijsten
9684a7c3f4SLionel Sambuc# If DESTDIR was specified, and we are not using the tools, then make sure to
9784a7c3f4SLionel Sambuc# build out-of-tree and to refer only DESTDIR for target binaries
9884a7c3f4SLionel Sambuc# The case when using tools is already handled below.
9984a7c3f4SLionel Sambuc.    if ${DESTDIR:U} != ""
10084a7c3f4SLionel Sambuc        CPPFLAGS+= --sysroot=${DESTDIR}
10184a7c3f4SLionel Sambuc        LDFLAGS+= --sysroot=${DESTDIR}
10284a7c3f4SLionel Sambuc.    endif # ${DESTDIR:U} != ""
10384d9c625SLionel Sambuc
10484d9c625SLionel Sambuc     MKTOOLS?=no
1051d71e39bSAnton Kuijsten.  endif # ${USETOOLS:Uno} != "yes"
1061d71e39bSAnton Kuijsten
107b8a678efSLionel Sambuc.  if !defined(HOSTPROG) && !defined(HOSTLIB)
108b8a678efSLionel Sambuc# LSC FIXME: Override MACHINE as the native minix host make command will set
109b8a678efSLionel Sambuc#            it to i686.
110b8a678efSLionel Sambuc.    if ${MACHINE_ARCH} == "i386"
111b8a678efSLionel Sambuc       MACHINE:= i386
112b8a678efSLionel Sambuc.    endif
11384d9c625SLionel Sambuc# LSC FIXME: On a native ARM system MACHINE_ARCH is earmv7 instead of earm...
1142d6bbeb0SJean-Baptiste Boric.    if !empty(MACHINE_ARCH:Mearm*)
11584d9c625SLionel Sambuc       MACHINE_ARCH:= earm
11684d9c625SLionel Sambuc.    endif
117b8a678efSLionel Sambuc.  endif # !defined(HOSTPROG) && !defined(HOSTLIB)
118b8a678efSLionel Sambuc.endif # __uname_s == "Minix"
1191d71e39bSAnton Kuijsten
1202d6bbeb0SJean-Baptiste Boric# LSC FIXME: RELEASEMACHINEDIR is set to evbarm, instead of evbearm-el
1212d6bbeb0SJean-Baptiste Boric.if !empty(MACHINE:Mevbarm*)
1222d6bbeb0SJean-Baptiste BoricRELEASEMACHINEDIR:= evbearm-el
1232d6bbeb0SJean-Baptiste Boric.endif
1242d6bbeb0SJean-Baptiste Boric
1254684ddb6SLionel Sambuc.if ${HAVE_GCC:Dyes} == "yes" || \
1264684ddb6SLionel Sambuc    (${MKGCCCMDS:Uno} == "yes" && ${MKLLVM:Uyes} == "no")
1274684ddb6SLionel Sambuc# We are building with GCC, means we cannot build LIBCXX, and need LIBSTDCXX
1284684ddb6SLionel SambucMKLIBCXX?=	no # Can't compile with GCC.
12984d9c625SLionel Sambuc
1304684ddb6SLionel Sambuc.  if ${USETOOLS:Uno} == "yes" || ${MKLIBSTDCXX:Uno} == "yes"
1314684ddb6SLionel Sambuc# When cross-compiling, or building MKLIBSTDCXX, use the in-tree LIBSTDCXX
1324684ddb6SLionel SambucMKLIBSTDCXX?=	yes
13384d9c625SLionel SambucCXXFLAGS+=	-I${DESTDIR}/usr/include/g++
1344684ddb6SLionel Sambuc.  endif # ${USETOOLS:Uno} == "yes"
13584d9c625SLionel Sambuc
1364684ddb6SLionel Sambuc.  if ${MKLIBSTDCXX:Uno} == "no"
1374684ddb6SLionel Sambuc# Specify the C++ system header for the host libstdc++, as we are not building
1384684ddb6SLionel Sambuc# LIBSTDCXX
13984d9c625SLionel SambucCXXFLAGS+=	-I/usr/include/g++
1404684ddb6SLionel Sambuc.  endif # ${MKLIBSTDCXX:Uno} == "no"
14184d9c625SLionel Sambuc
1424684ddb6SLionel Sambuc.endif # ${HAVE_GCC:Dyes} == "yes" || \
1434684ddb6SLionel Sambuc       # (${MKGCCCMDS:Uno} == "yes" && ${MKLLVM:Uyes} == "no")
144f4a2713aSLionel Sambuc
14584d9c625SLionel Sambuc# MKGCCCMDS == yes implies MKGCC == yes
14684d9c625SLionel Sambuc.if ${MKGCCCMDS} == "yes"
1474684ddb6SLionel SambucMKGCC=		yes
14884d9c625SLionel SambucMKBINUTILS?=	yes # We are installing GCC, so trigger binutils.
1494684ddb6SLionel SambucMKLIBSTDCXX?=	yes # Also install the GNU C++ library
15084d9c625SLionel Sambuc.endif # ${MKGCCCMDS} == "yes"
15184d9c625SLionel Sambuc
1524684ddb6SLionel Sambuc# The default value of MKLIBSTDCXX cannot be set before the previous test.
1534684ddb6SLionel SambucMKLIBSTDCXX?=	no
1544684ddb6SLionel Sambuc
1554684ddb6SLionel Sambuc.if ${MKGCC} == "yes"
1560a6a1f1dSLionel SambucHAVE_GCC?=	5 # Not really, but that's the setting.
1570a6a1f1dSLionel SambucHAVE_LIBGCC?=	yes
1580a6a1f1dSLionel SambucHAVE_LIBGCC_EH?=	yes
1594684ddb6SLionel Sambuc.endif # ${MKGCC} == "yes"
1604684ddb6SLionel Sambuc
1614684ddb6SLionel Sambuc.if ${USETOOLS:Uno} == "yes"
1624684ddb6SLionel SambucMKLLVM?=	yes
1634684ddb6SLionel Sambuc.endif # ${USETOOLS:Uno} == "yes"
1644684ddb6SLionel Sambuc
1654684ddb6SLionel Sambuc.if ${MKLLVM:Uno} == "yes"
1660a6a1f1dSLionel SambucHAVE_LLVM?=	yes
1674684ddb6SLionel SambucMKBINUTILS?=	yes # We are installing clang, so trigger binutils.
1684684ddb6SLionel Sambuc.endif # ${MKLLVM:Uno} == "yes"
1694684ddb6SLionel Sambuc
1704684ddb6SLionel Sambuc.if ${HAVE_LLVM:Dyes} == "yes"
1714684ddb6SLionel SambucHAVE_LIBGCC?=	no
1724684ddb6SLionel Sambuc.endif # ${HAVE_LLVM:Dyes} == "yes"
1734684ddb6SLionel Sambuc
1744684ddb6SLionel Sambuc# The default value has to be set after we have figured out if we are using GCC
1754684ddb6SLionel Sambuc# or not.
1764684ddb6SLionel SambucMKLIBCXX?=	yes # Build by default libc++
1774684ddb6SLionel Sambuc
17884d9c625SLionel Sambuc# The default value of MKBINUTILS cannot be set before the previous test.
17984d9c625SLionel SambucMKBINUTILS?=	no
18084d9c625SLionel Sambuc
181b8a678efSLionel Sambuc.endif # defined(__MINIX)
182d6bc6cb4SBen Gras
183d6bc6cb4SBen GrasMAKECONF?=	/etc/mk.conf
184e1091647SArun Thomas.-include "${MAKECONF}"
185e1091647SArun Thomas
186e1091647SArun Thomas#
187e1091647SArun Thomas# CPU model, derived from MACHINE_ARCH
188e1091647SArun Thomas#
1890a6a1f1dSLionel SambucMACHINE_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/}
190e1091647SArun Thomas
191e1091647SArun Thomas#
192e1091647SArun Thomas# Subdirectory used below ${RELEASEDIR} when building a release
193e1091647SArun Thomas#
194e1091647SArun ThomasRELEASEMACHINEDIR?=	${MACHINE}
195e1091647SArun Thomas
196e1091647SArun Thomas#
197e1091647SArun Thomas# Subdirectory or path component used for the following paths:
198e1091647SArun Thomas#   distrib/${RELEASEMACHINE}
199e1091647SArun Thomas#   distrib/notes/${RELEASEMACHINE}
200e1091647SArun Thomas#   etc/etc.${RELEASEMACHINE}
201e1091647SArun Thomas# Used when building a release.
202e1091647SArun Thomas#
203e1091647SArun ThomasRELEASEMACHINE?=	${MACHINE}
204e1091647SArun Thomas
205e1091647SArun Thomas#
206e1091647SArun Thomas# NEED_OWN_INSTALL_TARGET is set to "no" by pkgsrc/mk/bsd.pkg.mk to
207e1091647SArun Thomas# ensure that things defined by <bsd.own.mk> (default targets,
208e1091647SArun Thomas# INSTALL_FILE, etc.) are not conflicting with bsd.pkg.mk.
209e1091647SArun Thomas#
210e1091647SArun ThomasNEED_OWN_INSTALL_TARGET?=	yes
211e1091647SArun Thomas
212e1091647SArun Thomas#
2139152e1c5SLionel Sambuc# This lists the platforms which do not have working in-tree toolchains.  For
2149152e1c5SLionel Sambuc# the in-tree gcc toolchain, this list is empty.
2159152e1c5SLionel Sambuc#
2169152e1c5SLionel Sambuc# If some future port is not supported by the in-tree toolchain, this should
2179152e1c5SLionel Sambuc# be set to "yes" for that port only.
218e1091647SArun Thomas#
2190a6a1f1dSLionel Sambuc.if ${MACHINE} == "playstation2"
2200a6a1f1dSLionel SambucTOOLCHAIN_MISSING?=	yes
2210a6a1f1dSLionel Sambuc.endif
2220a6a1f1dSLionel Sambuc
223e1091647SArun ThomasTOOLCHAIN_MISSING?=	no
224e1091647SArun Thomas
2250a6a1f1dSLionel Sambuc.if ${MACHINE_CPU} == "aarch64" && !defined(EXTERNAL_TOOLCHAIN) && ${MKLLVM:Uyes} != "no"
2260a6a1f1dSLionel SambucMKLLVM?=	yes
2270a6a1f1dSLionel SambucHAVE_LLVM?=	yes
2280a6a1f1dSLionel SambucMKGCC?=		no
2290a6a1f1dSLionel Sambuc.endif
2300a6a1f1dSLionel Sambuc
2319152e1c5SLionel Sambuc#
2320a6a1f1dSLionel Sambuc# GCC Using platforms.
2339152e1c5SLionel Sambuc#
2349152e1c5SLionel Sambuc.if ${MKGCC:Uyes} != "no"
2350a6a1f1dSLionel Sambuc
2360a6a1f1dSLionel Sambuc.if ${MACHINE} == "playstation2" || ${MACHINE_CPU} == "aarch64"
2370a6a1f1dSLionel SambucHAVE_GCC?=    0
2389152e1c5SLionel Sambuc.else
2390a6a1f1dSLionel Sambuc# Otherwise, default to GCC4.8
2400a6a1f1dSLionel SambucHAVE_GCC?=    48
241e1091647SArun Thomas.endif
242e1091647SArun Thomas
2430a6a1f1dSLionel Sambuc#
2440a6a1f1dSLionel Sambuc# Platforms that can't run a modern GCC natively
2450a6a1f1dSLionel Sambuc.if ${MACHINE_ARCH} == "m68000"
2460a6a1f1dSLionel SambucMKGCCCMDS?=	no
2470a6a1f1dSLionel Sambuc.endif
24884d9c625SLionel Sambuc
2490a6a1f1dSLionel Sambuc#
2500a6a1f1dSLionel Sambuc# We import the old gcc as "gcc.old" when upgrading.  EXTERNAL_GCC_SUBDIR is
2510a6a1f1dSLionel Sambuc# set to the relevant subdirectory in src/external/gpl3 for his HAVE_GCC.
2520a6a1f1dSLionel Sambuc#
2530a6a1f1dSLionel Sambuc.if ${HAVE_GCC} == 5
2540a6a1f1dSLionel SambucEXTERNAL_GCC_SUBDIR=	gcc
2550a6a1f1dSLionel Sambuc.elif ${HAVE_GCC} == 48
2560a6a1f1dSLionel SambucEXTERNAL_GCC_SUBDIR=	gcc.old
25784d9c625SLionel Sambuc.else
2580a6a1f1dSLionel SambucEXTERNAL_GCC_SUBDIR=	/does/not/exist
2590a6a1f1dSLionel Sambuc.endif
2600a6a1f1dSLionel Sambuc.else
2610a6a1f1dSLionel SambucMKGCCCMDS?=	no
262e83f7ba2SBen Gras.endif
263e83f7ba2SBen Gras
2640a6a1f1dSLionel Sambuc.if !empty(MACHINE_ARCH:Mearm*)
2650a6a1f1dSLionel Sambuc_LIBC_COMPILER_RT.${MACHINE_ARCH}=	yes
2660a6a1f1dSLionel Sambuc.endif
2670a6a1f1dSLionel Sambuc
2680a6a1f1dSLionel Sambuc_LIBC_COMPILER_RT.aarch64=	yes
2690a6a1f1dSLionel Sambuc_LIBC_COMPILER_RT.i386=		yes
2700a6a1f1dSLionel Sambuc_LIBC_COMPILER_RT.powerpc=	yes
2710a6a1f1dSLionel Sambuc_LIBC_COMPILER_RT.powerpc64=	yes
2720a6a1f1dSLionel Sambuc_LIBC_COMPILER_RT.x86_64=	yes
2730a6a1f1dSLionel Sambuc
2740a6a1f1dSLionel Sambuc.if ${HAVE_LLVM:Uno} == "yes" && ${_LIBC_COMPILER_RT.${MACHINE_ARCH}:Uno} == "yes"
27584d9c625SLionel SambucHAVE_LIBGCC?=	no
2769152e1c5SLionel Sambuc.else
27784d9c625SLionel SambucHAVE_LIBGCC?=	yes
278e1091647SArun Thomas.endif
2799152e1c5SLionel Sambuc
2800a6a1f1dSLionel Sambuc
2810a6a1f1dSLionel Sambuc# ia64 is not support
2820a6a1f1dSLionel Sambuc.if ${HAVE_LLVM:Uno} == "yes" || !empty(MACHINE_ARCH:Mearm*)
2830a6a1f1dSLionel SambucHAVE_LIBGCC_EH?=	no
2840a6a1f1dSLionel Sambuc.else
2850a6a1f1dSLionel SambucHAVE_LIBGCC_EH?=	yes
2860a6a1f1dSLionel Sambuc.endif
2870a6a1f1dSLionel Sambuc
2880a6a1f1dSLionel SambucHAVE_GDB?=	79
28984d9c625SLionel Sambuc
29011be35a1SLionel Sambuc.if (${MACHINE_ARCH} == "alpha") || \
29111be35a1SLionel Sambuc    (${MACHINE_ARCH} == "hppa") || \
29211be35a1SLionel Sambuc    (${MACHINE_ARCH} == "ia64") || \
29384d9c625SLionel Sambuc    (${MACHINE_CPU} == "mips")
29411be35a1SLionel SambucHAVE_SSP?=	no
29511be35a1SLionel Sambuc.else
29611be35a1SLionel SambucHAVE_SSP?=	yes
29711be35a1SLionel Sambuc.if ${USE_FORT:Uno} != "no"
29811be35a1SLionel SambucUSE_SSP?=	yes
29911be35a1SLionel Sambuc.endif
30011be35a1SLionel Sambuc.endif
30111be35a1SLionel Sambuc
30284d9c625SLionel Sambuc.if empty(.MAKEFLAGS:tW:M*-V .OBJDIR*)
303e1091647SArun Thomas.if defined(MAKEOBJDIRPREFIX) || defined(MAKEOBJDIR)
304e1091647SArun ThomasPRINTOBJDIR=	${MAKE} -r -V .OBJDIR -f /dev/null xxx
305e1091647SArun Thomas.else
306e1091647SArun ThomasPRINTOBJDIR=	${MAKE} -V .OBJDIR
307e1091647SArun Thomas.endif
308e1091647SArun Thomas.else
30984d9c625SLionel SambucPRINTOBJDIR=	echo /error/bsd.own.mk/PRINTOBJDIR # avoid infinite recursion
310e1091647SArun Thomas.endif
311e1091647SArun Thomas
312e1091647SArun Thomas#
313e1091647SArun Thomas# Determine if running in the NetBSD source tree by checking for the
314e1091647SArun Thomas# existence of build.sh and tools/ in the current or a parent directory,
315e1091647SArun Thomas# and setting _SRC_TOP_ to the result.
316e1091647SArun Thomas#
317e1091647SArun Thomas.if !defined(_SRC_TOP_)			# {
3189152e1c5SLionel Sambuc_SRC_TOP_!= cd "${.CURDIR}"; while :; do \
319e1091647SArun Thomas		here=`pwd`; \
320e1091647SArun Thomas		[ -f build.sh  ] && [ -d tools ] && { echo $$here; break; }; \
321e1091647SArun Thomas		case $$here in /) echo ""; break;; esac; \
322e1091647SArun Thomas		cd ..; done
323e1091647SArun Thomas
324e1091647SArun Thomas.MAKEOVERRIDES+=	_SRC_TOP_
325e1091647SArun Thomas
326e1091647SArun Thomas.endif					# }
327e1091647SArun Thomas
328e1091647SArun Thomas#
32984d9c625SLionel Sambuc# If _SRC_TOP_ != "", we're within the NetBSD source tree.
33084d9c625SLionel Sambuc# * Set defaults for NETBSDSRCDIR and _SRC_TOP_OBJ_.
33184d9c625SLionel Sambuc# * Define _NETBSD_VERSION_DEPENDS.  Targets that depend on the
33284d9c625SLionel Sambuc#   NetBSD version, or on variables defined at build time, can
33384d9c625SLionel Sambuc#   declare a dependency on ${_NETBSD_VERSION_DEPENDS}.
334e1091647SArun Thomas#
335e1091647SArun Thomas.if (${_SRC_TOP_} != "")		# {
336e1091647SArun Thomas
337e1091647SArun ThomasNETBSDSRCDIR?=	${_SRC_TOP_}
338e1091647SArun Thomas
339e1091647SArun Thomas.if !defined(_SRC_TOP_OBJ_)
3409152e1c5SLionel Sambuc_SRC_TOP_OBJ_!=		cd "${_SRC_TOP_}" && ${PRINTOBJDIR}
341e1091647SArun Thomas.MAKEOVERRIDES+=	_SRC_TOP_OBJ_
342e1091647SArun Thomas.endif
343e1091647SArun Thomas
34484d9c625SLionel Sambuc_NETBSD_VERSION_DEPENDS=	${_SRC_TOP_OBJ_}/params
34584d9c625SLionel Sambuc_NETBSD_VERSION_DEPENDS+=	${NETBSDSRCDIR}/sys/sys/param.h
34684d9c625SLionel Sambuc_NETBSD_VERSION_DEPENDS+=	${NETBSDSRCDIR}/sys/conf/newvers.sh
34784d9c625SLionel Sambuc_NETBSD_VERSION_DEPENDS+=	${NETBSDSRCDIR}/sys/conf/osrelease.sh
34884d9c625SLionel Sambuc${_SRC_TOP_OBJ_}/params: .NOTMAIN .OPTIONAL # created by top level "make build"
34984d9c625SLionel Sambuc
350e1091647SArun Thomas.endif	# _SRC_TOP_ != ""		# }
351e1091647SArun Thomas
352e1091647SArun Thomas
353e1091647SArun Thomas.if (${_SRC_TOP_} != "") && \
354e1091647SArun Thomas    (${TOOLCHAIN_MISSING} == "no" || defined(EXTERNAL_TOOLCHAIN))
355e1091647SArun ThomasUSETOOLS?=	yes
356e1091647SArun Thomas.endif
357e1091647SArun ThomasUSETOOLS?=	no
358e1091647SArun Thomas
359e1091647SArun Thomas
360e1091647SArun Thomas.if ${MACHINE_ARCH} == "mips" || ${MACHINE_ARCH} == "mips64" || \
361e1091647SArun Thomas    ${MACHINE_ARCH} == "sh3"
362e1091647SArun Thomas.BEGIN:
363e1091647SArun Thomas	@echo "Must set MACHINE_ARCH to one of ${MACHINE_ARCH}eb or ${MACHINE_ARCH}el"
364e1091647SArun Thomas	@false
365e1091647SArun Thomas.elif defined(REQUIRETOOLS) && \
366e1091647SArun Thomas      (${TOOLCHAIN_MISSING} == "no" || defined(EXTERNAL_TOOLCHAIN)) && \
367e1091647SArun Thomas      ${USETOOLS} == "no"
368e1091647SArun Thomas.BEGIN:
369e1091647SArun Thomas	@echo "USETOOLS=no, but this component requires a version-specific host toolchain"
370e1091647SArun Thomas	@false
371e1091647SArun Thomas.endif
372e1091647SArun Thomas
373e1091647SArun Thomas#
374e1091647SArun Thomas# Host platform information; may be overridden
375e1091647SArun Thomas#
3760a6a1f1dSLionel Sambuc.include <bsd.host.mk>
377e1091647SArun Thomas
378e1091647SArun Thomas.if ${USETOOLS} == "yes"						# {
379e1091647SArun Thomas
380e1091647SArun Thomas#
381e1091647SArun Thomas# Provide a default for TOOLDIR.
382e1091647SArun Thomas#
383e1091647SArun Thomas.if !defined(TOOLDIR)
384e1091647SArun ThomasTOOLDIR:=	${_SRC_TOP_OBJ_}/tooldir.${HOST_OSTYPE}
385e1091647SArun Thomas.MAKEOVERRIDES+= TOOLDIR
386e1091647SArun Thomas.endif
387e1091647SArun Thomas
388e1091647SArun Thomas#
389e1091647SArun Thomas# This is the prefix used for the NetBSD-sourced tools.
390e1091647SArun Thomas#
391e1091647SArun Thomas_TOOL_PREFIX?=	nb
392e1091647SArun Thomas
393e1091647SArun Thomas#
394e1091647SArun Thomas# If an external toolchain base is specified, use it.
395e1091647SArun Thomas#
396e1091647SArun Thomas.if defined(EXTERNAL_TOOLCHAIN)						# {
397e1091647SArun ThomasAR=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-ar
398e1091647SArun ThomasAS=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-as
399e1091647SArun ThomasLD=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-ld
400e1091647SArun ThomasNM=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-nm
401e1091647SArun ThomasOBJCOPY=	${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-objcopy
402e1091647SArun ThomasOBJDUMP=	${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-objdump
403e1091647SArun ThomasRANLIB=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-ranlib
4040a6a1f1dSLionel SambucREADELF=	${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-readelf
405e1091647SArun ThomasSIZE=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-size
4060a6a1f1dSLionel SambucSTRINGS=	${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-strings
407e1091647SArun ThomasSTRIP=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-strip
408e1091647SArun Thomas
4099152e1c5SLionel SambucTOOL_CC.gcc=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-gcc
4109152e1c5SLionel SambucTOOL_CPP.gcc=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-cpp
4119152e1c5SLionel SambucTOOL_CXX.gcc=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-c++
4129152e1c5SLionel SambucTOOL_FC.gcc=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-g77
4139152e1c5SLionel SambucTOOL_OBJC.gcc=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-gcc
41484d9c625SLionel Sambuc
41584d9c625SLionel SambucTOOL_CC.clang=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-clang
41684d9c625SLionel SambucTOOL_CPP.clang=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-clang-cpp
41784d9c625SLionel SambucTOOL_CXX.clang=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-clang++
41884d9c625SLionel SambucTOOL_OBJC.clang=	${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-clang
4194684ddb6SLionel SambucTOOL_OPT.clang=		${EXTERNAL_TOOLCHAIN}/bin/opt
4204684ddb6SLionel SambucTOOL_LLC.clang=		${EXTERNAL_TOOLCHAIN}/bin/llc
421e1091647SArun Thomas.else									# } {
422e1091647SArun Thomas# Define default locations for common tools.
423e1091647SArun Thomas.if ${USETOOLS_BINUTILS:Uyes} == "yes"					#  {
424e1091647SArun ThomasAR=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-ar
425e1091647SArun ThomasAS=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-as
426e1091647SArun ThomasLD=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-ld
427e1091647SArun ThomasNM=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-nm
428e1091647SArun ThomasOBJCOPY=	${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-objcopy
429e1091647SArun ThomasOBJDUMP=	${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-objdump
430e1091647SArun ThomasRANLIB=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-ranlib
4310a6a1f1dSLionel SambucREADELF=	${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-readelf
432e1091647SArun ThomasSIZE=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-size
4330a6a1f1dSLionel SambucSTRINGS=	${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-strings
434e1091647SArun ThomasSTRIP=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-strip
4359152e1c5SLionel Sambuc
4369152e1c5SLionel Sambuc# GCC supports C, C++, Fortran and Objective C
4379152e1c5SLionel SambucTOOL_CC.gcc=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-gcc
4389152e1c5SLionel SambucTOOL_CPP.gcc=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-cpp
4399152e1c5SLionel SambucTOOL_CXX.gcc=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-c++
4409152e1c5SLionel SambucTOOL_FC.gcc=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-g77
4419152e1c5SLionel SambucTOOL_OBJC.gcc=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-gcc
442e1091647SArun Thomas.endif									#  }
443e1091647SArun Thomas
4449152e1c5SLionel Sambuc# Clang supports C, C++ and Objective C
4459152e1c5SLionel SambucTOOL_CC.clang=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-clang
4469152e1c5SLionel SambucTOOL_CPP.clang=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-clang-cpp
4479152e1c5SLionel SambucTOOL_CXX.clang=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-clang++
4489152e1c5SLionel SambucTOOL_OBJC.clang=	${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-clang
4494684ddb6SLionel SambucTOOL_OPT.clang=		${TOOLDIR}/bin/opt
4504684ddb6SLionel SambucTOOL_LLC.clang=		${TOOLDIR}/bin/llc
451e1091647SArun Thomas
4529152e1c5SLionel Sambuc# PCC supports C and Fortran
4539152e1c5SLionel SambucTOOL_CC.pcc=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-pcc
4549152e1c5SLionel SambucTOOL_CPP.pcc=		${TOOLDIR}/libexec/${MACHINE_GNU_PLATFORM}-cpp
4550a6a1f1dSLionel SambucTOOL_CXX.pcc=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-p++
4569152e1c5SLionel Sambuc
4579152e1c5SLionel Sambuc#
4589152e1c5SLionel Sambuc# Make sure DESTDIR is set, so that builds with these tools always
4599152e1c5SLionel Sambuc# get appropriate -nostdinc, -nostdlib, etc. handling.  The default is
4609152e1c5SLionel Sambuc# <empty string>, meaning start from /, the root directory.
4619152e1c5SLionel Sambuc#
4629152e1c5SLionel SambucDESTDIR?=
4639152e1c5SLionel Sambuc
4649152e1c5SLionel Sambuc.if !defined(HOSTPROG) && !defined(HOSTLIB)
4659152e1c5SLionel Sambuc.  if ${DESTDIR} != ""
4669152e1c5SLionel SambucCPPFLAGS+=	--sysroot=${DESTDIR}
4679152e1c5SLionel SambucLDFLAGS+=	--sysroot=${DESTDIR}
4689152e1c5SLionel Sambuc.  else
4699152e1c5SLionel SambucCPPFLAGS+=	--sysroot=/
4709152e1c5SLionel SambucLDFLAGS+=	--sysroot=/
471e1091647SArun Thomas.  endif
4729152e1c5SLionel Sambuc.endif
473e1091647SArun Thomas.endif	# EXTERNAL_TOOLCHAIN						# }
474e1091647SArun Thomas
475e1091647SArun ThomasDBSYM=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-dbsym
4769152e1c5SLionel SambucELF2AOUT=	${TOOLDIR}/bin/${_TOOL_PREFIX}m68k-elf2aout
477e1091647SArun ThomasELF2ECOFF=	${TOOLDIR}/bin/${_TOOL_PREFIX}mips-elf2ecoff
478e1091647SArun ThomasINSTALL=	${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-install
479e1091647SArun ThomasLEX=		${TOOLDIR}/bin/${_TOOL_PREFIX}lex
480e1091647SArun ThomasLINT=		CC=${CC:Q} ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-lint
481e1091647SArun ThomasLORDER=		NM=${NM:Q} MKTEMP=${TOOL_MKTEMP:Q} ${TOOLDIR}/bin/${_TOOL_PREFIX}lorder
482e1091647SArun ThomasMKDEP=		CC=${CC:Q} ${TOOLDIR}/bin/${_TOOL_PREFIX}mkdep
48384d9c625SLionel SambucMKDEPCXX=	CC=${CXX:Q} ${TOOLDIR}/bin/${_TOOL_PREFIX}mkdep
484e1091647SArun ThomasPAXCTL=		${TOOLDIR}/bin/${_TOOL_PREFIX}paxctl
485e1091647SArun ThomasTSORT=		${TOOLDIR}/bin/${_TOOL_PREFIX}tsort -q
486e1091647SArun ThomasYACC=		${TOOLDIR}/bin/${_TOOL_PREFIX}yacc
487e1091647SArun Thomas
488e1091647SArun ThomasTOOL_AMIGAAOUT2BB=	${TOOLDIR}/bin/${_TOOL_PREFIX}amiga-aout2bb
489e1091647SArun ThomasTOOL_AMIGAELF2BB=	${TOOLDIR}/bin/${_TOOL_PREFIX}amiga-elf2bb
490e1091647SArun ThomasTOOL_AMIGATXLT=		${TOOLDIR}/bin/${_TOOL_PREFIX}amiga-txlt
491e1091647SArun ThomasTOOL_ASN1_COMPILE=	${TOOLDIR}/bin/${_TOOL_PREFIX}asn1_compile
492e1091647SArun ThomasTOOL_AWK=		${TOOLDIR}/bin/${_TOOL_PREFIX}awk
493e1091647SArun ThomasTOOL_CAP_MKDB=		${TOOLDIR}/bin/${_TOOL_PREFIX}cap_mkdb
494e1091647SArun ThomasTOOL_CAT=		${TOOLDIR}/bin/${_TOOL_PREFIX}cat
495e1091647SArun ThomasTOOL_CKSUM=		${TOOLDIR}/bin/${_TOOL_PREFIX}cksum
4969152e1c5SLionel SambucTOOL_CLANG_TBLGEN=		${TOOLDIR}/bin/${_TOOL_PREFIX}clang-tblgen
497e1091647SArun ThomasTOOL_COMPILE_ET=	${TOOLDIR}/bin/${_TOOL_PREFIX}compile_et
498e1091647SArun ThomasTOOL_CONFIG=		${TOOLDIR}/bin/${_TOOL_PREFIX}config
499e1091647SArun ThomasTOOL_CRUNCHGEN=		MAKE=${.MAKE:Q} ${TOOLDIR}/bin/${_TOOL_PREFIX}crunchgen
500e1091647SArun ThomasTOOL_CTAGS=		${TOOLDIR}/bin/${_TOOL_PREFIX}ctags
5019152e1c5SLionel SambucTOOL_CTFCONVERT=	${TOOLDIR}/bin/${_TOOL_PREFIX}ctfconvert
5029152e1c5SLionel SambucTOOL_CTFMERGE=		${TOOLDIR}/bin/${_TOOL_PREFIX}ctfmerge
503e1091647SArun ThomasTOOL_DB=		${TOOLDIR}/bin/${_TOOL_PREFIX}db
50484d9c625SLionel SambucTOOL_DISKLABEL=		${TOOLDIR}/bin/nbdisklabel
505e1091647SArun ThomasTOOL_EQN=		${TOOLDIR}/bin/${_TOOL_PREFIX}eqn
506e1091647SArun ThomasTOOL_FDISK=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-fdisk
507e1091647SArun ThomasTOOL_FGEN=		${TOOLDIR}/bin/${_TOOL_PREFIX}fgen
508e1091647SArun ThomasTOOL_GENASSYM=		${TOOLDIR}/bin/${_TOOL_PREFIX}genassym
509e1091647SArun ThomasTOOL_GENCAT=		${TOOLDIR}/bin/${_TOOL_PREFIX}gencat
510e1091647SArun ThomasTOOL_GMAKE=		${TOOLDIR}/bin/${_TOOL_PREFIX}gmake
511e1091647SArun ThomasTOOL_GREP=		${TOOLDIR}/bin/${_TOOL_PREFIX}grep
512e1091647SArun ThomasTOOL_GROFF=		PATH=${TOOLDIR}/lib/groff:$${PATH} ${TOOLDIR}/bin/${_TOOL_PREFIX}groff
513e1091647SArun ThomasTOOL_HEXDUMP=		${TOOLDIR}/bin/${_TOOL_PREFIX}hexdump
514e1091647SArun ThomasTOOL_HP300MKBOOT=	${TOOLDIR}/bin/${_TOOL_PREFIX}hp300-mkboot
5150a6a1f1dSLionel SambucTOOL_HPPAMKBOOT=	${TOOLDIR}/bin/${_TOOL_PREFIX}hppa-mkboot
516e1091647SArun ThomasTOOL_INDXBIB=		${TOOLDIR}/bin/${_TOOL_PREFIX}indxbib
517e1091647SArun ThomasTOOL_INSTALLBOOT=	${TOOLDIR}/bin/${_TOOL_PREFIX}installboot
518e1091647SArun ThomasTOOL_INSTALL_INFO=	${TOOLDIR}/bin/${_TOOL_PREFIX}install-info
519e1091647SArun ThomasTOOL_JOIN=		${TOOLDIR}/bin/${_TOOL_PREFIX}join
5209152e1c5SLionel SambucTOOL_LLVM_TBLGEN=		${TOOLDIR}/bin/${_TOOL_PREFIX}llvm-tblgen
521e1091647SArun ThomasTOOL_M4=		${TOOLDIR}/bin/${_TOOL_PREFIX}m4
522e1091647SArun ThomasTOOL_MACPPCFIXCOFF=	${TOOLDIR}/bin/${_TOOL_PREFIX}macppc-fixcoff
523e1091647SArun ThomasTOOL_MAKEFS=		${TOOLDIR}/bin/${_TOOL_PREFIX}makefs
524e1091647SArun ThomasTOOL_MAKEINFO=		${TOOLDIR}/bin/${_TOOL_PREFIX}makeinfo
5250a6a1f1dSLionel SambucTOOL_MAKEKEYS=		${TOOLDIR}/bin/${_TOOL_PREFIX}makekeys
5260a6a1f1dSLionel SambucTOOL_MAKESTRS=		${TOOLDIR}/bin/${_TOOL_PREFIX}makestrs
527e1091647SArun ThomasTOOL_MAKEWHATIS=	${TOOLDIR}/bin/${_TOOL_PREFIX}makewhatis
528e1091647SArun ThomasTOOL_MANDOC_ASCII=	${TOOLDIR}/bin/${_TOOL_PREFIX}mandoc -Tascii
529e1091647SArun ThomasTOOL_MANDOC_HTML=	${TOOLDIR}/bin/${_TOOL_PREFIX}mandoc -Thtml
530e1091647SArun ThomasTOOL_MANDOC_LINT=	${TOOLDIR}/bin/${_TOOL_PREFIX}mandoc -Tlint
531e1091647SArun ThomasTOOL_MDSETIMAGE=	${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-mdsetimage
532e1091647SArun ThomasTOOL_MENUC=		MENUDEF=${TOOLDIR}/share/misc ${TOOLDIR}/bin/${_TOOL_PREFIX}menuc
5339152e1c5SLionel SambucTOOL_M68KELF2AOUT=	${TOOLDIR}/bin/${_TOOL_PREFIX}m68k-elf2aout
534e1091647SArun ThomasTOOL_MIPSELF2ECOFF=	${TOOLDIR}/bin/${_TOOL_PREFIX}mips-elf2ecoff
535e1091647SArun ThomasTOOL_MKCSMAPPER=	${TOOLDIR}/bin/${_TOOL_PREFIX}mkcsmapper
536e1091647SArun ThomasTOOL_MKESDB=		${TOOLDIR}/bin/${_TOOL_PREFIX}mkesdb
537791aa4e1SThomas VeermanTOOL_MKFSMFS=		${TOOLDIR}/bin/${_TOOL_PREFIX}mkfs.mfs
538e1091647SArun ThomasTOOL_MKLOCALE=		${TOOLDIR}/bin/${_TOOL_PREFIX}mklocale
539e1091647SArun ThomasTOOL_MKMAGIC=		${TOOLDIR}/bin/${_TOOL_PREFIX}file
54084d9c625SLionel SambucTOOL_MKNOD=		${TOOLDIR}/bin/${_TOOL_PREFIX}mknod
541e1091647SArun ThomasTOOL_MKTEMP=		${TOOLDIR}/bin/${_TOOL_PREFIX}mktemp
5429152e1c5SLionel SambucTOOL_MKUBOOTIMAGE=	${TOOLDIR}/bin/${_TOOL_PREFIX}mkubootimage
54384d9c625SLionel SambucTOOL_ELFTOSB=		${TOOLDIR}/bin/${_TOOL_PREFIX}elftosb
544e1091647SArun ThomasTOOL_MSGC=		MSGDEF=${TOOLDIR}/share/misc ${TOOLDIR}/bin/${_TOOL_PREFIX}msgc
545e1091647SArun ThomasTOOL_MTREE=		${TOOLDIR}/bin/${_TOOL_PREFIX}mtree
5469152e1c5SLionel SambucTOOL_NBPERF=		${TOOLDIR}/bin/${_TOOL_PREFIX}perf
5470a6a1f1dSLionel SambucTOOL_NCDCS=		${TOOLDIR}/bin/${_TOOL_PREFIX}ibmnws-ncdcs
548e1091647SArun ThomasTOOL_PAX=		${TOOLDIR}/bin/${_TOOL_PREFIX}pax
549e1091647SArun ThomasTOOL_PIC=		${TOOLDIR}/bin/${_TOOL_PREFIX}pic
5509152e1c5SLionel SambucTOOL_PIGZ=		${TOOLDIR}/bin/${_TOOL_PREFIX}pigz
551e1091647SArun ThomasTOOL_PKG_CREATE=	${TOOLDIR}/bin/${_TOOL_PREFIX}pkg_create
552e1091647SArun ThomasTOOL_POWERPCMKBOOTIMAGE=${TOOLDIR}/bin/${_TOOL_PREFIX}powerpc-mkbootimage
553e1091647SArun ThomasTOOL_PWD_MKDB=		${TOOLDIR}/bin/${_TOOL_PREFIX}pwd_mkdb
554e1091647SArun ThomasTOOL_REFER=		${TOOLDIR}/bin/${_TOOL_PREFIX}refer
555e1091647SArun ThomasTOOL_ROFF_ASCII=	PATH=${TOOLDIR}/lib/groff:$${PATH} ${TOOLDIR}/bin/${_TOOL_PREFIX}nroff
5560a6a1f1dSLionel SambucTOOL_ROFF_DOCASCII=	${TOOL_GROFF} -Tascii
5570a6a1f1dSLionel SambucTOOL_ROFF_DOCHTML=	${TOOL_GROFF} -Thtml
558e1091647SArun ThomasTOOL_ROFF_DVI=		${TOOL_GROFF} -Tdvi
559e1091647SArun ThomasTOOL_ROFF_HTML=		${TOOL_GROFF} -Tlatin1 -mdoc2html
560e1091647SArun ThomasTOOL_ROFF_PS=		${TOOL_GROFF} -Tps
561e1091647SArun ThomasTOOL_ROFF_RAW=		${TOOL_GROFF} -Z
562e1091647SArun ThomasTOOL_RPCGEN=		RPCGEN_CPP=${CPP:Q} ${TOOLDIR}/bin/${_TOOL_PREFIX}rpcgen
563e1091647SArun ThomasTOOL_SED=		${TOOLDIR}/bin/${_TOOL_PREFIX}sed
5649152e1c5SLionel SambucTOOL_SLC=		${TOOLDIR}/bin/${_TOOL_PREFIX}slc
565e1091647SArun ThomasTOOL_SOELIM=		${TOOLDIR}/bin/${_TOOL_PREFIX}soelim
566e1091647SArun ThomasTOOL_SPARKCRC=		${TOOLDIR}/bin/${_TOOL_PREFIX}sparkcrc
567e1091647SArun ThomasTOOL_STAT=		${TOOLDIR}/bin/${_TOOL_PREFIX}stat
568e1091647SArun ThomasTOOL_STRFILE=		${TOOLDIR}/bin/${_TOOL_PREFIX}strfile
569e1091647SArun ThomasTOOL_SUNLABEL=		${TOOLDIR}/bin/${_TOOL_PREFIX}sunlabel
570e1091647SArun ThomasTOOL_TBL=		${TOOLDIR}/bin/${_TOOL_PREFIX}tbl
5714b94e527SThomas VeermanTOOL_TIC=		${TOOLDIR}/bin/${_TOOL_PREFIX}tic
572bbb8908cSLionel SambucTOOL_TOPROTO=		${TOOLDIR}/bin/${_TOOL_PREFIX}toproto
573e1091647SArun ThomasTOOL_UUDECODE=		${TOOLDIR}/bin/${_TOOL_PREFIX}uudecode
574e1091647SArun ThomasTOOL_VGRIND=		${TOOLDIR}/bin/${_TOOL_PREFIX}vgrind -f
5750a6a1f1dSLionel SambucTOOL_VFONTEDPR=		${TOOLDIR}/libexec/${_TOOL_PREFIX}vfontedpr
576e1091647SArun ThomasTOOL_ZIC=		${TOOLDIR}/bin/${_TOOL_PREFIX}zic
577e1091647SArun Thomas
578e1091647SArun Thomas.else	# USETOOLS != yes						# } {
579e1091647SArun Thomas
5809152e1c5SLionel Sambuc# Clang supports C, C++ and Objective C
5819152e1c5SLionel SambucTOOL_CC.clang=		clang
5827f59afadSBen Gras.if defined(__MINIX)
5837f59afadSBen GrasTOOL_CPP.clang=		clang -E
5847f59afadSBen Gras.else
5859152e1c5SLionel SambucTOOL_CPP.clang=		clang-cpp
5867f59afadSBen Gras.endif # defined(__MINIX)
5879152e1c5SLionel SambucTOOL_CXX.clang=		clang++
5889152e1c5SLionel SambucTOOL_OBJC.clang=	clang
5894684ddb6SLionel SambucTOOL_OPT.clang=		opt
5904684ddb6SLionel SambucTOOL_LLC.clang=		llc
5919152e1c5SLionel Sambuc
5929152e1c5SLionel Sambuc# GCC supports C, C++, Fortran and Objective C
5939152e1c5SLionel SambucTOOL_CC.gcc=	gcc
5949152e1c5SLionel SambucTOOL_CPP.gcc=	cpp
5959152e1c5SLionel SambucTOOL_CXX.gcc=	c++
5969152e1c5SLionel SambucTOOL_FC.gcc=	g77
5979152e1c5SLionel SambucTOOL_OBJC.gcc=	gcc
5989152e1c5SLionel Sambuc
5999152e1c5SLionel Sambuc# PCC supports C and Fortran
6009152e1c5SLionel SambucTOOL_CC.pcc=		pcc
6019152e1c5SLionel SambucTOOL_CPP.pcc=		/usr/libexec/pcpp
6020a6a1f1dSLionel SambucTOOL_CXX.pcc=		p++
6039152e1c5SLionel Sambuc
604e1091647SArun ThomasTOOL_AMIGAAOUT2BB=	amiga-aout2bb
605e1091647SArun ThomasTOOL_AMIGAELF2BB=	amiga-elf2bb
606e1091647SArun ThomasTOOL_AMIGATXLT=		amiga-txlt
607e1091647SArun ThomasTOOL_ASN1_COMPILE=	asn1_compile
608e1091647SArun ThomasTOOL_AWK=		awk
609e1091647SArun ThomasTOOL_CAP_MKDB=		cap_mkdb
610e1091647SArun ThomasTOOL_CAT=		cat
611e1091647SArun ThomasTOOL_CKSUM=		cksum
6124684ddb6SLionel Sambuc.if defined(__MINIX)
6130a6a1f1dSLionel Sambuc# LSC: A full path has to be provided, as this is also used as a make
6144684ddb6SLionel Sambuc#      target.
61599e9e037SBen Gras.  if  exists(/usr/pkg/bin/clang-tblgen)
61699e9e037SBen GrasTOOL_CLANG_TBLGEN=	/usr/pkg/bin/clang-tblgen
61799e9e037SBen Gras.  else
6184684ddb6SLionel SambucTOOL_CLANG_TBLGEN=	/usr/bin/clang-tblgen
61999e9e037SBen Gras.  endif # exists(/usr/pkg/bin/clang-tblgen)
6204684ddb6SLionel Sambuc.else
6219152e1c5SLionel SambucTOOL_CLANG_TBLGEN=	clang-tblgen
6224684ddb6SLionel Sambuc.endif # defined(__MINIX)
623e1091647SArun ThomasTOOL_COMPILE_ET=	compile_et
624e1091647SArun ThomasTOOL_CONFIG=		config
625e1091647SArun ThomasTOOL_CRUNCHGEN=		crunchgen
626e1091647SArun ThomasTOOL_CTAGS=		ctags
6279152e1c5SLionel SambucTOOL_CTFCONVERT=	ctfconvert
6289152e1c5SLionel SambucTOOL_CTFMERGE=		ctfmerge
629e1091647SArun ThomasTOOL_DB=		db
630e1091647SArun ThomasTOOL_DISKLABEL=		disklabel
631e1091647SArun ThomasTOOL_EQN=		eqn
632e1091647SArun ThomasTOOL_FDISK=		fdisk
633e1091647SArun ThomasTOOL_FGEN=		fgen
634e1091647SArun ThomasTOOL_GENASSYM=		genassym
635e1091647SArun ThomasTOOL_GENCAT=		gencat
636e1091647SArun ThomasTOOL_GMAKE=		gmake
637e1091647SArun ThomasTOOL_GREP=		grep
638e1091647SArun ThomasTOOL_GROFF=		groff
639e1091647SArun ThomasTOOL_HEXDUMP=		hexdump
640e1091647SArun ThomasTOOL_HP300MKBOOT=	hp300-mkboot
6410a6a1f1dSLionel SambucTOOL_HPPAMKBOOT=	hppa-mkboot
642e1091647SArun ThomasTOOL_INDXBIB=		indxbib
643e1091647SArun ThomasTOOL_INSTALLBOOT=	installboot
644e1091647SArun ThomasTOOL_INSTALL_INFO=	install-info
645e1091647SArun ThomasTOOL_JOIN=		join
6464684ddb6SLionel Sambuc.if defined(__MINIX)
6470a6a1f1dSLionel Sambuc# LSC: A full path has to be provided, as this is also used as a make
6484684ddb6SLionel Sambuc#      target.
64999e9e037SBen Gras.  if  exists(/usr/pkg/bin/llvm-tblgen)
65099e9e037SBen GrasTOOL_LLVM_TBLGEN=	/usr/pkg/bin/llvm-tblgen
65199e9e037SBen Gras.  else
6524684ddb6SLionel SambucTOOL_LLVM_TBLGEN=	/usr/bin/llvm-tblgen
65399e9e037SBen Gras.  endif # exists(/usr/pkg/bin/llvm-tblgen)
6544684ddb6SLionel Sambuc.else
6559152e1c5SLionel SambucTOOL_LLVM_TBLGEN=	llvm-tblgen
6564684ddb6SLionel Sambuc.endif # defined(__MINIX)
657e1091647SArun ThomasTOOL_M4=		m4
658e1091647SArun ThomasTOOL_MACPPCFIXCOFF=	macppc-fixcoff
659e1091647SArun ThomasTOOL_MAKEFS=		makefs
660e1091647SArun ThomasTOOL_MAKEINFO=		makeinfo
6610a6a1f1dSLionel Sambuc.if defined(__MINIX)
6620a6a1f1dSLionel Sambuc# LSC: A full path has to be provided, as this is also used as a make
6630a6a1f1dSLionel Sambuc#      target.
6640a6a1f1dSLionel SambucTOOL_MAKEKEYS=		/usr/X11R7/bin/makekeys
6650a6a1f1dSLionel Sambuc.else
6660a6a1f1dSLionel SambucTOOL_MAKEKEYS=		makekeys
6670a6a1f1dSLionel Sambuc.endif # defined(__MINIX)
6680a6a1f1dSLionel Sambuc.if defined(__MINIX)
6690a6a1f1dSLionel Sambuc# LSC: A full path has to be provided, as this is also used as a make
6700a6a1f1dSLionel Sambuc#      target.
6710a6a1f1dSLionel SambucTOOL_MAKESTRS=		/usr/X11R7/bin/makestrs
6720a6a1f1dSLionel Sambuc.else
6730a6a1f1dSLionel SambucTOOL_MAKESTRS=		makestrs
6740a6a1f1dSLionel Sambuc.endif # defined(__MINIX)
6750c3983b2SBen GrasTOOL_MAKEWHATIS=	/usr/libexec/makewhatis
6769152e1c5SLionel SambucTOOL_MANDOC_ASCII=	mandoc -Tascii
67784d9c625SLionel SambucTOOL_MANDOC_HTML=	mandoc -Thtml
6789152e1c5SLionel SambucTOOL_MANDOC_LINT=	mandoc -Tlint
679e1091647SArun ThomasTOOL_MDSETIMAGE=	mdsetimage
680e1091647SArun ThomasTOOL_MENUC=		menuc
6819152e1c5SLionel SambucTOOL_M68KELF2AOUT=	m68k-elf2aout
682e1091647SArun ThomasTOOL_MIPSELF2ECOFF=	mips-elf2ecoff
683e1091647SArun ThomasTOOL_MKCSMAPPER=	mkcsmapper
684e1091647SArun ThomasTOOL_MKESDB=		mkesdb
685791aa4e1SThomas VeermanTOOL_MKFSMFS=		mkfs.mfs
686e1091647SArun ThomasTOOL_MKLOCALE=		mklocale
687e1091647SArun ThomasTOOL_MKMAGIC=		file
68884d9c625SLionel SambucTOOL_MKNOD=		mknod
689e1091647SArun ThomasTOOL_MKTEMP=		mktemp
6909152e1c5SLionel SambucTOOL_MKUBOOTIMAGE=	mkubootimage
69184d9c625SLionel SambucTOOL_ELFTOSB=		elftosb
692e1091647SArun ThomasTOOL_MSGC=		msgc
693e1091647SArun ThomasTOOL_MTREE=		mtree
6949152e1c5SLionel SambucTOOL_NBPERF=		nbperf
6950a6a1f1dSLionel SambucTOOL_NCDCS=		ncdcs
696e1091647SArun ThomasTOOL_PAX=		pax
697e1091647SArun ThomasTOOL_PIC=		pic
6989152e1c5SLionel SambucTOOL_PIGZ=		pigz
699e1091647SArun ThomasTOOL_PKG_CREATE=	pkg_create
700e1091647SArun ThomasTOOL_POWERPCMKBOOTIMAGE=	powerpc-mkbootimage
701e1091647SArun ThomasTOOL_PWD_MKDB=		pwd_mkdb
702e1091647SArun ThomasTOOL_REFER=		refer
703e1091647SArun ThomasTOOL_ROFF_ASCII=	nroff
7040a6a1f1dSLionel SambucTOOL_ROFF_DOCASCII=	${TOOL_GROFF} -Tascii
7050a6a1f1dSLionel SambucTOOL_ROFF_DOCHTML=	${TOOL_GROFF} -Thtml
706e1091647SArun ThomasTOOL_ROFF_DVI=		${TOOL_GROFF} -Tdvi
707e1091647SArun ThomasTOOL_ROFF_HTML=		${TOOL_GROFF} -Tlatin1 -mdoc2html
708e1091647SArun ThomasTOOL_ROFF_PS=		${TOOL_GROFF} -Tps
709e1091647SArun ThomasTOOL_ROFF_RAW=		${TOOL_GROFF} -Z
710e1091647SArun ThomasTOOL_RPCGEN=		rpcgen
711e1091647SArun ThomasTOOL_SED=		sed
712e1091647SArun ThomasTOOL_SOELIM=		soelim
713e1091647SArun ThomasTOOL_SPARKCRC=		sparkcrc
714e1091647SArun ThomasTOOL_STAT=		stat
715db1ca87bSLionel Sambuc.if defined(__MINIX)
716db1ca87bSLionel SambucTOOL_STRFILE=		/usr/games/strfile
717db1ca87bSLionel Sambuc.else
718e1091647SArun ThomasTOOL_STRFILE=		strfile
719db1ca87bSLionel Sambuc.endif # defined(__MINIX)
720e1091647SArun ThomasTOOL_SUNLABEL=		sunlabel
721e1091647SArun ThomasTOOL_TBL=		tbl
72285140f57SLionel Sambuc.if defined(__MINIX)
72385140f57SLionel Sambuc# LSC: There is a tic packaged, which has a completly different set of
72485140f57SLionel Sambuc#      options, so make sure to use the base system one, always.
72585140f57SLionel SambucTOOL_TIC=		/usr/bin/tic
72685140f57SLionel Sambuc.else
7274b94e527SThomas VeermanTOOL_TIC=		tic
72885140f57SLionel Sambuc.endif # defined(__MINIX)
729bbb8908cSLionel SambucTOOL_TOPROTO=		toproto
730e1091647SArun ThomasTOOL_UUDECODE=		uudecode
731e1091647SArun ThomasTOOL_VGRIND=		vgrind -f
7320a6a1f1dSLionel SambucTOOL_VFONTEDPR=		/usr/libexec/vfontedpr
733e1091647SArun ThomasTOOL_ZIC=		zic
734e1091647SArun Thomas
735e1091647SArun Thomas.endif	# USETOOLS != yes						# }
736e1091647SArun Thomas
7379152e1c5SLionel Sambuc# Fallback to ensure that all variables are defined to something
7389152e1c5SLionel SambucTOOL_CC.false=		false
7399152e1c5SLionel SambucTOOL_CPP.false=		false
7409152e1c5SLionel SambucTOOL_CXX.false=		false
7419152e1c5SLionel SambucTOOL_FC.false=		false
7429152e1c5SLionel SambucTOOL_OBJC.false=	false
7434684ddb6SLionel SambucTOOL_OPT.false=		false
7444684ddb6SLionel SambucTOOL_LLC.false=		false
7459152e1c5SLionel Sambuc
7460a6a1f1dSLionel SambucAVAILABLE_COMPILER?=	${HAVE_PCC:Dpcc} ${HAVE_LLVM:Dclang} ${HAVE_GCC:Dgcc} ${EXTERNAL_TOOLCHAIN:Dgcc} false
7479152e1c5SLionel Sambuc
7484684ddb6SLionel Sambuc.for _t in CC CPP CXX FC OBJC OPT LLC
7499152e1c5SLionel SambucACTIVE_${_t}=	${AVAILABLE_COMPILER:@.c.@ ${ !defined(UNSUPPORTED_COMPILER.${.c.}) && defined(TOOL_${_t}.${.c.}) :? ${.c.} : }@:[1]}
7509152e1c5SLionel SambucSUPPORTED_${_t}=${AVAILABLE_COMPILER:Nfalse:@.c.@ ${ !defined(UNSUPPORTED_COMPILER.${.c.}) && defined(TOOL_${_t}.${.c.}) :? ${.c.} : }@}
7519152e1c5SLionel Sambuc.endfor
7529152e1c5SLionel Sambuc# make bugs prevent moving this into the .for loop
7539152e1c5SLionel SambucCC=		${TOOL_CC.${ACTIVE_CC}}
7549152e1c5SLionel SambucCPP=		${TOOL_CPP.${ACTIVE_CPP}}
7559152e1c5SLionel SambucCXX=		${TOOL_CXX.${ACTIVE_CXX}}
7569152e1c5SLionel SambucFC=		${TOOL_FC.${ACTIVE_FC}}
7579152e1c5SLionel SambucOBJC=		${TOOL_OBJC.${ACTIVE_OBJC}}
7584684ddb6SLionel SambucOPT=		${TOOL_OPT.${ACTIVE_OPT}}
7594684ddb6SLionel SambucLLC=		${TOOL_LLC.${ACTIVE_LLC}}
7609152e1c5SLionel Sambuc
7610a6a1f1dSLionel Sambuc# Override with tools versions if needed
7620a6a1f1dSLionel Sambuc.if ${MKCTF:Uno} != "no" && !defined(NOCTF)
76384d9c625SLionel SambucCTFCONVERT=	${TOOL_CTFCONVERT}
76484d9c625SLionel SambucCTFMERGE=	${TOOL_CTFMERGE}
76584d9c625SLionel Sambuc.endif
76684d9c625SLionel Sambuc
7670a6a1f1dSLionel Sambuc# For each ${MACHINE_CPU}, list the ports that use it.
7680a6a1f1dSLionel SambucMACHINES.aarch64=	evbarm64
7690a6a1f1dSLionel SambucMACHINES.alpha=		alpha
7700a6a1f1dSLionel SambucMACHINES.arm=		acorn26 acorn32 cats epoc32 evbarm hpcarm \
7710a6a1f1dSLionel Sambuc			iyonix netwinder shark zaurus
7720a6a1f1dSLionel SambucMACHINES.coldfire=	evbcf
7730a6a1f1dSLionel SambucMACHINES.i386=		i386
7740a6a1f1dSLionel SambucMACHINES.ia64=		ia64
7750a6a1f1dSLionel SambucMACHINES.hppa=		hppa
7760a6a1f1dSLionel SambucMACHINES.m68000=	sun2
7770a6a1f1dSLionel SambucMACHINES.m68k=		amiga atari cesfic hp300 luna68k mac68k \
7780a6a1f1dSLionel Sambuc			news68k next68k sun3 x68k
7790a6a1f1dSLionel SambucMACHINES.mips=		arc cobalt algor cobalt emips evbmips ews4800mips \
7800a6a1f1dSLionel Sambuc			hpcmips mipsco newsmips pmax sbmips sgimips
7810a6a1f1dSLionel SambucMACHINES.or1k=		or1k
7820a6a1f1dSLionel SambucMACHINES.powerpc=	amigappc bebox evbppc ibmnws macppc mvmeppc \
7830a6a1f1dSLionel Sambuc			ofppc prep rs6000 sandpoint
7840a6a1f1dSLionel SambucMACHINES.riscv=		riscv
7850a6a1f1dSLionel SambucMACHINES.sh3=		dreamcast evbsh3 hpcsh landisk mmeye
7860a6a1f1dSLionel SambucMACHINES.sparc=		sparc sparc64
7870a6a1f1dSLionel SambucMACHINES.sparc64=	sparc64
7880a6a1f1dSLionel SambucMACHINES.vax=		vax
7890a6a1f1dSLionel SambucMACHINES.x86_64=	amd64
7900a6a1f1dSLionel Sambuc
7910a6a1f1dSLionel Sambuc# for crunchide & ldd, define the OBJECT_FMTS used by a MACHINE_ARCH
7920a6a1f1dSLionel Sambuc#
7930a6a1f1dSLionel SambucOBJECT_FMTS=
7940a6a1f1dSLionel Sambuc.if	${MACHINE_ARCH} != "alpha"
7950a6a1f1dSLionel SambucOBJECT_FMTS+=	elf32
7960a6a1f1dSLionel Sambuc.endif
7970a6a1f1dSLionel Sambuc.if	${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH:M*64*} != ""
7980a6a1f1dSLionel SambucOBJECT_FMTS+=	elf64
7990a6a1f1dSLionel Sambuc.endif
8000a6a1f1dSLionel Sambuc
8019152e1c5SLionel Sambuc# OBJCOPY flags to create a.out binaries for old firmware
8029152e1c5SLionel Sambuc# shared among src/distrib and ${MACHINE}/conf/Makefile.${MACHINE}.inc
8039152e1c5SLionel Sambuc.if ${MACHINE_CPU} == "arm"
8049152e1c5SLionel SambucOBJCOPY_ELF2AOUT_FLAGS?=	\
8059152e1c5SLionel Sambuc	-O a.out-arm-netbsd	\
8069152e1c5SLionel Sambuc	-R .ident		\
8079152e1c5SLionel Sambuc	-R .ARM.attributes	\
8089152e1c5SLionel Sambuc	-R .ARM.exidx		\
80984d9c625SLionel Sambuc	-R .ARM.extab		\
8109152e1c5SLionel Sambuc	-R .arm.atpcs		\
8119152e1c5SLionel Sambuc	-R .comment		\
8129152e1c5SLionel Sambuc	-R .debug_abbrev	\
81384d9c625SLionel Sambuc	-R .debug_aranges	\
8149152e1c5SLionel Sambuc	-R .debug_info		\
8159152e1c5SLionel Sambuc	-R .debug_line		\
8169152e1c5SLionel Sambuc	-R .debug_frame		\
8179152e1c5SLionel Sambuc	-R .debug_loc		\
8189152e1c5SLionel Sambuc	-R .debug_pubnames	\
8199152e1c5SLionel Sambuc	-R .debug_pubtypes	\
8200a6a1f1dSLionel Sambuc	-R .debug_ranges	\
82184d9c625SLionel Sambuc	-R .debug_str		\
82284d9c625SLionel Sambuc	-R .eh_frame		\
8239152e1c5SLionel Sambuc	-R .note.netbsd.ident
8249152e1c5SLionel Sambuc.endif
8259152e1c5SLionel Sambuc
826e1091647SArun Thomas#
827e1091647SArun Thomas# Targets to check if DESTDIR or RELEASEDIR is provided
828e1091647SArun Thomas#
829e1091647SArun Thomas.if !target(check_DESTDIR)
830e1091647SArun Thomascheck_DESTDIR: .PHONY .NOTMAIN
831e1091647SArun Thomas.if !defined(DESTDIR)
832e1091647SArun Thomas	@echo "setenv DESTDIR before doing that!"
833e1091647SArun Thomas	@false
834e1091647SArun Thomas.else
835e1091647SArun Thomas	@true
836e1091647SArun Thomas.endif
837e1091647SArun Thomas.endif
838e1091647SArun Thomas
839e1091647SArun Thomas.if !target(check_RELEASEDIR)
840e1091647SArun Thomascheck_RELEASEDIR: .PHONY .NOTMAIN
841e1091647SArun Thomas.if !defined(RELEASEDIR)
842e1091647SArun Thomas	@echo "setenv RELEASEDIR before doing that!"
843e1091647SArun Thomas	@false
844e1091647SArun Thomas.else
845e1091647SArun Thomas	@true
846e1091647SArun Thomas.endif
847e1091647SArun Thomas.endif
848e1091647SArun Thomas
849e1091647SArun Thomas#
850e1091647SArun Thomas# Build a dynamically linked /bin and /sbin, with the necessary shared
851e1091647SArun Thomas# libraries moved from /usr/lib to /lib and the shared linker moved
852e1091647SArun Thomas# from /usr/libexec to /lib
853e1091647SArun Thomas#
854e1091647SArun Thomas# Note that if the BINDIR is not /bin or /sbin, then we always use the
855e1091647SArun Thomas# non-DYNAMICROOT behavior (i.e. it is only enabled for programs in /bin
856e1091647SArun Thomas# and /sbin).  See <bsd.shlib.mk>.
857e1091647SArun Thomas#
858e1091647SArun ThomasMKDYNAMICROOT?=	yes
859e1091647SArun Thomas
860e1091647SArun Thomas#
861e1091647SArun Thomas# Where the system object and source trees are kept; can be configurable
862e1091647SArun Thomas# by the user in case they want them in ~/foosrc and ~/fooobj (for example).
863e1091647SArun Thomas#
864e1091647SArun ThomasBSDSRCDIR?=	/usr/src
865e1091647SArun ThomasBSDOBJDIR?=	/usr/obj
866e1091647SArun ThomasNETBSDSRCDIR?=	${BSDSRCDIR}
867e1091647SArun Thomas
868b8a678efSLionel SambucBINGRP?=	wheel
869e1091647SArun ThomasBINOWN?=	root
870b8a678efSLionel SambucBINMODE?=	555
871b8a678efSLionel SambucNONBINMODE?=	444
872e1091647SArun Thomas
8739152e1c5SLionel Sambuc# These are here mainly because we don't want suid root in case
8749152e1c5SLionel Sambuc# a Makefile defines BINMODE.
8759152e1c5SLionel SambucRUMPBINGRP?=	wheel
8769152e1c5SLionel SambucRUMPBINOWN?=	root
8779152e1c5SLionel SambucRUMPBINMODE?=	555
8789152e1c5SLionel SambucRUMPNONBINMODE?=444
8799152e1c5SLionel Sambuc
880b8a678efSLionel SambucMANDIR?=	/usr/share/man
881b8a678efSLionel SambucMANGRP?=	wheel
882e1091647SArun ThomasMANOWN?=	root
883e1091647SArun ThomasMANMODE?=	${NONBINMODE}
8849152e1c5SLionel SambucMANINSTALL?=	${_MANINSTALL}
885e1091647SArun Thomas
886e1091647SArun ThomasINFODIR?=	/usr/share/info
887b8a678efSLionel SambucINFOGRP?=	wheel
888e1091647SArun ThomasINFOOWN?=	root
889e1091647SArun ThomasINFOMODE?=	${NONBINMODE}
890e1091647SArun Thomas
891230b7775SBen GrasLIBDIR?=	/usr/lib
892e1091647SArun Thomas
893e1091647SArun ThomasLINTLIBDIR?=	/usr/libdata/lint
894e1091647SArun ThomasLIBGRP?=	${BINGRP}
895e1091647SArun ThomasLIBOWN?=	${BINOWN}
896e1091647SArun ThomasLIBMODE?=	${NONBINMODE}
897e1091647SArun Thomas
898e1091647SArun ThomasDOCDIR?=	/usr/share/doc
899b8a678efSLionel SambucDOCGRP?=	wheel
900e1091647SArun ThomasDOCOWN?=	root
901e1091647SArun ThomasDOCMODE?=	${NONBINMODE}
902e1091647SArun Thomas
903e1091647SArun ThomasNLSDIR?=	/usr/share/nls
904e1091647SArun ThomasNLSGRP?=	wheel
905e1091647SArun ThomasNLSOWN?=	root
906e1091647SArun ThomasNLSMODE?=	${NONBINMODE}
907e1091647SArun Thomas
908e1091647SArun ThomasKMODULEGRP?=	wheel
909e1091647SArun ThomasKMODULEOWN?=	root
910e1091647SArun ThomasKMODULEMODE?=	${NONBINMODE}
911e1091647SArun Thomas
912e1091647SArun ThomasLOCALEDIR?=	/usr/share/locale
913e1091647SArun ThomasLOCALEGRP?=	wheel
914e1091647SArun ThomasLOCALEOWN?=	root
915e1091647SArun ThomasLOCALEMODE?=	${NONBINMODE}
916e1091647SArun Thomas
917e1091647SArun ThomasFIRMWAREDIR?=	/libdata/firmware
918e1091647SArun ThomasFIRMWAREGRP?=	wheel
919e1091647SArun ThomasFIRMWAREOWN?=	root
920e1091647SArun ThomasFIRMWAREMODE?=	${NONBINMODE}
921e1091647SArun Thomas
922e1091647SArun ThomasDEBUGDIR?=	/usr/libdata/debug
923e1091647SArun ThomasDEBUGGRP?=	wheel
924e1091647SArun ThomasDEBUGOWN?=	root
925e1091647SArun ThomasDEBUGMODE?=	${NONBINMODE}
926e1091647SArun Thomas
927e1091647SArun Thomas#
928e1091647SArun Thomas# Data-driven table using make variables to control how
929e1091647SArun Thomas# toolchain-dependent targets and shared libraries are built
930e1091647SArun Thomas# for different platforms and object formats.
931e1091647SArun Thomas#
932e1091647SArun Thomas# OBJECT_FMT:		currently either "ELF" or "a.out".
933e1091647SArun Thomas#
934e1091647SArun Thomas# All platforms are ELF.
935e1091647SArun Thomas#
936d824b54dSArun ThomasOBJECT_FMT=	ELF
937230b7775SBen Gras
938e1091647SArun Thomas#
939e1091647SArun Thomas# If this platform's toolchain is missing, we obviously cannot build it.
940e1091647SArun Thomas#
941e1091647SArun Thomas.if ${TOOLCHAIN_MISSING} != "no"
942e1091647SArun ThomasMKBINUTILS:= no
943e1091647SArun ThomasMKGDB:= no
944e1091647SArun ThomasMKGCC:= no
945e1091647SArun Thomas.endif
946e1091647SArun Thomas
947e1091647SArun Thomas#
948e1091647SArun Thomas# If we are using an external toolchain, we can still build the target's
949e1091647SArun Thomas# binutils, but we cannot build GCC's support libraries, since those are
950e1091647SArun Thomas# tightly-coupled to the version of GCC being used.
951e1091647SArun Thomas#
952e1091647SArun Thomas.if defined(EXTERNAL_TOOLCHAIN)
953e1091647SArun ThomasMKGCC:= no
954e1091647SArun Thomas.endif
955e1091647SArun Thomas
9560a6a1f1dSLionel Sambuc# No GDB support for aarch64
9570a6a1f1dSLionel SambucMKGDB.aarch64=	no
9580a6a1f1dSLionel SambucMKGDB.or1k=	no
9590a6a1f1dSLionel SambucMKGDB.riscv32=	no
9600a6a1f1dSLionel SambucMKGDB.riscv64=	no
9610a6a1f1dSLionel Sambuc
9620a6a1f1dSLionel Sambuc# No kernel modules for or1k (yet)
9630a6a1f1dSLionel SambucMKKMOD.or1k=	no
9640a6a1f1dSLionel SambucMKKMOD.riscv32=	no
9650a6a1f1dSLionel SambucMKKMOD.riscv64=	no
9660a6a1f1dSLionel Sambuc
9670a6a1f1dSLionel Sambuc# No profiling for or1k (yet)
9680a6a1f1dSLionel SambucMKPROFILE.or1k=	no
9690a6a1f1dSLionel SambucMKPROFILE.riscv32=no
9700a6a1f1dSLionel SambucMKPROFILE.riscv64=no
9710a6a1f1dSLionel Sambuc
972e1091647SArun Thomas#
973e1091647SArun Thomas# The m68000 port is incomplete.
974e1091647SArun Thomas#
975e1091647SArun Thomas.if ${MACHINE_ARCH} == "m68000"
976e1091647SArun ThomasNOPIC=		# defined
977e1091647SArun ThomasMKISCSI=	no
978e1091647SArun Thomas# XXX GCC 4 outputs mcount() calling sequences that try to load values
979e1091647SArun Thomas# from over 64KB away and this fails to assemble.
9809152e1c5SLionel Sambuc.if defined(HAVE_GCC)
981e1091647SArun ThomasNOPROFILE=	# defined
982e1091647SArun Thomas.endif
983e1091647SArun Thomas.endif
984e1091647SArun Thomas
985e1091647SArun Thomas#
986e1091647SArun Thomas# The ia64 port is incomplete.
987e1091647SArun Thomas#
9880a6a1f1dSLionel SambucMKLINT.ia64=	no
9890a6a1f1dSLionel SambucMKGDB.ia64=	no
990e1091647SArun Thomas
991e1091647SArun Thomas#
992e1091647SArun Thomas# On the MIPS, all libs are compiled with ABIcalls (and are thus PIC),
993e1091647SArun Thomas# not just shared libraries, so don't build the _pic version.
994e1091647SArun Thomas#
995e1091647SArun Thomas.if ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \
996e1091647SArun Thomas    ${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb"
997e1091647SArun ThomasMKPICLIB:=	no
998e1091647SArun Thomas.endif
999e1091647SArun Thomas
10000a6a1f1dSLionel Sambuc# PowerPC64 and AArch64 ABI's are PIC
10010a6a1f1dSLionel SambucMKPICLIB.powerpc64=	no
10020a6a1f1dSLionel Sambuc#MKPICLIB.aarch64=	no
10030a6a1f1dSLionel Sambuc
1004e1091647SArun Thomas#
1005e1091647SArun Thomas# On VAX using ELF, all objects are PIC, not just shared libraries,
10069152e1c5SLionel Sambuc# so don't build the _pic version.
1007e1091647SArun Thomas#
10080a6a1f1dSLionel SambucMKPICLIB.vax=	no
1009e1091647SArun Thomas
1010e1091647SArun Thomas#
1011e1091647SArun Thomas# Location of the file that contains the major and minor numbers of the
1012e1091647SArun Thomas# version of a shared library.  If this file exists a shared library
1013e1091647SArun Thomas# will be built by <bsd.lib.mk>.
1014e1091647SArun Thomas#
1015e1091647SArun ThomasSHLIB_VERSION_FILE?= ${.CURDIR}/shlib_version
1016e1091647SArun Thomas
1017e1091647SArun Thomas#
1018e1091647SArun Thomas# GNU sources and packages sometimes see architecture names differently.
1019e1091647SArun Thomas#
10200a6a1f1dSLionel SambucGNU_ARCH.aarch64eb=aarch64_be
102184d9c625SLionel SambucGNU_ARCH.coldfire=m5407
10229152e1c5SLionel SambucGNU_ARCH.earm=arm
102384d9c625SLionel SambucGNU_ARCH.earmhf=arm
10249152e1c5SLionel SambucGNU_ARCH.earmeb=armeb
102584d9c625SLionel SambucGNU_ARCH.earmhfeb=armeb
102684d9c625SLionel SambucGNU_ARCH.earmv4=armv4
102784d9c625SLionel SambucGNU_ARCH.earmv4eb=armv4eb
102884d9c625SLionel SambucGNU_ARCH.earmv5=arm
102984d9c625SLionel SambucGNU_ARCH.earmv5eb=armeb
103084d9c625SLionel SambucGNU_ARCH.earmv6=armv6
103184d9c625SLionel SambucGNU_ARCH.earmv6hf=armv6
103284d9c625SLionel SambucGNU_ARCH.earmv6eb=armv6eb
103384d9c625SLionel SambucGNU_ARCH.earmv6hfeb=armv6eb
103484d9c625SLionel SambucGNU_ARCH.earmv7=armv7
103584d9c625SLionel SambucGNU_ARCH.earmv7hf=armv7
103684d9c625SLionel SambucGNU_ARCH.earmv7eb=armv7eb
103784d9c625SLionel SambucGNU_ARCH.earmv7hfeb=armv7eb
103884d9c625SLionel SambucGNU_ARCH.i386=i486
103984d9c625SLionel SambucGCC_CONFIG_ARCH.i386=i486
1040e1091647SArun ThomasGCC_CONFIG_TUNE.i386=nocona
1041e1091647SArun ThomasGCC_CONFIG_TUNE.x86_64=nocona
1042e1091647SArun ThomasGNU_ARCH.m68000=m68010
1043e1091647SArun ThomasGNU_ARCH.sh3eb=sh
1044e1091647SArun ThomasGNU_ARCH.sh3el=shle
1045e1091647SArun ThomasGNU_ARCH.mips64eb=mips64
104684d9c625SLionel Sambuc
104784d9c625SLionel Sambuc.if defined(__MINIX)
104884d9c625SLionel Sambuc# MINIX/arm default
104984d9c625SLionel SambucGCC_CONFIG_ARCH.earm=armv7-a
105084d9c625SLionel Sambuc
105184d9c625SLionel Sambuc# MINIX/intel default
105284d9c625SLionel SambucGNU_ARCH.i386=i586
105384d9c625SLionel SambucGCC_CONFIG_ARCH.i386=i586
10544684ddb6SLionel Sambuc
105584d9c625SLionel Sambuc.endif # defined(__MINIX)
105684d9c625SLionel Sambuc
1057e1091647SArun ThomasMACHINE_GNU_ARCH=${GNU_ARCH.${MACHINE_ARCH}:U${MACHINE_ARCH}}
1058e1091647SArun Thomas
1059e1091647SArun Thomas#
1060e1091647SArun Thomas# In order to identify NetBSD to GNU packages, we sometimes need
1061e1091647SArun Thomas# an "elf" tag for historically a.out platforms.
1062e1091647SArun Thomas#
106384d9c625SLionel Sambuc.if (!empty(MACHINE_ARCH:Mearm*))
106484d9c625SLionel SambucMACHINE_GNU_PLATFORM?=${MACHINE_GNU_ARCH}--netbsdelf-${MACHINE_ARCH:C/eb//:C/v[4-7]//:S/earm/eabi/}
10659152e1c5SLionel Sambuc.elif (${MACHINE_GNU_ARCH} == "arm" || \
1066e1091647SArun Thomas     ${MACHINE_GNU_ARCH} == "armeb" || \
1067e1091647SArun Thomas     ${MACHINE_ARCH} == "i386" || \
1068e1091647SArun Thomas     ${MACHINE_CPU} == "m68k" || \
1069e1091647SArun Thomas     ${MACHINE_GNU_ARCH} == "sh" || \
1070e1091647SArun Thomas     ${MACHINE_GNU_ARCH} == "shle" || \
1071e1091647SArun Thomas     ${MACHINE_ARCH} == "sparc" || \
1072e1091647SArun Thomas     ${MACHINE_ARCH} == "vax")
1073e1091647SArun ThomasMACHINE_GNU_PLATFORM?=${MACHINE_GNU_ARCH}--netbsdelf
1074e1091647SArun Thomas.else
1075e1091647SArun ThomasMACHINE_GNU_PLATFORM?=${MACHINE_GNU_ARCH}--netbsd
1076e1091647SArun Thomas.endif
1077e1091647SArun Thomas
1078b1c4ba4aSLionel Sambuc.if defined(__MINIX)
1079b1c4ba4aSLionel Sambuc# We have a simpler toolchain naming scheme
1080b1c4ba4aSLionel SambucMACHINE_GNU_PLATFORM:=${MACHINE_GNU_ARCH}-elf32-minix
10814684ddb6SLionel Sambuc
10824684ddb6SLionel Sambuc# We need to check for HAVE_GOLD after LD has been set
10834684ddb6SLionel Sambuc.  if ${_HAVE_GOLD:U} == ""
10844684ddb6SLionel Sambuc   _HAVE_GOLD!= (exec 2>&1; ${LD} --version || echo "")
10854684ddb6SLionel Sambuc   _GOLD_MATCH:=${_HAVE_GOLD:Mgold}
10864684ddb6SLionel Sambuc   _HAVE_GOLD:= ${_HAVE_GOLD:M[0-9]\.[0-9][0-9]}
108744bb91d4SLionel Sambuc
10884684ddb6SLionel Sambuc.    if ${_GOLD_MATCH} != "" && ${_HAVE_GOLD} != ""
10894684ddb6SLionel Sambuc      HAVE_GOLD?= ${_HAVE_GOLD}
109044bb91d4SLionel Sambuc
109144bb91d4SLionel Sambuc# Without -Wl,--no-ctors-in-init-array, gold moves the constructors out of
109244bb91d4SLionel Sambuc# .ctors into .init_array, which is bad on intel.
109344bb91d4SLionel Sambuc      LDFLAGS+= -Wl,--no-ctors-in-init-array
10944684ddb6SLionel Sambuc.    else
10954684ddb6SLionel Sambuc      USE_BITCODE:=no
10964684ddb6SLionel Sambuc.    endif
10974684ddb6SLionel Sambuc.  endif # ${_HAVE_GOLD:U} == ""
1098b1c4ba4aSLionel Sambuc.endif # defined(__MINIX)
1099b1c4ba4aSLionel Sambuc
11000a6a1f1dSLionel Sambuc.if !empty(MACHINE_ARCH:M*arm*)
11010a6a1f1dSLionel Sambuc# Flags to pass to CC for using the old APCS ABI on ARM for compat or stand.
11020a6a1f1dSLionel SambucARM_APCS_FLAGS=	-mabi=apcs-gnu -mfloat-abi=soft
11030a6a1f1dSLionel SambucARM_APCS_FLAGS+=${${ACTIVE_CC} == "gcc":? -marm :}
11040a6a1f1dSLionel SambucARM_APCS_FLAGS+=${${ACTIVE_CC} == "clang":? -target ${MACHINE_GNU_ARCH}--netbsdelf -B ${TOOLDIR}/${MACHINE_GNU_PLATFORM}/bin :}
1105e1091647SArun Thomas.endif
1106e1091647SArun Thomas
11070a6a1f1dSLionel SambucGENASSYM_CPPFLAGS+=	${${ACTIVE_CC} == "clang":? -no-integrated-as :}
11080a6a1f1dSLionel Sambuc
1109e1091647SArun ThomasTARGETS+=	all clean cleandir depend dependall includes \
11109152e1c5SLionel Sambuc		install lint obj regress tags html analyze
1111e1091647SArun ThomasPHONY_NOTMAIN =	all clean cleandir depend dependall distclean includes \
11129152e1c5SLionel Sambuc		install lint obj regress beforedepend afterdepend \
1113e1091647SArun Thomas		beforeinstall afterinstall realinstall realdepend realall \
11149152e1c5SLionel Sambuc		html subdir-all subdir-install subdir-depend analyze
1115e1091647SArun Thomas.PHONY:		${PHONY_NOTMAIN}
1116e1091647SArun Thomas.NOTMAIN:	${PHONY_NOTMAIN}
1117e1091647SArun Thomas
1118e1091647SArun Thomas.if ${NEED_OWN_INSTALL_TARGET} != "no"
1119e1091647SArun Thomas.if !target(install)
1120e1091647SArun Thomasinstall:	beforeinstall .WAIT subdir-install realinstall .WAIT afterinstall
1121e1091647SArun Thomasbeforeinstall:
1122e1091647SArun Thomassubdir-install:
1123e1091647SArun Thomasrealinstall:
1124e1091647SArun Thomasafterinstall:
1125e1091647SArun Thomas.endif
1126e1091647SArun Thomasall:		realall subdir-all
1127e1091647SArun Thomassubdir-all:
1128e1091647SArun Thomasrealall:
1129e1091647SArun Thomasdepend:		realdepend subdir-depend
1130e1091647SArun Thomassubdir-depend:
1131e1091647SArun Thomasrealdepend:
1132e1091647SArun Thomasdistclean:	cleandir
1133e1091647SArun Thomascleandir:	clean
1134e1091647SArun Thomas
1135e1091647SArun Thomasdependall:	.NOTMAIN realdepend .MAKE
11369152e1c5SLionel Sambuc	@cd "${.CURDIR}"; ${MAKE} realall
1137e1091647SArun Thomas.endif
1138e1091647SArun Thomas
1139e1091647SArun Thomas#
1140e1091647SArun Thomas# Define MKxxx variables (which are either yes or no) for users
1141e1091647SArun Thomas# to set in /etc/mk.conf and override in the make environment.
1142e1091647SArun Thomas# These should be tested with `== "no"' or `!= "no"'.
1143e1091647SArun Thomas# The NOxxx variables should only be set by Makefiles.
1144e1091647SArun Thomas#
1145e1091647SArun Thomas# Please keep etc/Makefile and share/man/man5/mk.conf.5 in sync
1146e1091647SArun Thomas# with changes to the MK* variables here.
1147e1091647SArun Thomas#
1148e1091647SArun Thomas
1149e1091647SArun Thomas#
1150e1091647SArun Thomas# Supported NO* options (if defined, MK* will be forced to "no",
1151e1091647SArun Thomas# regardless of user's mk.conf setting).
1152e1091647SArun Thomas#
1153e1091647SArun Thomas# Source makefiles should set NO*, and not MK*, and must do so before
1154e1091647SArun Thomas# including bsd.own.mk.
1155e1091647SArun Thomas#
1156e1091647SArun Thomas.for var in \
1157e1091647SArun Thomas	NOCRYPTO NODOC NOHTML NOINFO NOLINKLIB NOLINT NOMAN NONLS NOOBJ NOPIC \
1158e1091647SArun Thomas	NOPICINSTALL NOPROFILE NOSHARE NOSTATICLIB
1159e1091647SArun Thomas.if defined(${var})
1160e1091647SArun ThomasMK${var:S/^NO//}:=	no
1161e1091647SArun Thomas.endif
1162e1091647SArun Thomas.endfor
1163e1091647SArun Thomas
1164e1091647SArun Thomas#
1165e1091647SArun Thomas# Older-style variables that enabled behaviour when set.
1166e1091647SArun Thomas#
1167e1091647SArun Thomas.for var in MANZ UNPRIVED UPDATE
1168e1091647SArun Thomas.if defined(${var})
1169e1091647SArun ThomasMK${var}:=	yes
1170e1091647SArun Thomas.endif
1171e1091647SArun Thomas.endfor
1172e1091647SArun Thomas
1173e1091647SArun Thomas#
1174e1091647SArun Thomas# MK* options which have variable defaults.
1175e1091647SArun Thomas#
11760a6a1f1dSLionel Sambuc.if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "sparc64" \
11770a6a1f1dSLionel Sambuc    || ${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el" \
11780a6a1f1dSLionel Sambuc    || ${MACHINE_ARCH} == "powerpc64" || ${MACHINE_CPU} == "aarch64" \
11790a6a1f1dSLionel Sambuc    || ${MACHINE_ARCH} == "riscv64" \
11800a6a1f1dSLionel Sambuc    || !empty(MACHINE_ARCH:Mearm*)
1181e1091647SArun ThomasMKCOMPAT?=	yes
1182e1091647SArun Thomas.else
1183e1091647SArun Thomas# Don't let this build where it really isn't supported.
1184e1091647SArun ThomasMKCOMPAT:=	no
11850a6a1f1dSLionel SambucMKCOMPATTESTS:=	no
11860a6a1f1dSLionel SambucMKCOMPATX11:=	no
1187e1091647SArun Thomas.endif
1188e1091647SArun Thomas
11890a6a1f1dSLionel Sambuc.if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "i386" \
11900a6a1f1dSLionel Sambuc    || ${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el" \
11910a6a1f1dSLionel Sambuc    || (${MACHINE} == "evbppc" && ${MACHINE_ARCH} == "powerpc")
11929152e1c5SLionel SambucMKCOMPATMODULES?=	yes
11939152e1c5SLionel Sambuc.else
11949152e1c5SLionel SambucMKCOMPATMODULES:=	no
11959152e1c5SLionel Sambuc.endif
11969152e1c5SLionel Sambuc
11979152e1c5SLionel Sambuc#
11989152e1c5SLionel Sambuc# Default mips64 to softfloat now.
119984d9c625SLionel Sambuc# arm is always softfloat unless it isn't
12009152e1c5SLionel Sambuc# emips is always softfloat.
120184d9c625SLionel Sambuc# coldfire is always softfloat
12020a6a1f1dSLionel Sambuc# or1k is always softfloat
12039152e1c5SLionel Sambuc#
12049152e1c5SLionel Sambuc.if ${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el" || \
120584d9c625SLionel Sambuc    (${MACHINE_CPU} == "arm" && ${MACHINE_ARCH:M*hf*} == "") || \
12060a6a1f1dSLionel Sambuc    ${MACHINE_ARCH} == "coldfire" || ${MACHINE_CPU} == "or1k" || \
12079152e1c5SLionel Sambuc    ${MACHINE} == "emips"
12089152e1c5SLionel SambucMKSOFTFLOAT?=	yes
12099152e1c5SLionel Sambuc.endif
12109152e1c5SLionel Sambuc
12119152e1c5SLionel Sambuc.if ${MACHINE} == "emips"
12129152e1c5SLionel SambucSOFTFLOAT_BITS=	32
12139152e1c5SLionel Sambuc.endif
12149152e1c5SLionel Sambuc
121511be35a1SLionel Sambuc.if ${MACHINE_ARCH} == "i386" || \
121611be35a1SLionel Sambuc    ${MACHINE_ARCH} == "x86_64" || \
121711be35a1SLionel Sambuc    ${MACHINE_ARCH} == "sparc"
121811be35a1SLionel SambucMKSLJIT?=	yes
121911be35a1SLionel Sambuc.else
122011be35a1SLionel SambucMKSLJIT?=	no
122111be35a1SLionel Sambuc.endif
122211be35a1SLionel Sambuc
1223e1091647SArun Thomas#
1224e1091647SArun Thomas# MK* backward compatibility.
1225e1091647SArun Thomas#
1226e1091647SArun Thomas.if defined(MKBFD)
1227e1091647SArun ThomasMKBINUTILS?=	${MKBFD}
1228e1091647SArun Thomas.endif
1229e1091647SArun Thomas
1230e1091647SArun Thomas#
12310a6a1f1dSLionel Sambuc# We want to build zfs only for amd64 by default for now.
1232e1091647SArun Thomas#
12330a6a1f1dSLionel Sambuc.if ${MACHINE} == "amd64"
1234e1091647SArun ThomasMKZFS?=		yes
1235e1091647SArun Thomas.endif
1236e1091647SArun Thomas
1237e1091647SArun Thomas#
1238e1091647SArun Thomas# MK* options which default to "yes".
1239e1091647SArun Thomas#
1240e1091647SArun Thomas_MKVARS.yes= \
1241e1091647SArun Thomas	MKATF \
1242e1091647SArun Thomas	MKBINUTILS \
12439152e1c5SLionel Sambuc	MKCRYPTO MKCOMPLEX MKCVS MKCXX \
1244e1091647SArun Thomas	MKDOC \
12450a6a1f1dSLionel Sambuc	MKGCC MKGDB MKGROFF \
1246e1091647SArun Thomas	MKHESIOD MKHTML \
1247e1091647SArun Thomas	MKIEEEFP MKINET6 MKINFO MKIPFILTER MKISCSI \
1248e1091647SArun Thomas	MKKERBEROS \
1249e1091647SArun Thomas	MKKMOD \
125084d9c625SLionel Sambuc	MKLDAP MKLIBSTDCXX MKLINKLIB MKLVM \
12519152e1c5SLionel Sambuc	MKMAN MKMANDOC \
1252e1091647SArun Thomas	MKMDNS \
12539152e1c5SLionel Sambuc	MKMAKEMANDB \
1254e1091647SArun Thomas	MKNLS \
12559152e1c5SLionel Sambuc	MKNPF \
1256e1091647SArun Thomas	MKOBJ \
12579152e1c5SLionel Sambuc	MKPAM MKPERFUSE \
1258e1091647SArun Thomas	MKPF MKPIC MKPICINSTALL MKPICLIB MKPOSTFIX MKPROFILE \
12599152e1c5SLionel Sambuc	MKRUMP \
1260e1091647SArun Thomas	MKSHARE MKSKEY MKSTATICLIB \
1261e1091647SArun Thomas	MKX11FONTS \
1262e1091647SArun Thomas	MKYP
12639152e1c5SLionel Sambuc
12641a8cf59dSArun Thomas#MINIX-specific vars
12651a8cf59dSArun Thomas_MKVARS.yes+= \
12663ea34559SDavid van Moolenbroek	MKSYSDEBUG MKLIVEUPDATE MKLLVMCMDS
1267fd43d93cSArun Thomas.if (${MACHINE_ARCH} == "i386")
1268fd43d93cSArun Thomas_MKVARS.yes+= \
12693c71801eSrlfnb	MKWATCHDOG MKACPI MKAPIC MKDEBUGREG MKINSTALLBOOT MKPCI
1270fd43d93cSArun Thomas.endif
1271fd43d93cSArun Thomas
1272e1091647SArun Thomas.for var in ${_MKVARS.yes}
12730a6a1f1dSLionel Sambuc${var}?=	${${var}.${MACHINE_ARCH}:Uyes}
1274e1091647SArun Thomas.endfor
1275e1091647SArun Thomas
1276e1091647SArun Thomas#
12770a6a1f1dSLionel Sambuc# MKGCCCMDS is only valid if we are building GCC so make it dependent on that.
12780a6a1f1dSLionel Sambuc#
12790a6a1f1dSLionel Sambuc_MKVARS.yes += MKGCCCMDS
12800a6a1f1dSLionel SambucMKGCCCMDS?=	${MKGCC}
12810a6a1f1dSLionel Sambuc
12820a6a1f1dSLionel Sambuc#
12839152e1c5SLionel Sambuc# Exceptions to the above:
12849152e1c5SLionel Sambuc#
12850a6a1f1dSLionel Sambuc.if ${MACHINE} == "acorn26"	# page size is prohibitive
12860a6a1f1dSLionel SambucMKKMOD=		no
12870a6a1f1dSLionel Sambuc.endif
12889152e1c5SLionel Sambuc
12899152e1c5SLionel Sambuc#
12909152e1c5SLionel Sambuc# MK* options which default to "no".  Note that MKZFS has a different
12919152e1c5SLionel Sambuc# default for some platforms, see above.
1292e1091647SArun Thomas#
1293e1091647SArun Thomas_MKVARS.no= \
12949152e1c5SLionel Sambuc	MKBSDGREP MKBSDTAR \
12950a6a1f1dSLionel Sambuc	MKCATPAGES MKCOMPATTESTS MKCOMPATX11 MKCRYPTO_RC5 MKCTF MKDEBUG \
12960a6a1f1dSLionel Sambuc	MKDEBUGLIB MKDTRACE MKEXTSRC MKGROFFHTMLDOC \
129784d9c625SLionel Sambuc	MKKYUA MKLLD MKLLDB MKLINT \
129884d9c625SLionel Sambuc	MKMANZ MKMCLINKER MKOBJDIRS \
129984d9c625SLionel Sambuc	MKLIBCXX MKLLVM MKPCC \
13009152e1c5SLionel Sambuc	MKPIGZGZIP \
13019152e1c5SLionel Sambuc	MKREPRO \
130284d9c625SLionel Sambuc	MKSOFTFLOAT MKSTRIPIDENT MKTPM \
130384d9c625SLionel Sambuc	MKUNPRIVED MKUPDATE MKX11 MKX11MOTIF MKZFS
13049152e1c5SLionel Sambuc
13053eb22ca4SArun Thomas#MINIX-specific vars
13063eb22ca4SArun Thomas_MKVARS.no+= \
13073c71801eSrlfnb	MKIMAGEONLY MKSMALL MKBITCODE MKMAGIC MKPAE MKASR MKSRC
130884d9c625SLionel Sambuc.if !empty(MACHINE_ARCH:Mearm*)
1309fd43d93cSArun Thomas_MKVARS.no+= \
1310bf609e10Srlfnb	MKWATCHDOG MKPAE MKACPI MKAPIC MKDEBUGREG MKINSTALLBOOT MKPCI
1311fd43d93cSArun Thomas.endif
13129152e1c5SLionel Sambuc
1313e1091647SArun Thomas.for var in ${_MKVARS.no}
13140a6a1f1dSLionel Sambuc${var}?=	${${var}.${MACHINE_ARCH}:Uno}
1315e1091647SArun Thomas.endfor
1316e1091647SArun Thomas
1317e1091647SArun Thomas#
131884d9c625SLionel Sambuc# Which platforms build the xorg-server drivers (as opposed
131984d9c625SLionel Sambuc# to just Xnest and Xvfb.)
132084d9c625SLionel Sambuc#
13210a6a1f1dSLionel Sambuc.if ${MACHINE} == "alpha"	|| \
132284d9c625SLionel Sambuc    ${MACHINE} == "amd64"	|| \
132384d9c625SLionel Sambuc    ${MACHINE} == "bebox"	|| \
132484d9c625SLionel Sambuc    ${MACHINE} == "cats"	|| \
132584d9c625SLionel Sambuc    ${MACHINE} == "dreamcast"	|| \
132684d9c625SLionel Sambuc    ${MACHINE} == "ews4800mips"	|| \
132784d9c625SLionel Sambuc    ${MACHINE} == "evbarm"	|| \
132884d9c625SLionel Sambuc    ${MACHINE} == "evbmips"	|| \
132984d9c625SLionel Sambuc    ${MACHINE} == "hp300"	|| \
133084d9c625SLionel Sambuc    ${MACHINE} == "hpcarm"	|| \
133184d9c625SLionel Sambuc    ${MACHINE} == "hpcmips"	|| \
133284d9c625SLionel Sambuc    ${MACHINE} == "hpcsh"	|| \
133384d9c625SLionel Sambuc    ${MACHINE} == "i386"	|| \
133484d9c625SLionel Sambuc    ${MACHINE} == "luna68k"	|| \
13350a6a1f1dSLionel Sambuc    ${MACHINE} == "mac68k"	|| \
133684d9c625SLionel Sambuc    ${MACHINE} == "macppc"	|| \
133784d9c625SLionel Sambuc    ${MACHINE} == "netwinder"	|| \
133884d9c625SLionel Sambuc    ${MACHINE} == "newsmips"	|| \
133984d9c625SLionel Sambuc    ${MACHINE} == "prep"	|| \
134084d9c625SLionel Sambuc    ${MACHINE} == "ofppc"	|| \
134184d9c625SLionel Sambuc    ${MACHINE} == "sgimips"	|| \
134284d9c625SLionel Sambuc    ${MACHINE} == "shark"	|| \
134384d9c625SLionel Sambuc    ${MACHINE} == "sparc"	|| \
134484d9c625SLionel Sambuc    ${MACHINE} == "sparc64"	|| \
134584d9c625SLionel Sambuc    ${MACHINE} == "vax"		|| \
134684d9c625SLionel Sambuc    ${MACHINE} == "zaurus"
134784d9c625SLionel SambucMKXORG_SERVER?=yes
134884d9c625SLionel Sambuc.else
134984d9c625SLionel SambucMKXORG_SERVER?=no
135084d9c625SLionel Sambuc.endif
135184d9c625SLionel Sambuc
135284d9c625SLionel Sambuc#
1353e1091647SArun Thomas# Force some options off if their dependencies are off.
1354e1091647SArun Thomas#
1355e1091647SArun Thomas
13569152e1c5SLionel Sambuc.if ${MKCXX} == "no"
13579152e1c5SLionel SambucMKATF:=		no
13589152e1c5SLionel SambucMKGROFF:=	no
135911be35a1SLionel SambucMKKYUA:=	no
13609152e1c5SLionel Sambuc.endif
13619152e1c5SLionel Sambuc
1362e1091647SArun Thomas.if ${MKCRYPTO} == "no"
1363e1091647SArun ThomasMKKERBEROS:=	no
13649152e1c5SLionel SambucMKLDAP:=	no
1365e1091647SArun Thomas.endif
1366e1091647SArun Thomas
1367e1091647SArun Thomas.if ${MKMAN} == "no"
1368e1091647SArun ThomasMKCATPAGES:=	no
1369e1091647SArun ThomasMKHTML:=	no
1370e1091647SArun Thomas.endif
1371e1091647SArun Thomas
13729152e1c5SLionel Sambuc_MANINSTALL=	maninstall
13739152e1c5SLionel Sambuc.if ${MKCATPAGES} != "no"
13749152e1c5SLionel Sambuc_MANINSTALL+=	catinstall
13759152e1c5SLionel Sambuc.endif
13769152e1c5SLionel Sambuc.if ${MKHTML} != "no"
13779152e1c5SLionel Sambuc_MANINSTALL+=	htmlinstall
13789152e1c5SLionel Sambuc.endif
13799152e1c5SLionel Sambuc
1380e1091647SArun Thomas.if ${MKLINKLIB} == "no"
1381e1091647SArun ThomasMKLINT:=	no
1382e1091647SArun ThomasMKPICINSTALL:=	no
1383e1091647SArun ThomasMKPROFILE:=	no
1384e1091647SArun Thomas.endif
1385e1091647SArun Thomas
1386e1091647SArun Thomas.if ${MKPIC} == "no"
1387e1091647SArun ThomasMKPICLIB:=	no
1388e1091647SArun Thomas.endif
1389e1091647SArun Thomas
1390e1091647SArun Thomas.if ${MKOBJ} == "no"
1391e1091647SArun ThomasMKOBJDIRS:=	no
1392e1091647SArun Thomas.endif
1393e1091647SArun Thomas
1394e1091647SArun Thomas.if ${MKSHARE} == "no"
1395e1091647SArun ThomasMKCATPAGES:=	no
1396e1091647SArun ThomasMKDOC:=		no
1397e1091647SArun ThomasMKINFO:=	no
1398e1091647SArun ThomasMKHTML:=	no
1399e1091647SArun ThomasMKMAN:=		no
1400e1091647SArun ThomasMKNLS:=		no
1401e1091647SArun Thomas.endif
1402e1091647SArun Thomas
14031a8cf59dSArun Thomas# MINIX
1404f985ecbaSArun Thomas.if ${MKSMALL} == "yes"
14051a8cf59dSArun ThomasMKWATCHDOG:=	no
1406ae561b8fSArun ThomasMKACPI:=	no
1407ae561b8fSArun ThomasMKAPIC:=	no
140840592de3SArun ThomasMKDEBUGREG:=	no
1409593e3221SArun ThomasMKSYSDEBUG:=	no
14104ca68d42SArun ThomasMKLIVEUPDATE:=	no
14111a8cf59dSArun Thomas.endif
14121a8cf59dSArun Thomas
141372965c88SDavid van Moolenbroek# MINIX: MKASR implies MKMAGIC
141472965c88SDavid van Moolenbroek.if ${MKASR} == "yes"
141572965c88SDavid van MoolenbroekMKMAGIC:=	yes
141672965c88SDavid van Moolenbroek.endif
141772965c88SDavid van Moolenbroek
1418b2ed49a5SDavid van Moolenbroek# MINIX: MKMAGIC implies MKBITCODE
1419b2ed49a5SDavid van Moolenbroek.if ${MKMAGIC} == "yes"
1420b2ed49a5SDavid van MoolenbroekMKBITCODE:=	yes
1421b2ed49a5SDavid van Moolenbroek.endif
1422b2ed49a5SDavid van Moolenbroek
14230a6a1f1dSLionel Sambuc.if !empty(MACHINE_ARCH:Mearm*)
14240a6a1f1dSLionel Sambuc_NEEDS_LIBCXX.${MACHINE_ARCH}=	yes
14250a6a1f1dSLionel Sambuc.endif
14260a6a1f1dSLionel Sambuc_NEEDS_LIBCXX.i386=		yes
14270a6a1f1dSLionel Sambuc_NEEDS_LIBCXX.powerpc=		yes
14280a6a1f1dSLionel Sambuc_NEEDS_LIBCXX.powerpc64=	yes
14290a6a1f1dSLionel Sambuc_NEEDS_LIBCXX.x86_64=		yes
14300a6a1f1dSLionel Sambuc_NEEDS_LIBCXX.aarch64=		yes
14310a6a1f1dSLionel Sambuc
14320a6a1f1dSLionel Sambuc.if ${MKLLVM} == "yes" && ${_NEEDS_LIBCXX.${MACHINE_ARCH}:Uno} == "yes"
14330a6a1f1dSLionel SambucMKLIBCXX:=	yes
14340a6a1f1dSLionel Sambuc.endif
14350a6a1f1dSLionel Sambuc
1436e1091647SArun Thomas#
1437e1091647SArun Thomas# install(1) parameters.
1438e1091647SArun Thomas#
1439e1091647SArun ThomasCOPY?=		-c
1440e1091647SArun Thomas.if ${MKUPDATE} == "no"
1441e1091647SArun ThomasPRESERVE?=
1442e1091647SArun Thomas.else
1443e1091647SArun ThomasPRESERVE?=	-p
1444e1091647SArun Thomas.endif
14459152e1c5SLionel SambucRENAME?=	-r
1446e1091647SArun ThomasHRDLINK?=	-l h
1447e1091647SArun ThomasSYMLINK?=	-l s
1448e1091647SArun Thomas
1449e1091647SArun ThomasMETALOG?=	${DESTDIR}/METALOG
1450e1091647SArun ThomasMETALOG.add?=	${TOOL_CAT} -l >> ${METALOG}
1451e1091647SArun Thomas.if (${_SRC_TOP_} != "")	# only set INSTPRIV if inside ${NETBSDSRCDIR}
1452e1091647SArun Thomas.if ${MKUNPRIVED} != "no"
1453e1091647SArun ThomasINSTPRIV.unpriv=-U -M ${METALOG} -D ${DESTDIR} -h sha256
1454e1091647SArun Thomas.else
1455e1091647SArun ThomasINSTPRIV.unpriv=
1456e1091647SArun Thomas.endif
1457e1091647SArun ThomasINSTPRIV?=	${INSTPRIV.unpriv} -N ${NETBSDSRCDIR}/etc
1458e1091647SArun Thomas.endif
1459e1091647SArun ThomasSTRIPFLAG?=
1460e1091647SArun Thomas
1461e1091647SArun Thomas.if ${NEED_OWN_INSTALL_TARGET} != "no"
1462e1091647SArun ThomasINSTALL_DIR?=		${INSTALL} ${INSTPRIV} -d
1463e1091647SArun ThomasINSTALL_FILE?=		${INSTALL} ${INSTPRIV} ${COPY} ${PRESERVE} ${RENAME}
1464e1091647SArun ThomasINSTALL_LINK?=		${INSTALL} ${INSTPRIV} ${HRDLINK} ${RENAME}
1465e1091647SArun ThomasINSTALL_SYMLINK?=	${INSTALL} ${INSTPRIV} ${SYMLINK} ${RENAME}
1466e1091647SArun Thomas.endif
1467e1091647SArun Thomas
1468e1091647SArun Thomas#
1469e1091647SArun Thomas# Set defaults for the USE_xxx variables.
1470e1091647SArun Thomas#
1471e1091647SArun Thomas
1472e1091647SArun Thomas#
1473e1091647SArun Thomas# USE_* options which default to "no" and will be forced to "no" if their
1474e1091647SArun Thomas# corresponding MK* variable is set to "no".
1475e1091647SArun Thomas#
1476e1091647SArun Thomas.for var in USE_SKEY
1477e1091647SArun Thomas.if (${${var:S/USE_/MK/}} == "no")
1478e1091647SArun Thomas${var}:= no
1479e1091647SArun Thomas.else
1480e1091647SArun Thomas${var}?= no
1481e1091647SArun Thomas.endif
1482e1091647SArun Thomas.endfor
1483e1091647SArun Thomas
1484e1091647SArun Thomas#
1485e1091647SArun Thomas# USE_* options which default to "yes" unless their corresponding MK*
1486e1091647SArun Thomas# variable is set to "no".
1487e1091647SArun Thomas#
14889152e1c5SLionel Sambuc.for var in USE_HESIOD USE_INET6 USE_KERBEROS USE_LDAP USE_PAM USE_YP
14899152e1c5SLionel Sambuc.if (${${var:S/USE_/MK/}} == "no")
14909152e1c5SLionel Sambuc${var}:= no
14919152e1c5SLionel Sambuc.else
14929152e1c5SLionel Sambuc${var}?= yes
14939152e1c5SLionel Sambuc.endif
14949152e1c5SLionel Sambuc.endfor
14959152e1c5SLionel Sambuc
14969152e1c5SLionel Sambuc#MINIX-specific vars
14979152e1c5SLionel Sambuc.for var in \
1498bf609e10Srlfnb	USE_WATCHDOG USE_ACPI USE_PAE USE_APIC USE_DEBUGREG USE_SYSDEBUG \
149972965c88SDavid van Moolenbroek	USE_LIVEUPDATE USE_PCI USE_BITCODE USE_MAGIC USE_ASR
1500e1091647SArun Thomas.if (${${var:S/USE_/MK/}} == "no")
1501e1091647SArun Thomas${var}:= no
1502e1091647SArun Thomas.else
1503e1091647SArun Thomas${var}?= yes
1504e1091647SArun Thomas.endif
1505e1091647SArun Thomas.endfor
1506e1091647SArun Thomas
1507e1091647SArun Thomas#
1508e1091647SArun Thomas# USE_* options which default to "yes".
1509e1091647SArun Thomas#
1510e1091647SArun Thomas.for var in USE_JEMALLOC
1511e1091647SArun Thomas${var}?= yes
1512e1091647SArun Thomas.endfor
1513e1091647SArun Thomas
1514e1091647SArun Thomas#
1515e1091647SArun Thomas# USE_* options which default to "no".
1516e1091647SArun Thomas#
15179152e1c5SLionel Sambuc# For now, disable pigz as compressor by default
15189152e1c5SLionel Sambuc.for var in USE_PIGZGZIP USE_LIBTRE
15199152e1c5SLionel Sambuc${var}?= no
15209152e1c5SLionel Sambuc.endfor
1521e1091647SArun Thomas
15220a6a1f1dSLionel Sambuc#
15230a6a1f1dSLionel Sambuc# TOOL_GZIP and friends.  These might refer to TOOL_PIGZ or to the host gzip.
15240a6a1f1dSLionel Sambuc#
15259152e1c5SLionel Sambuc.if ${USE_PIGZGZIP} != "no"
15269152e1c5SLionel SambucTOOL_GZIP=		${TOOL_PIGZ}
15270a6a1f1dSLionel SambucGZIP_N_FLAG?=		-nT
15289152e1c5SLionel Sambuc.else
15299152e1c5SLionel SambucTOOL_GZIP=		gzip
15300a6a1f1dSLionel SambucGZIP_N_FLAG?=		-n
15319152e1c5SLionel Sambuc.endif
15320a6a1f1dSLionel SambucTOOL_GZIP_N=		${TOOL_GZIP} ${GZIP_N_FLAG}
15339152e1c5SLionel Sambuc
15349152e1c5SLionel Sambuc#
15359152e1c5SLionel Sambuc# Where X11 sources are and where it is installed to.
15369152e1c5SLionel Sambuc#
15379152e1c5SLionel Sambuc.if !defined(X11SRCDIR)
15389152e1c5SLionel Sambuc.if exists(${NETBSDSRCDIR}/../xsrc)
15399152e1c5SLionel SambucX11SRCDIR!=		cd "${NETBSDSRCDIR}/../xsrc" && pwd
15409152e1c5SLionel Sambuc.else
15419152e1c5SLionel SambucX11SRCDIR=		/usr/xsrc
15429152e1c5SLionel Sambuc.endif
15439152e1c5SLionel Sambuc.endif # !defined(X11SRCDIR)
15449152e1c5SLionel Sambuc
15459152e1c5SLionel SambucX11SRCDIR.local?=	${X11SRCDIR}/local
15469152e1c5SLionel SambucX11ROOTDIR?=		/usr/X11R7
15479152e1c5SLionel SambucX11BINDIR?=		${X11ROOTDIR}/bin
15489152e1c5SLionel SambucX11ETCDIR?=		/etc/X11
15499152e1c5SLionel SambucX11FONTDIR?=		${X11ROOTDIR}/lib/X11/fonts
15509152e1c5SLionel SambucX11INCDIR?=		${X11ROOTDIR}/include
15519152e1c5SLionel SambucX11LIBDIR?=		${X11ROOTDIR}/lib/X11
15529152e1c5SLionel SambucX11MANDIR?=		${X11ROOTDIR}/man
15539152e1c5SLionel SambucX11SHAREDIR?=		${X11ROOTDIR}/share
15540a6a1f1dSLionel SambucX11USRLIBDIR?=		${X11ROOTDIR}/lib${MLIBDIR:D/${MLIBDIR}}
15559152e1c5SLionel Sambuc
15569152e1c5SLionel Sambuc#
15579152e1c5SLionel Sambuc# New modular-xorg based builds
15589152e1c5SLionel Sambuc#
15599152e1c5SLionel SambucX11SRCDIRMIT?=		${X11SRCDIR}/external/mit
15609152e1c5SLionel Sambuc.for _lib in \
15619152e1c5SLionel Sambuc	FS ICE SM X11 XScrnSaver XTrap Xau Xcomposite Xcursor Xdamage \
15620a6a1f1dSLionel Sambuc	Xdmcp Xevie Xext Xfixes Xfont Xft Xi Xinerama Xmu Xpresent Xpm \
15639152e1c5SLionel Sambuc	Xrandr Xrender Xres Xt Xtst Xv XvMC Xxf86dga Xxf86misc Xxf86vm drm \
15640a6a1f1dSLionel Sambuc	fontenc xkbfile xkbui Xaw Xfontcache pciaccess xcb \
15650a6a1f1dSLionel Sambuc	pthread-stubs
15669152e1c5SLionel SambucX11SRCDIR.${_lib}?=		${X11SRCDIRMIT}/lib${_lib}/dist
15679152e1c5SLionel Sambuc.endfor
15689152e1c5SLionel Sambuc
15699152e1c5SLionel Sambuc.for _proto in \
15709152e1c5SLionel Sambuc	xcmisc xext xf86bigfont bigreqs input kb x fonts fixes scrnsaver \
15710a6a1f1dSLionel Sambuc	xinerama dri2 dri3 render resource record video xf86dga xf86misc \
15729152e1c5SLionel Sambuc	xf86vidmode composite damage trap gl randr fontcache xf86dri \
15730a6a1f1dSLionel Sambuc	present xcb-
15749152e1c5SLionel SambucX11SRCDIR.${_proto}proto?=		${X11SRCDIRMIT}/${_proto}proto/dist
15759152e1c5SLionel Sambuc.endfor
15769152e1c5SLionel Sambuc
15779152e1c5SLionel Sambuc.for _dir in \
15780a6a1f1dSLionel Sambuc	xtrans fontconfig freetype evieext mkfontscale bdftopcf \
15790a6a1f1dSLionel Sambuc	xkbcomp xorg-cf-files imake xorg-server xbiff xkeyboard-config \
15809152e1c5SLionel Sambuc	xbitmaps appres xeyes xev xedit sessreg pixman \
15810a6a1f1dSLionel Sambuc	beforelight bitmap editres makedepend fonttosfnt fslsfonts fstobdf \
15820a6a1f1dSLionel Sambuc	glu glw mesa-demos MesaGLUT MesaLib MesaLib7 \
15830a6a1f1dSLionel Sambuc	ico iceauth listres lndir \
15849152e1c5SLionel Sambuc	luit xproxymanagementprotocol mkfontdir oclock proxymngr rgb \
15850a6a1f1dSLionel Sambuc	rstart setxkbmap showfont smproxy twm viewres \
15860a6a1f1dSLionel Sambuc	x11perf xauth xcalc xclipboard \
15870a6a1f1dSLionel Sambuc	xclock xcmsdb xconsole xditview xdpyinfo xdriinfo xdm \
15889152e1c5SLionel Sambuc	xfd xf86dga xfindproxy xfontsel xfwp xgamma xgc xhost xinit \
15899152e1c5SLionel Sambuc	xkill xload xlogo xlsatoms xlsclients xlsfonts xmag xmessage \
15909152e1c5SLionel Sambuc	xmh xmodmap xmore xman xprop xrandr xrdb xrefresh xset \
15919152e1c5SLionel Sambuc	xsetmode xsetpointer xsetroot xsm xstdcmap xvidtune xvinfo \
15920a6a1f1dSLionel Sambuc	xwininfo xwud xkbprint xkbevd \
15930a6a1f1dSLionel Sambuc	xterm xwd xfs xfsinfo xtrap xkbutils xkbcomp \
159484d9c625SLionel Sambuc	xkeyboard-config xinput xcb-util xorg-docs \
15959152e1c5SLionel Sambuc	font-adobe-100dpi font-adobe-75dpi font-adobe-utopia-100dpi \
15969152e1c5SLionel Sambuc	font-adobe-utopia-75dpi font-adobe-utopia-type1 \
15979152e1c5SLionel Sambuc	font-alias \
15989152e1c5SLionel Sambuc	font-bh-100dpi font-bh-75dpi font-bh-lucidatypewriter-100dpi \
15999152e1c5SLionel Sambuc	font-bh-lucidatypewriter-75dpi font-bh-ttf font-bh-type1 \
16009152e1c5SLionel Sambuc	font-bitstream-100dpi font-bitstream-75dpi font-bitstream-type1 \
16019152e1c5SLionel Sambuc	font-cursor-misc font-daewoo-misc font-dec-misc font-ibm-type1 \
16029152e1c5SLionel Sambuc	font-isas-misc font-jis-misc font-misc-misc font-mutt-misc \
16039152e1c5SLionel Sambuc	font-sony-misc font-util ttf-bitstream-vera encodings
16049152e1c5SLionel SambucX11SRCDIR.${_dir}?=		${X11SRCDIRMIT}/${_dir}/dist
16059152e1c5SLionel Sambuc.endfor
16069152e1c5SLionel Sambuc
16079152e1c5SLionel Sambuc.for _i in \
16089152e1c5SLionel Sambuc	elographics keyboard mouse synaptics vmmouse void ws
16099152e1c5SLionel SambucX11SRCDIR.xf86-input-${_i}?=	${X11SRCDIRMIT}/xf86-input-${_i}/dist
16109152e1c5SLionel Sambuc.endfor
16119152e1c5SLionel Sambuc
16129152e1c5SLionel Sambuc.for _v in \
16130a6a1f1dSLionel Sambuc	ag10e apm ark ast ati ati-kms chips cirrus crime \
16140a6a1f1dSLionel Sambuc	geode glint i128 i740 igs imstt intel intel-old mach64 mga \
16159152e1c5SLionel Sambuc	neomagic newport nsc nv nvxbox openchrome pnozz \
16169152e1c5SLionel Sambuc	r128 radeonhd rendition \
16179152e1c5SLionel Sambuc	s3 s3virge savage siliconmotion sis suncg14 \
16189152e1c5SLionel Sambuc	suncg6 sunffb sunleo suntcx \
16190a6a1f1dSLionel Sambuc	tdfx tga trident tseng vesa vga vmware wsfb xgi
16209152e1c5SLionel SambucX11SRCDIR.xf86-video-${_v}?=	${X11SRCDIRMIT}/xf86-video-${_v}/dist
16219152e1c5SLionel Sambuc.endfor
16229152e1c5SLionel Sambuc
16230a6a1f1dSLionel Sambuc# Only install the radeon firmware on DRM-happy systems.
16240a6a1f1dSLionel Sambuc.if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "i386"
16250a6a1f1dSLionel SambucMKRADEONFIRMWARE?=		yes
16269152e1c5SLionel Sambuc.endif
16270a6a1f1dSLionel SambucMKRADEONFIRMWARE?=		no
16289152e1c5SLionel Sambuc
16290a6a1f1dSLionel SambucX11DRI?=			yes
16309152e1c5SLionel SambucX11LOADABLE?=			yes
16319152e1c5SLionel Sambuc
16329152e1c5SLionel Sambuc
16339152e1c5SLionel Sambuc#
16349152e1c5SLionel Sambuc# Where extsrc sources are and where it is installed to.
16359152e1c5SLionel Sambuc#
16369152e1c5SLionel Sambuc.if !defined(EXTSRCSRCDIR)
16379152e1c5SLionel Sambuc.if exists(${NETBSDSRCDIR}/../extsrc)
16389152e1c5SLionel SambucEXTSRCSRCDIR!=		cd "${NETBSDSRCDIR}/../extsrc" && pwd
16399152e1c5SLionel Sambuc.else
16409152e1c5SLionel SambucEXTSRCSRCDIR=		/usr/extsrc
16419152e1c5SLionel Sambuc.endif
16429152e1c5SLionel Sambuc.endif # !defined(EXTSRCSRCDIR)
16439152e1c5SLionel Sambuc
16449152e1c5SLionel SambucEXTSRCROOTDIR?=		/usr/ext
16459152e1c5SLionel SambucEXTSRCBINDIR?=		${EXTSRCROOTDIR}/bin
16469152e1c5SLionel SambucEXTSRCETCDIR?=		/etc/ext
16479152e1c5SLionel SambucEXTSRCINCDIR?=		${EXTSRCROOTDIR}/include
16489152e1c5SLionel SambucEXTSRCLIBDIR?=		${EXTSRCROOTDIR}/lib/ext
16499152e1c5SLionel SambucEXTSRCMANDIR?=		${EXTSRCROOTDIR}/man
16509152e1c5SLionel SambucEXTSRCUSRLIBDIR?=	${EXTSRCROOTDIR}/lib
1651e1091647SArun Thomas
1652e1091647SArun Thomas#
1653e1091647SArun Thomas# MAKEDIRTARGET dir target [extra make(1) params]
16549152e1c5SLionel Sambuc#	run "cd $${dir} && ${MAKEDIRTARGETENV} ${MAKE} [params] $${target}", with a pretty message
1655e1091647SArun Thomas#
16569152e1c5SLionel SambucMAKEDIRTARGETENV?=
1657e1091647SArun ThomasMAKEDIRTARGET=\
1658e1091647SArun Thomas	@_makedirtarget() { \
1659e1091647SArun Thomas		dir="$$1"; shift; \
1660e1091647SArun Thomas		target="$$1"; shift; \
1661e1091647SArun Thomas		case "$${dir}" in \
1662e1091647SArun Thomas		/*)	this="$${dir}/"; \
1663e1091647SArun Thomas			real="$${dir}" ;; \
1664e1091647SArun Thomas		.)	this="${_THISDIR_}"; \
1665e1091647SArun Thomas			real="${.CURDIR}" ;; \
1666e1091647SArun Thomas		*)	this="${_THISDIR_}$${dir}/"; \
1667e1091647SArun Thomas			real="${.CURDIR}/$${dir}" ;; \
1668e1091647SArun Thomas		esac; \
1669e1091647SArun Thomas		show=$${this:-.}; \
1670e1091647SArun Thomas		echo "$${target} ===> $${show%/}$${1:+	(with: $$@)}"; \
1671e1091647SArun Thomas		cd "$${real}" \
16729152e1c5SLionel Sambuc		&& ${MAKEDIRTARGETENV} ${MAKE} _THISDIR_="$${this}" "$$@" $${target}; \
1673e1091647SArun Thomas	}; \
1674e1091647SArun Thomas	_makedirtarget
1675e1091647SArun Thomas
1676e1091647SArun Thomas#
1677e1091647SArun Thomas# MAKEVERBOSE support.  Levels are:
1678e1091647SArun Thomas#	0	Minimal output ("quiet")
1679e1091647SArun Thomas#	1	Describe what is occurring
1680e1091647SArun Thomas#	2	Describe what is occurring and echo the actual command
1681e1091647SArun Thomas#	3	Ignore the effect of the "@" prefix in make commands
1682e1091647SArun Thomas#	4	Trace shell commands using the shell's -x flag
1683e1091647SArun Thomas#
16849152e1c5SLionel SambucMAKEVERBOSE?=		2
1685e1091647SArun Thomas
1686e1091647SArun Thomas.if ${MAKEVERBOSE} == 0
1687e1091647SArun Thomas_MKMSG?=	@\#
1688e1091647SArun Thomas_MKSHMSG?=	: echo
1689e1091647SArun Thomas_MKSHECHO?=	: echo
1690e1091647SArun Thomas.SILENT:
1691e1091647SArun Thomas.elif ${MAKEVERBOSE} == 1
1692e1091647SArun Thomas_MKMSG?=	@echo '   '
1693e1091647SArun Thomas_MKSHMSG?=	echo '   '
1694e1091647SArun Thomas_MKSHECHO?=	: echo
1695e1091647SArun Thomas.SILENT:
1696e1091647SArun Thomas.else	# MAKEVERBOSE >= 2
1697e1091647SArun Thomas_MKMSG?=	@echo '\#  '
1698e1091647SArun Thomas_MKSHMSG?=	echo '\#  '
1699e1091647SArun Thomas_MKSHECHO?=	echo
1700e1091647SArun Thomas.SILENT: __makeverbose_dummy_target__
1701e1091647SArun Thomas.endif	# MAKEVERBOSE >= 2
1702e1091647SArun Thomas.if ${MAKEVERBOSE} >= 3
1703e1091647SArun Thomas.MAKEFLAGS:	-dl
1704e1091647SArun Thomas.endif	# ${MAKEVERBOSE} >= 3
1705e1091647SArun Thomas.if ${MAKEVERBOSE} >= 4
1706e1091647SArun Thomas.MAKEFLAGS:	-dx
1707e1091647SArun Thomas.endif	# ${MAKEVERBOSE} >= 4
1708e1091647SArun Thomas
1709e1091647SArun Thomas_MKMSG_BUILD?=		${_MKMSG} "  build "
1710e1091647SArun Thomas_MKMSG_CREATE?=		${_MKMSG} " create "
1711e1091647SArun Thomas_MKMSG_COMPILE?=	${_MKMSG} "compile "
1712e1091647SArun Thomas_MKMSG_FORMAT?=		${_MKMSG} " format "
1713e1091647SArun Thomas_MKMSG_INSTALL?=	${_MKMSG} "install "
1714e1091647SArun Thomas_MKMSG_LINK?=		${_MKMSG} "   link "
1715e1091647SArun Thomas_MKMSG_LEX?=		${_MKMSG} "    lex "
1716e1091647SArun Thomas_MKMSG_REMOVE?=		${_MKMSG} " remove "
1717e1091647SArun Thomas_MKMSG_YACC?=		${_MKMSG} "   yacc "
1718e1091647SArun Thomas
1719e1091647SArun Thomas_MKSHMSG_CREATE?=	${_MKSHMSG} " create "
1720e1091647SArun Thomas_MKSHMSG_INSTALL?=	${_MKSHMSG} "install "
1721e1091647SArun Thomas
1722e1091647SArun Thomas_MKTARGET_BUILD?=	${_MKMSG_BUILD} ${.CURDIR:T}/${.TARGET}
1723e1091647SArun Thomas_MKTARGET_CREATE?=	${_MKMSG_CREATE} ${.CURDIR:T}/${.TARGET}
1724e1091647SArun Thomas_MKTARGET_COMPILE?=	${_MKMSG_COMPILE} ${.CURDIR:T}/${.TARGET}
1725e1091647SArun Thomas_MKTARGET_FORMAT?=	${_MKMSG_FORMAT} ${.CURDIR:T}/${.TARGET}
1726e1091647SArun Thomas_MKTARGET_INSTALL?=	${_MKMSG_INSTALL} ${.TARGET}
1727e1091647SArun Thomas_MKTARGET_LINK?=	${_MKMSG_LINK} ${.CURDIR:T}/${.TARGET}
1728e1091647SArun Thomas_MKTARGET_LEX?=		${_MKMSG_LEX} ${.CURDIR:T}/${.TARGET}
1729e1091647SArun Thomas_MKTARGET_REMOVE?=	${_MKMSG_REMOVE} ${.TARGET}
1730e1091647SArun Thomas_MKTARGET_YACC?=	${_MKMSG_YACC} ${.CURDIR:T}/${.TARGET}
1731e1091647SArun Thomas
1732e1091647SArun Thomas.if ${MKMANDOC} == "yes"
1733e1091647SArun ThomasTARGETS+=	lintmanpages
1734e1091647SArun Thomas.endif
1735e1091647SArun Thomas
17360a6a1f1dSLionel SambucTESTSBASE=	/usr/tests${MLIBDIR:D/${MLIBDIR}}
17379152e1c5SLionel Sambuc
17389152e1c5SLionel Sambuc.endif	# !defined(_BSD_OWN_MK_)
1739