2019-10-15 21:08:49 +00:00
|
|
|
# $FreeBSD$
|
|
|
|
|
|
|
|
.if !targets(__<${_this:T}>__)
|
|
|
|
__<${_this:T}>__:
|
|
|
|
|
2019-10-31 20:37:19 +00:00
|
|
|
.if defined(_LIBCOMPAT)
|
2020-03-07 03:58:58 +00:00
|
|
|
COMPAT_ARCH?= ${TARGET_ARCH}
|
|
|
|
COMPAT_CPUTYPE?= ${CPUTYPE_${_LIBCOMPAT}}
|
2019-11-07 22:58:10 +00:00
|
|
|
.if (defined(WANT_COMPILER_TYPE) && ${WANT_COMPILER_TYPE} == gcc) || \
|
|
|
|
(defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc)
|
|
|
|
COMPAT_COMPILER_TYPE= gcc
|
|
|
|
.else
|
|
|
|
COMPAT_COMPILER_TYPE= clang
|
|
|
|
.endif
|
2019-10-31 20:37:19 +00:00
|
|
|
.else
|
|
|
|
COMPAT_ARCH= ${MACHINE_ARCH}
|
|
|
|
COMPAT_CPUTYPE= ${CPUTYPE}
|
2019-11-07 22:58:10 +00:00
|
|
|
.include <bsd.compiler.mk>
|
|
|
|
COMPAT_COMPILER_TYPE=${COMPILER_TYPE}
|
2019-10-31 20:37:19 +00:00
|
|
|
.endif
|
|
|
|
|
2019-10-15 21:08:49 +00:00
|
|
|
# -------------------------------------------------------------------
|
|
|
|
# 32 bit world
|
2019-10-31 20:37:19 +00:00
|
|
|
.if ${COMPAT_ARCH} == "amd64"
|
2019-10-15 21:27:06 +00:00
|
|
|
HAS_COMPAT=32
|
2019-10-31 20:37:19 +00:00
|
|
|
.if empty(COMPAT_CPUTYPE)
|
2019-10-15 21:08:49 +00:00
|
|
|
LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2
|
|
|
|
.else
|
2019-10-31 20:37:19 +00:00
|
|
|
LIB32CPUFLAGS= -march=${COMPAT_CPUTYPE}
|
2019-10-15 21:08:49 +00:00
|
|
|
.endif
|
2019-11-07 22:58:10 +00:00
|
|
|
.if ${COMPAT_COMPILER_TYPE} == gcc
|
2019-10-15 21:08:49 +00:00
|
|
|
.else
|
2022-05-03 11:09:38 +00:00
|
|
|
LIB32CPUFLAGS+= -target x86_64-unknown-freebsd${OS_REVISION}
|
2019-10-15 21:08:49 +00:00
|
|
|
.endif
|
|
|
|
LIB32CPUFLAGS+= -m32
|
2019-11-07 22:58:10 +00:00
|
|
|
LIB32_MACHINE= i386
|
|
|
|
LIB32_MACHINE_ARCH= i386
|
|
|
|
LIB32WMAKEENV= MACHINE_CPU="i686 mmx sse sse2"
|
2019-10-15 21:08:49 +00:00
|
|
|
LIB32WMAKEFLAGS= \
|
|
|
|
AS="${XAS} --32" \
|
2020-08-17 17:17:33 +00:00
|
|
|
LD="${XLD} -m elf_i386_fbsd"
|
2019-10-15 21:08:49 +00:00
|
|
|
|
2019-10-31 20:37:19 +00:00
|
|
|
.elif ${COMPAT_ARCH} == "powerpc64"
|
2019-10-15 21:27:06 +00:00
|
|
|
HAS_COMPAT=32
|
2019-10-31 20:37:19 +00:00
|
|
|
.if empty(COMPAT_CPUTYPE)
|
2019-10-15 21:08:49 +00:00
|
|
|
LIB32CPUFLAGS= -mcpu=powerpc
|
|
|
|
.else
|
2019-10-31 20:37:19 +00:00
|
|
|
LIB32CPUFLAGS= -mcpu=${COMPAT_CPUTYPE}
|
2019-10-15 21:08:49 +00:00
|
|
|
.endif
|
2019-12-24 16:03:33 +00:00
|
|
|
|
|
|
|
.if ${COMPAT_COMPILER_TYPE} == "gcc"
|
2019-10-15 21:08:49 +00:00
|
|
|
LIB32CPUFLAGS+= -m32
|
2019-12-24 16:03:33 +00:00
|
|
|
.else
|
2022-05-03 11:09:38 +00:00
|
|
|
LIB32CPUFLAGS+= -target powerpc-unknown-freebsd${OS_REVISION}
|
2019-12-24 16:03:33 +00:00
|
|
|
.endif
|
|
|
|
|
2019-11-07 22:58:10 +00:00
|
|
|
LIB32_MACHINE= powerpc
|
|
|
|
LIB32_MACHINE_ARCH= powerpc
|
2020-03-27 18:20:36 +00:00
|
|
|
LIB32WMAKEFLAGS= \
|
|
|
|
LD="${XLD} -m elf32ppc_fbsd"
|
2019-10-15 21:08:49 +00:00
|
|
|
.endif
|
|
|
|
|
|
|
|
LIB32WMAKEFLAGS+= NM="${XNM}"
|
|
|
|
LIB32WMAKEFLAGS+= OBJCOPY="${XOBJCOPY}"
|
|
|
|
|
|
|
|
LIB32CFLAGS= -DCOMPAT_32BIT
|
|
|
|
LIB32DTRACE= ${DTRACE} -32
|
|
|
|
LIB32WMAKEFLAGS+= -DCOMPAT_32BIT
|
2022-10-05 16:26:30 +00:00
|
|
|
LIB32_MACHINE_ABI= ${MACHINE_ABI:N*64} long32 ptr32
|
|
|
|
.if ${COMPAT_ARCH} == "amd64"
|
|
|
|
LIB32_MACHINE_ABI+= time32
|
|
|
|
.else
|
|
|
|
LIB32_MACHINE_ABI+= time64
|
|
|
|
.endif
|
2019-10-15 21:08:49 +00:00
|
|
|
|
2019-10-15 21:27:06 +00:00
|
|
|
# -------------------------------------------------------------------
|
|
|
|
# In the program linking case, select LIBCOMPAT
|
|
|
|
.if defined(NEED_COMPAT)
|
|
|
|
.ifndef HAS_COMPAT
|
2022-02-04 23:57:28 +00:00
|
|
|
.warning NEED_COMPAT defined, but no LIBCOMPAT is available (COMPAT_ARCH == ${COMPAT_ARCH})
|
2019-10-15 21:27:06 +00:00
|
|
|
.elif !${HAS_COMPAT:M${NEED_COMPAT}} && ${NEED_COMPAT} != "any"
|
2022-02-04 23:57:28 +00:00
|
|
|
.error NEED_COMPAT (${NEED_COMPAT}) defined, but not in HAS_COMPAT (${HAS_COMPAT})
|
2019-10-15 21:27:06 +00:00
|
|
|
.elif ${NEED_COMPAT} == "any"
|
|
|
|
.endif
|
|
|
|
.ifdef WANT_COMPAT
|
|
|
|
.error Both WANT_COMPAT and NEED_COMPAT defined
|
|
|
|
.endif
|
|
|
|
WANT_COMPAT:= ${NEED_COMPAT}
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if defined(HAS_COMPAT) && defined(WANT_COMPAT)
|
|
|
|
.if ${WANT_COMPAT} == "any"
|
|
|
|
_LIBCOMPAT:= ${HAS_COMPAT:[1]}
|
|
|
|
.else
|
|
|
|
_LIBCOMPAT:= ${WANT_COMPAT}
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
2019-10-15 21:08:49 +00:00
|
|
|
# -------------------------------------------------------------------
|
|
|
|
# Generic code for each type.
|
|
|
|
# Set defaults based on type.
|
2019-10-15 21:11:22 +00:00
|
|
|
libcompat= ${_LIBCOMPAT:tl}
|
2019-11-07 22:58:10 +00:00
|
|
|
_LIBCOMPAT_MAKEVARS= _OBJTOP TMP CPUFLAGS CFLAGS CXXFLAGS LDFLAGS \
|
2022-10-05 16:26:30 +00:00
|
|
|
_MACHINE _MACHINE_ARCH _MACHINE_ABI \
|
2022-07-01 07:33:16 +00:00
|
|
|
WMAKEENV WMAKEFLAGS WMAKE WORLDTMP
|
2019-10-15 21:08:49 +00:00
|
|
|
.for _var in ${_LIBCOMPAT_MAKEVARS}
|
2019-10-15 21:11:22 +00:00
|
|
|
.if !empty(LIB${_LIBCOMPAT}${_var})
|
|
|
|
LIBCOMPAT${_var}?= ${LIB${_LIBCOMPAT}${_var}}
|
2019-10-15 21:08:49 +00:00
|
|
|
.endif
|
|
|
|
.endfor
|
|
|
|
|
2022-07-01 07:33:16 +00:00
|
|
|
WORLDTMP?= ${SYSROOT}
|
|
|
|
|
2019-10-15 21:08:49 +00:00
|
|
|
# Shared flags
|
|
|
|
LIBCOMPAT_OBJTOP?= ${OBJTOP}/obj-lib${libcompat}
|
|
|
|
|
|
|
|
LIBCOMPATCFLAGS+= ${LIBCOMPATCPUFLAGS} \
|
2022-07-01 07:33:16 +00:00
|
|
|
--sysroot=${WORLDTMP} \
|
2019-10-15 21:08:49 +00:00
|
|
|
${BFLAGS}
|
|
|
|
|
2022-07-01 07:33:16 +00:00
|
|
|
LIBCOMPATLDFLAGS+= -L${WORLDTMP}/usr/lib${libcompat}
|
2020-08-17 17:17:33 +00:00
|
|
|
|
2019-11-07 22:58:10 +00:00
|
|
|
LIBCOMPATWMAKEENV+= MACHINE=${LIBCOMPAT_MACHINE}
|
|
|
|
LIBCOMPATWMAKEENV+= MACHINE_ARCH=${LIBCOMPAT_MACHINE_ARCH}
|
|
|
|
|
2022-01-07 05:34:15 +00:00
|
|
|
# -B is needed to find /usr/lib32/crti.o for gcc.
|
2022-07-01 07:33:16 +00:00
|
|
|
LIBCOMPATCFLAGS+= -B${WORLDTMP}/usr/lib${libcompat}
|
2019-10-15 21:08:49 +00:00
|
|
|
|
2019-10-15 21:27:06 +00:00
|
|
|
.if defined(WANT_COMPAT)
|
|
|
|
LIBDIR_BASE:= /usr/lib${libcompat}
|
2022-08-11 22:17:52 +00:00
|
|
|
LIBDATADIR:= /usr/lib${libcompat}
|
2019-10-15 21:27:06 +00:00
|
|
|
_LIB_OBJTOP= ${LIBCOMPAT_OBJTOP}
|
|
|
|
CFLAGS+= ${LIBCOMPATCFLAGS}
|
2019-11-07 22:58:10 +00:00
|
|
|
LDFLAGS+= ${CFLAGS} ${LIBCOMPATLDFLAGS}
|
|
|
|
MACHINE= ${LIBCOMPAT_MACHINE}
|
|
|
|
MACHINE_ARCH= ${LIBCOMPAT_MACHINE_ARCH}
|
2019-10-15 21:27:06 +00:00
|
|
|
.endif
|
|
|
|
|
2019-10-15 21:08:49 +00:00
|
|
|
.endif
|