2016-03-11 23:56:33 +00:00
|
|
|
# $FreeBSD$
|
|
|
|
|
|
|
|
.if !targets(__<${_this:T}>__)
|
|
|
|
__<${_this:T}>__:
|
|
|
|
|
|
|
|
# Makefile for the compatibility libraries.
|
2017-01-06 23:30:54 +00:00
|
|
|
# - 32-bit compat libraries on MIPS, PowerPC, and AMD64.
|
2016-03-11 23:56:33 +00:00
|
|
|
|
|
|
|
# -------------------------------------------------------------------
|
|
|
|
# 32 bit world
|
|
|
|
.if ${TARGET_ARCH} == "amd64"
|
|
|
|
.if empty(TARGET_CPUTYPE)
|
|
|
|
LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2
|
|
|
|
.else
|
|
|
|
LIB32CPUFLAGS= -march=${TARGET_CPUTYPE}
|
|
|
|
.endif
|
2018-08-23 18:19:10 +00:00
|
|
|
.if ${WANT_COMPILER_TYPE} == gcc || \
|
|
|
|
(defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc)
|
|
|
|
.else
|
2018-11-12 16:55:20 +00:00
|
|
|
LIB32CPUFLAGS+= -target x86_64-unknown-freebsd13.0
|
2018-08-23 18:19:10 +00:00
|
|
|
.endif
|
2017-01-06 23:20:59 +00:00
|
|
|
LIB32CPUFLAGS+= -m32
|
2016-03-11 23:56:33 +00:00
|
|
|
LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \
|
|
|
|
MACHINE_CPU="i686 mmx sse sse2"
|
2016-05-29 06:20:15 +00:00
|
|
|
LIB32WMAKEFLAGS= \
|
2016-03-11 23:56:33 +00:00
|
|
|
AS="${XAS} --32" \
|
2016-06-09 17:03:03 +00:00
|
|
|
LD="${XLD} -m elf_i386_fbsd -L${LIBCOMPATTMP}/usr/lib32" \
|
2016-03-11 23:56:33 +00:00
|
|
|
OBJCOPY="${XOBJCOPY}"
|
|
|
|
|
|
|
|
.elif ${TARGET_ARCH} == "powerpc64"
|
|
|
|
.if empty(TARGET_CPUTYPE)
|
|
|
|
LIB32CPUFLAGS= -mcpu=powerpc
|
|
|
|
.else
|
|
|
|
LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE}
|
|
|
|
.endif
|
2017-01-06 23:20:59 +00:00
|
|
|
LIB32CPUFLAGS+= -m32
|
2016-03-11 23:56:33 +00:00
|
|
|
LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc
|
2016-05-29 06:20:15 +00:00
|
|
|
LIB32WMAKEFLAGS= \
|
2016-03-11 23:56:33 +00:00
|
|
|
LD="${XLD} -m elf32ppc_fbsd" \
|
|
|
|
OBJCOPY="${XOBJCOPY}"
|
2017-01-06 23:30:54 +00:00
|
|
|
|
|
|
|
.elif ${TARGET_ARCH:Mmips64*} != ""
|
2018-01-16 01:05:04 +00:00
|
|
|
.if ${WANT_COMPILER_TYPE} == gcc || \
|
|
|
|
(defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc)
|
2017-01-06 23:30:54 +00:00
|
|
|
.if empty(TARGET_CPUTYPE)
|
|
|
|
LIB32CPUFLAGS= -march=mips3
|
|
|
|
.else
|
|
|
|
LIB32CPUFLAGS= -march=${TARGET_CPUTYPE}
|
|
|
|
.endif
|
2018-01-16 01:05:04 +00:00
|
|
|
.else
|
|
|
|
.if ${TARGET_ARCH:Mmips64el*} != ""
|
2018-11-12 16:55:20 +00:00
|
|
|
LIB32CPUFLAGS= -target mipsel-unknown-freebsd13.0
|
2018-01-16 01:05:04 +00:00
|
|
|
.else
|
2018-11-12 16:55:20 +00:00
|
|
|
LIB32CPUFLAGS= -target mips-unknown-freebsd13.0
|
2018-01-16 01:05:04 +00:00
|
|
|
.endif
|
2018-01-11 19:24:44 +00:00
|
|
|
.endif
|
2017-01-06 23:30:54 +00:00
|
|
|
LIB32CPUFLAGS+= -mabi=32
|
|
|
|
LIB32WMAKEENV= MACHINE=mips MACHINE_ARCH=mips
|
|
|
|
.if ${TARGET_ARCH:Mmips64el*} != ""
|
|
|
|
LIB32WMAKEFLAGS= LD="${XLD} -m elf32ltsmip_fbsd"
|
|
|
|
.else
|
|
|
|
LIB32WMAKEFLAGS= LD="${XLD} -m elf32btsmip_fbsd"
|
|
|
|
.endif
|
|
|
|
LIB32WMAKEFLAGS+= OBJCOPY="${XOBJCOPY}"
|
2016-03-11 23:56:33 +00:00
|
|
|
.endif
|
|
|
|
|
2017-01-27 03:43:18 +00:00
|
|
|
LIB32WMAKEFLAGS+= NM="${XNM}"
|
|
|
|
|
2016-03-11 23:56:33 +00:00
|
|
|
|
2017-01-06 23:20:59 +00:00
|
|
|
LIB32CFLAGS= -DCOMPAT_32BIT
|
2016-03-11 23:56:33 +00:00
|
|
|
LIB32DTRACE= ${DTRACE} -32
|
|
|
|
LIB32WMAKEFLAGS+= -DCOMPAT_32BIT
|
|
|
|
|
2016-03-12 23:25:05 +00:00
|
|
|
# -------------------------------------------------------------------
|
|
|
|
# soft-fp world
|
2017-10-05 23:01:33 +00:00
|
|
|
.if ${TARGET_ARCH:Marmv[67]*} != ""
|
2016-03-12 23:25:05 +00:00
|
|
|
LIBSOFTCFLAGS= -DCOMPAT_SOFTFP
|
|
|
|
LIBSOFTCPUFLAGS= -mfloat-abi=softfp
|
2017-10-05 23:01:33 +00:00
|
|
|
LIBSOFTWMAKEENV= CPUTYPE=soft MACHINE=arm MACHINE_ARCH=${TARGET_ARCH}
|
2016-03-12 23:25:05 +00:00
|
|
|
LIBSOFTWMAKEFLAGS= -DCOMPAT_SOFTFP
|
|
|
|
.endif
|
|
|
|
|
2016-03-11 23:56:33 +00:00
|
|
|
# -------------------------------------------------------------------
|
|
|
|
# Generic code for each type.
|
|
|
|
# Set defaults based on type.
|
|
|
|
libcompat= ${LIBCOMPAT:tl}
|
2017-11-01 21:22:05 +00:00
|
|
|
_LIBCOMPAT_MAKEVARS= _OBJTOP TMP CPUFLAGS CFLAGS CXXFLAGS WMAKEENV \
|
2016-03-25 19:12:44 +00:00
|
|
|
WMAKEFLAGS WMAKE
|
2016-03-11 23:56:33 +00:00
|
|
|
.for _var in ${_LIBCOMPAT_MAKEVARS}
|
|
|
|
.if !empty(LIB${LIBCOMPAT}${_var})
|
|
|
|
LIBCOMPAT${_var}?= ${LIB${LIBCOMPAT}${_var}}
|
|
|
|
.endif
|
|
|
|
.endfor
|
|
|
|
|
|
|
|
# Shared flags
|
2017-11-01 21:22:05 +00:00
|
|
|
LIBCOMPAT_OBJTOP?= ${OBJTOP}/obj-lib${libcompat}
|
|
|
|
LIBCOMPATTMP?= ${LIBCOMPAT_OBJTOP}/tmp
|
2016-03-11 23:56:33 +00:00
|
|
|
|
|
|
|
LIBCOMPATCFLAGS+= ${LIBCOMPATCPUFLAGS} \
|
|
|
|
-L${LIBCOMPATTMP}/usr/lib${libcompat} \
|
2016-03-25 19:12:44 +00:00
|
|
|
--sysroot=${LIBCOMPATTMP} \
|
|
|
|
${BFLAGS}
|
2016-03-25 19:12:38 +00:00
|
|
|
|
|
|
|
# -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}
|
2016-06-15 23:58:03 +00:00
|
|
|
|
2016-03-11 23:56:33 +00:00
|
|
|
# Yes, the flags are redundant.
|
2017-11-01 21:22:05 +00:00
|
|
|
LIBCOMPATWMAKEENV+= \
|
2016-03-11 23:56:33 +00:00
|
|
|
INSTALL="sh ${.CURDIR}/tools/install.sh" \
|
|
|
|
PATH=${TMPPATH} \
|
2017-06-19 18:08:20 +00:00
|
|
|
SYSROOT=${LIBCOMPATTMP} \
|
2016-03-11 23:56:33 +00:00
|
|
|
LIBDIR=/usr/lib${libcompat} \
|
|
|
|
SHLIBDIR=/usr/lib${libcompat} \
|
|
|
|
DTRACE="${LIB$COMPATDTRACE:U${DTRACE}}"
|
2016-04-14 21:06:10 +00:00
|
|
|
.if ${MK_META_MODE} != "no"
|
|
|
|
# Don't rebuild build-tools targets during normal build.
|
2017-04-06 18:21:59 +00:00
|
|
|
LIBCOMPATWMAKEENV+= BUILD_TOOLS_META=.NOMETA
|
2016-04-14 21:06:10 +00:00
|
|
|
.endif
|
2016-05-29 06:20:15 +00:00
|
|
|
LIBCOMPATWMAKEFLAGS+= CC="${XCC} ${LIBCOMPATCFLAGS}" \
|
2016-05-29 06:20:36 +00:00
|
|
|
CXX="${XCXX} ${LIBCOMPATCXXFLAGS} ${LIBCOMPATCFLAGS}" \
|
2016-05-29 06:20:15 +00:00
|
|
|
CPP="${XCPP} ${LIBCOMPATCFLAGS}" \
|
2016-03-11 23:56:33 +00:00
|
|
|
DESTDIR=${LIBCOMPATTMP} \
|
|
|
|
-DNO_CPU_CFLAGS \
|
|
|
|
MK_CTF=no \
|
|
|
|
-DNO_LINT \
|
|
|
|
MK_TESTS=no
|
|
|
|
LIBCOMPATWMAKE+= ${LIBCOMPATWMAKEENV} ${MAKE} ${LIBCOMPATWMAKEFLAGS} \
|
2017-11-05 00:11:47 +00:00
|
|
|
OBJTOP=${LIBCOMPAT_OBJTOP} \
|
|
|
|
OBJROOT='$${OBJTOP}/' \
|
2017-11-05 00:11:51 +00:00
|
|
|
MAKEOBJDIRPREFIX= \
|
2016-03-11 23:56:33 +00:00
|
|
|
MK_MAN=no MK_HTML=no
|
2016-04-05 21:12:03 +00:00
|
|
|
LIBCOMPATIMAKE+= ${LIBCOMPATWMAKE:NINSTALL=*:NDESTDIR=*} \
|
2018-08-03 18:52:51 +00:00
|
|
|
${IMAKE_INSTALL} \
|
2016-03-25 19:12:13 +00:00
|
|
|
-DLIBRARIES_ONLY
|
2016-03-11 23:56:33 +00:00
|
|
|
|
2018-07-30 14:28:00 +00:00
|
|
|
_LC_LIBDIRS.yes= lib
|
2018-07-30 14:42:59 +00:00
|
|
|
_LC_LIBDIRS.yes+= gnu/lib
|
2019-06-29 17:01:56 +00:00
|
|
|
_LC_LIBDIRS.yes+= usr.bin/lex/lib
|
2016-03-12 18:41:27 +00:00
|
|
|
_LC_LIBDIRS.${MK_CDDL:tl}+= cddl/lib
|
|
|
|
_LC_LIBDIRS.${MK_CRYPT:tl}+= secure/lib
|
|
|
|
_LC_LIBDIRS.${MK_KERBEROS:tl}+= kerberos5/lib
|
2016-03-11 23:56:33 +00:00
|
|
|
|
2016-03-25 19:12:38 +00:00
|
|
|
_LC_INCDIRS= \
|
|
|
|
include \
|
|
|
|
lib/ncurses/ncursesw \
|
|
|
|
${_LC_LIBDIRS.yes}
|
|
|
|
|
2018-06-15 17:03:57 +00:00
|
|
|
.if ${MK_FILE} != "no"
|
|
|
|
_libmagic= lib/libmagic
|
|
|
|
.endif
|
2018-06-15 16:48:09 +00:00
|
|
|
.if ${MK_PMC} != "no" && ${TARGET_ARCH} == "amd64"
|
|
|
|
_jevents= lib/libpmc/pmu-events
|
|
|
|
.endif
|
|
|
|
|
|
|
|
|
2016-03-11 23:56:33 +00:00
|
|
|
# Shared logic
|
|
|
|
build${libcompat}: .PHONY
|
|
|
|
@echo
|
|
|
|
@echo "--------------------------------------------------------------"
|
|
|
|
@echo ">>> stage 5.1: building lib${libcompat} shim libraries"
|
|
|
|
@echo "--------------------------------------------------------------"
|
2017-10-29 01:21:02 +00:00
|
|
|
.if !defined(NO_CLEAN)
|
|
|
|
rm -rf ${LIBCOMPATTMP}
|
|
|
|
.else
|
2018-06-20 17:20:39 +00:00
|
|
|
${_+_}@if [ -e "${LIBCOMPATTMP}" ]; then \
|
|
|
|
echo ">>> Deleting stale files in build${libcompat} tree..."; \
|
|
|
|
cd ${.CURDIR}; ${WMAKE} -DBATCH_DELETE_OLD_FILES \
|
|
|
|
DESTDIR=${LIBCOMPATTMP} \
|
|
|
|
delete-old delete-old-libs >/dev/null; \
|
|
|
|
fi
|
2017-10-29 01:21:02 +00:00
|
|
|
.endif # !defined(NO_CLEAN)
|
|
|
|
|
2016-03-11 23:56:33 +00:00
|
|
|
mkdir -p ${LIBCOMPATTMP}/usr/include
|
2018-06-29 21:15:26 +00:00
|
|
|
${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
|
2016-03-11 23:56:33 +00:00
|
|
|
-p ${LIBCOMPATTMP}/usr >/dev/null
|
2018-06-29 21:15:26 +00:00
|
|
|
${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.include.dist \
|
2016-03-11 23:56:33 +00:00
|
|
|
-p ${LIBCOMPATTMP}/usr/include >/dev/null
|
2018-06-29 21:15:26 +00:00
|
|
|
${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \
|
2016-03-11 23:56:33 +00:00
|
|
|
-p ${LIBCOMPATTMP}/usr >/dev/null
|
|
|
|
.if ${MK_DEBUG_FILES} != "no"
|
2018-06-29 21:15:26 +00:00
|
|
|
${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
|
2016-03-11 23:56:33 +00:00
|
|
|
-p ${LIBCOMPATTMP}/usr/lib >/dev/null
|
2018-06-29 21:15:26 +00:00
|
|
|
${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \
|
2016-03-11 23:56:33 +00:00
|
|
|
-p ${LIBCOMPATTMP}/usr/lib/debug/usr >/dev/null
|
|
|
|
.endif
|
|
|
|
mkdir -p ${WORLDTMP}
|
|
|
|
ln -sf ${.CURDIR}/sys ${WORLDTMP}
|
2017-05-09 20:21:38 +00:00
|
|
|
.for _t in ${_obj} includes
|
2016-03-25 19:12:38 +00:00
|
|
|
.for _dir in ${_LC_INCDIRS}
|
2016-03-31 17:27:14 +00:00
|
|
|
${_+_}cd ${.CURDIR}/${_dir}; ${LIBCOMPATWMAKE} MK_INCLUDES=yes \
|
|
|
|
DIRPRFX=${_dir}/ ${_t}
|
2016-03-11 23:56:33 +00:00
|
|
|
.endfor
|
|
|
|
.endfor
|
2018-06-15 17:03:57 +00:00
|
|
|
.for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw ${_libmagic} ${_jevents}
|
2018-06-15 18:50:24 +00:00
|
|
|
.for _t in ${_obj} build-tools
|
2016-03-11 23:56:33 +00:00
|
|
|
${_+_}cd ${.CURDIR}/${_dir}; \
|
|
|
|
WORLDTMP=${WORLDTMP} \
|
|
|
|
MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
|
2017-11-05 00:11:47 +00:00
|
|
|
${MAKE} SSP_CFLAGS= DESTDIR= \
|
2017-11-02 18:08:36 +00:00
|
|
|
OBJTOP=${LIBCOMPAT_OBJTOP} \
|
|
|
|
OBJROOT='$${OBJTOP}/' \
|
2017-11-05 00:11:51 +00:00
|
|
|
MAKEOBJDIRPREFIX= \
|
2018-11-03 19:31:11 +00:00
|
|
|
DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS \
|
|
|
|
MK_CTF=no MK_RETPOLINE=no MK_WARNS=no \
|
2018-06-15 18:50:24 +00:00
|
|
|
${_t}
|
|
|
|
.endfor
|
2016-03-11 23:56:33 +00:00
|
|
|
.endfor
|
|
|
|
${_+_}cd ${.CURDIR}; \
|
|
|
|
${LIBCOMPATWMAKE} -f Makefile.inc1 -DNO_FSCHG libraries
|
2017-09-30 21:00:08 +00:00
|
|
|
.if ${libcompat} == "32"
|
2017-05-09 20:21:38 +00:00
|
|
|
.for _t in ${_obj} all
|
2017-09-30 21:00:08 +00:00
|
|
|
.if !defined(NO_RTLD)
|
2016-03-11 23:56:33 +00:00
|
|
|
${_+_}cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIBCOMPATWMAKE} \
|
|
|
|
-DNO_FSCHG DIRPRFX=libexec/rtld-elf/ ${_t}
|
2017-09-30 21:00:08 +00:00
|
|
|
.endif
|
2016-03-11 23:56:33 +00:00
|
|
|
${_+_}cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIBCOMPATWMAKE} \
|
|
|
|
DIRPRFX=usr.bin/ldd ${_t}
|
|
|
|
.endfor
|
|
|
|
.endif
|
|
|
|
|
|
|
|
distribute${libcompat} install${libcompat}: .PHONY
|
|
|
|
.for _dir in ${_LC_LIBDIRS.yes}
|
|
|
|
${_+_}cd ${.CURDIR}/${_dir}; ${LIBCOMPATIMAKE} ${.TARGET:S/${libcompat}$//}
|
|
|
|
.endfor
|
2017-09-30 21:00:08 +00:00
|
|
|
.if ${libcompat} == "32"
|
|
|
|
.if !defined(NO_RTLD)
|
2016-03-11 23:56:33 +00:00
|
|
|
${_+_}cd ${.CURDIR}/libexec/rtld-elf; \
|
|
|
|
PROG=ld-elf32.so.1 ${LIBCOMPATIMAKE} ${.TARGET:S/32$//}
|
2017-09-30 21:00:08 +00:00
|
|
|
.endif
|
2016-03-11 23:56:33 +00:00
|
|
|
${_+_}cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIBCOMPATIMAKE} \
|
|
|
|
${.TARGET:S/32$//}
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.endif
|