diff options
author | Brooks Davis <brooks@FreeBSD.org> | 2019-11-07 22:58:10 +0000 |
---|---|---|
committer | Brooks Davis <brooks@FreeBSD.org> | 2019-11-07 22:58:10 +0000 |
commit | a4330302f22d45d4158204b2d5d7c6738100f3a5 (patch) | |
tree | 9cb152bfad3e48051a626a02a237af9104e6929c /share/mk/bsd.compat.mk | |
parent | 273b2e4c55f5de86ed5d2fea0a00677f944cbd9d (diff) | |
download | src-test2-a4330302f22d45d4158204b2d5d7c6738100f3a5.tar.gz src-test2-a4330302f22d45d4158204b2d5d7c6738100f3a5.zip |
Notes
Diffstat (limited to 'share/mk/bsd.compat.mk')
-rw-r--r-- | share/mk/bsd.compat.mk | 45 |
1 files changed, 32 insertions, 13 deletions
diff --git a/share/mk/bsd.compat.mk b/share/mk/bsd.compat.mk index 4d6c8aac56f1..c50cd79c306c 100644 --- a/share/mk/bsd.compat.mk +++ b/share/mk/bsd.compat.mk @@ -6,9 +6,17 @@ __<${_this:T}>__: .if defined(_LIBCOMPAT) COMPAT_ARCH= ${TARGET_ARCH} COMPAT_CPUTYPE= ${TARGET_CPUTYPE} +.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 .else COMPAT_ARCH= ${MACHINE_ARCH} COMPAT_CPUTYPE= ${CPUTYPE} +.include <bsd.compiler.mk> +COMPAT_COMPILER_TYPE=${COMPILER_TYPE} .endif # ------------------------------------------------------------------- @@ -20,14 +28,14 @@ LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2 .else LIB32CPUFLAGS= -march=${COMPAT_CPUTYPE} .endif -.if (defined(WANT_COMPILER_TYPE) && ${WANT_COMPILER_TYPE} == gcc) || \ - (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc) +.if ${COMPAT_COMPILER_TYPE} == gcc .else LIB32CPUFLAGS+= -target x86_64-unknown-freebsd13.0 .endif LIB32CPUFLAGS+= -m32 -LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \ - MACHINE_CPU="i686 mmx sse sse2" +LIB32_MACHINE= i386 +LIB32_MACHINE_ARCH= i386 +LIB32WMAKEENV= MACHINE_CPU="i686 mmx sse sse2" LIB32WMAKEFLAGS= \ AS="${XAS} --32" \ LD="${XLD} -m elf_i386_fbsd -L${LIBCOMPATTMP}/usr/lib32" @@ -40,14 +48,14 @@ LIB32CPUFLAGS= -mcpu=powerpc LIB32CPUFLAGS= -mcpu=${COMPAT_CPUTYPE} .endif LIB32CPUFLAGS+= -m32 -LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc +LIB32_MACHINE= powerpc +LIB32_MACHINE_ARCH= powerpc LIB32WMAKEFLAGS= \ LD="${XLD} -m elf32ppc_fbsd" .elif ${COMPAT_ARCH:Mmips64*} != "" HAS_COMPAT=32 -.if (defined(WANT_COMPILER_TYPE) && ${WANT_COMPILER_TYPE} == gcc) || \ - (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc) +.if ${COMPAT_COMPILER_TYPE} == gcc .if empty(COMPAT_CPUTYPE) LIB32CPUFLAGS= -march=mips3 .else @@ -61,12 +69,15 @@ LIB32CPUFLAGS= -target mips-unknown-freebsd13.0 .endif .endif LIB32CPUFLAGS+= -mabi=32 -LIB32WMAKEENV= MACHINE=mips MACHINE_ARCH=mips +LIB32_MACHINE= mips +LIB32_MACHINE_ARCH= mips .if ${COMPAT_ARCH:Mmips64el*} != "" -LIB32WMAKEFLAGS= LD="${XLD} -m elf32ltsmip_fbsd" +_EMULATION= elf32ltsmip_fbsd .else -LIB32WMAKEFLAGS= LD="${XLD} -m elf32btsmip_fbsd" +_EMULATION= elf32btsmip_fbsd .endif +LIB32WMAKEFLAGS= LD="${XLD} -m ${_EMULATION}" +LIB32LDFLAGS= -Wl,-m${_EMULATION} .endif LIB32WMAKEFLAGS+= NM="${XNM}" @@ -82,7 +93,9 @@ LIB32WMAKEFLAGS+= -DCOMPAT_32BIT HAS_COMPAT=SOFT LIBSOFTCFLAGS= -DCOMPAT_SOFTFP LIBSOFTCPUFLAGS= -mfloat-abi=softfp -LIBSOFTWMAKEENV= CPUTYPE=soft MACHINE=arm MACHINE_ARCH=${COMPAT_ARCH} +LIBSOFT_MACHINE= arm +LIBSOFT_MACHINE_ARCH= ${COMPAT_ARCH} +LIBSOFTWMAKEENV= CPUTYPE=soft LIBSOFTWMAKEFLAGS= -DCOMPAT_SOFTFP .endif @@ -114,8 +127,8 @@ _LIBCOMPAT:= ${WANT_COMPAT} # Generic code for each type. # Set defaults based on type. libcompat= ${_LIBCOMPAT:tl} -_LIBCOMPAT_MAKEVARS= _OBJTOP TMP CPUFLAGS CFLAGS CXXFLAGS WMAKEENV \ - WMAKEFLAGS WMAKE +_LIBCOMPAT_MAKEVARS= _OBJTOP TMP CPUFLAGS CFLAGS CXXFLAGS LDFLAGS \ + _MACHINE _MACHINE_ARCH WMAKEENV WMAKEFLAGS WMAKE .for _var in ${_LIBCOMPAT_MAKEVARS} .if !empty(LIB${_LIBCOMPAT}${_var}) LIBCOMPAT${_var}?= ${LIB${_LIBCOMPAT}${_var}} @@ -131,6 +144,9 @@ LIBCOMPATCFLAGS+= ${LIBCOMPATCPUFLAGS} \ --sysroot=${LIBCOMPATTMP} \ ${BFLAGS} +LIBCOMPATWMAKEENV+= MACHINE=${LIBCOMPAT_MACHINE} +LIBCOMPATWMAKEENV+= MACHINE_ARCH=${LIBCOMPAT_MACHINE_ARCH} + # -B is needed to find /usr/lib32/crti.o for GCC and /usr/libsoft/crti.o for # Clang/GCC. LIBCOMPATCFLAGS+= -B${LIBCOMPATTMP}/usr/lib${libcompat} @@ -139,6 +155,9 @@ LIBCOMPATCFLAGS+= -B${LIBCOMPATTMP}/usr/lib${libcompat} LIBDIR_BASE:= /usr/lib${libcompat} _LIB_OBJTOP= ${LIBCOMPAT_OBJTOP} CFLAGS+= ${LIBCOMPATCFLAGS} +LDFLAGS+= ${CFLAGS} ${LIBCOMPATLDFLAGS} +MACHINE= ${LIBCOMPAT_MACHINE} +MACHINE_ARCH= ${LIBCOMPAT_MACHINE_ARCH} .endif .endif |