2016-03-12 00:56:33 +01:00
|
|
|
# $FreeBSD$
|
|
|
|
|
|
|
|
.if !targets(__<${_this:T}>__)
|
|
|
|
__<${_this:T}>__:
|
|
|
|
|
|
|
|
# Makefile for the compatibility libraries.
|
2017-01-07 00:30:54 +01:00
|
|
|
# - 32-bit compat libraries on MIPS, PowerPC, and AMD64.
|
2016-03-12 00:56:33 +01:00
|
|
|
|
|
|
|
# -------------------------------------------------------------------
|
|
|
|
# 32 bit world
|
|
|
|
.if ${TARGET_ARCH} == "amd64"
|
|
|
|
.if empty(TARGET_CPUTYPE)
|
|
|
|
LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2
|
|
|
|
.else
|
|
|
|
LIB32CPUFLAGS= -march=${TARGET_CPUTYPE}
|
|
|
|
.endif
|
2017-01-07 00:20:59 +01:00
|
|
|
LIB32CPUFLAGS+= -m32
|
2016-03-12 00:56:33 +01:00
|
|
|
LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \
|
|
|
|
MACHINE_CPU="i686 mmx sse sse2"
|
2016-05-29 08:20:15 +02:00
|
|
|
LIB32WMAKEFLAGS= \
|
2016-03-12 00:56:33 +01:00
|
|
|
AS="${XAS} --32" \
|
2016-06-09 19:03:03 +02:00
|
|
|
LD="${XLD} -m elf_i386_fbsd -L${LIBCOMPATTMP}/usr/lib32" \
|
2016-03-12 00:56:33 +01:00
|
|
|
OBJCOPY="${XOBJCOPY}"
|
|
|
|
|
|
|
|
.elif ${TARGET_ARCH} == "powerpc64"
|
|
|
|
.if empty(TARGET_CPUTYPE)
|
|
|
|
LIB32CPUFLAGS= -mcpu=powerpc
|
|
|
|
.else
|
|
|
|
LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE}
|
|
|
|
.endif
|
2017-01-07 00:20:59 +01:00
|
|
|
LIB32CPUFLAGS+= -m32
|
2016-03-12 00:56:33 +01:00
|
|
|
LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc
|
2016-05-29 08:20:15 +02:00
|
|
|
LIB32WMAKEFLAGS= \
|
2016-03-12 00:56:33 +01:00
|
|
|
LD="${XLD} -m elf32ppc_fbsd" \
|
|
|
|
OBJCOPY="${XOBJCOPY}"
|
2017-01-07 00:30:54 +01:00
|
|
|
|
|
|
|
.elif ${TARGET_ARCH:Mmips64*} != ""
|
|
|
|
.if empty(TARGET_CPUTYPE)
|
|
|
|
LIB32CPUFLAGS= -march=mips3
|
|
|
|
.else
|
|
|
|
LIB32CPUFLAGS= -march=${TARGET_CPUTYPE}
|
|
|
|
.endif
|
|
|
|
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-12 00:56:33 +01:00
|
|
|
.endif
|
|
|
|
|
2017-01-27 04:43:18 +01:00
|
|
|
LIB32WMAKEFLAGS+= NM="${XNM}"
|
|
|
|
|
2016-03-12 00:56:33 +01:00
|
|
|
|
2017-01-07 00:20:59 +01:00
|
|
|
LIB32CFLAGS= -DCOMPAT_32BIT
|
2016-03-12 00:56:33 +01:00
|
|
|
LIB32DTRACE= ${DTRACE} -32
|
|
|
|
LIB32WMAKEFLAGS+= -DCOMPAT_32BIT
|
|
|
|
|
2016-03-13 00:25:05 +01:00
|
|
|
# -------------------------------------------------------------------
|
|
|
|
# soft-fp world
|
|
|
|
.if ${TARGET_ARCH} == "armv6"
|
|
|
|
LIBSOFTCFLAGS= -DCOMPAT_SOFTFP
|
|
|
|
LIBSOFTCPUFLAGS= -mfloat-abi=softfp
|
|
|
|
LIBSOFTWMAKEENV= CPUTYPE=soft MACHINE=arm MACHINE_ARCH=armv6
|
|
|
|
LIBSOFTWMAKEFLAGS= -DCOMPAT_SOFTFP
|
|
|
|
.endif
|
|
|
|
|
2016-03-12 00:56:33 +01:00
|
|
|
# -------------------------------------------------------------------
|
|
|
|
# Generic code for each type.
|
|
|
|
# Set defaults based on type.
|
|
|
|
libcompat= ${LIBCOMPAT:tl}
|
2016-03-25 20:12:44 +01:00
|
|
|
_LIBCOMPAT_MAKEVARS= _OBJTREE TMP CPUFLAGS CFLAGS CXXFLAGS WMAKEENV \
|
|
|
|
WMAKEFLAGS WMAKE
|
2016-03-12 00:56:33 +01:00
|
|
|
.for _var in ${_LIBCOMPAT_MAKEVARS}
|
|
|
|
.if !empty(LIB${LIBCOMPAT}${_var})
|
|
|
|
LIBCOMPAT${_var}?= ${LIB${LIBCOMPAT}${_var}}
|
|
|
|
.endif
|
|
|
|
.endfor
|
|
|
|
|
|
|
|
# Shared flags
|
|
|
|
LIBCOMPAT_OBJTREE?= ${OBJTREE}${.CURDIR}/world${libcompat}
|
|
|
|
LIBCOMPATTMP?= ${OBJTREE}${.CURDIR}/lib${libcompat}
|
|
|
|
|
|
|
|
LIBCOMPATCFLAGS+= ${LIBCOMPATCPUFLAGS} \
|
|
|
|
-L${LIBCOMPATTMP}/usr/lib${libcompat} \
|
2016-03-25 20:12:44 +01:00
|
|
|
--sysroot=${LIBCOMPATTMP} \
|
|
|
|
${BFLAGS}
|
2016-03-25 20:12:38 +01: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-16 01:58:03 +02:00
|
|
|
|
2016-08-23 21:29:37 +02:00
|
|
|
.if ${WANT_COMPILER_TYPE} == gcc || \
|
|
|
|
(defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc)
|
2016-06-16 01:58:03 +02:00
|
|
|
# GCC requires -isystem when using a cross-compiler and --sysroot. Note that
|
|
|
|
# Makefile.inc1 only applies this with an external compiler but libcompat
|
|
|
|
# always does since even in-tree GCC 4.2 needs this to override the built-in
|
|
|
|
# sysroot path which --sysroot does not actually do for headers.
|
2016-05-29 08:20:15 +02:00
|
|
|
LIBCOMPATCFLAGS+= -isystem ${LIBCOMPATTMP}/usr/include
|
|
|
|
# Force using libc++ for external GCC.
|
2016-06-16 01:58:03 +02:00
|
|
|
# XXX: This should be checking MK_GNUCXX == no
|
2016-07-24 20:50:11 +02:00
|
|
|
.if ${X_COMPILER_VERSION} >= 40800 && \
|
|
|
|
(${MK_CLANG_BOOTSTRAP} == "no" && ${MK_GCC_BOOTSTRAP} == "no")
|
2016-05-29 08:20:15 +02:00
|
|
|
LIBCOMPATCXXFLAGS+= -isystem ${LIBCOMPATTMP}/usr/include/c++/v1 -std=c++11 \
|
2016-12-25 16:39:52 +01:00
|
|
|
-nostdinc++
|
2016-05-29 08:20:15 +02:00
|
|
|
.endif
|
2016-06-16 01:58:03 +02:00
|
|
|
.endif
|
2016-03-25 20:12:44 +01:00
|
|
|
|
2016-03-12 00:56:33 +01:00
|
|
|
# Yes, the flags are redundant.
|
|
|
|
LIBCOMPATWMAKEENV+= MAKEOBJDIRPREFIX=${LIBCOMPAT_OBJTREE} \
|
|
|
|
INSTALL="sh ${.CURDIR}/tools/install.sh" \
|
|
|
|
PATH=${TMPPATH} \
|
|
|
|
LIBDIR=/usr/lib${libcompat} \
|
|
|
|
SHLIBDIR=/usr/lib${libcompat} \
|
|
|
|
DTRACE="${LIB$COMPATDTRACE:U${DTRACE}}"
|
2016-04-14 23:06:10 +02:00
|
|
|
.if ${MK_META_MODE} != "no"
|
|
|
|
# Don't rebuild build-tools targets during normal build.
|
|
|
|
LIBCOMPATWMAKEENV+= BUILD_TOOLS_META=.NOMETA_CMP
|
|
|
|
.endif
|
2016-05-29 08:20:15 +02:00
|
|
|
LIBCOMPATWMAKEFLAGS+= CC="${XCC} ${LIBCOMPATCFLAGS}" \
|
2016-05-29 08:20:36 +02:00
|
|
|
CXX="${XCXX} ${LIBCOMPATCXXFLAGS} ${LIBCOMPATCFLAGS}" \
|
2016-05-29 08:20:15 +02:00
|
|
|
CPP="${XCPP} ${LIBCOMPATCFLAGS}" \
|
2016-03-12 00:56:33 +01:00
|
|
|
DESTDIR=${LIBCOMPATTMP} \
|
|
|
|
-DNO_CPU_CFLAGS \
|
|
|
|
MK_CTF=no \
|
|
|
|
-DNO_LINT \
|
|
|
|
MK_TESTS=no
|
|
|
|
LIBCOMPATWMAKE+= ${LIBCOMPATWMAKEENV} ${MAKE} ${LIBCOMPATWMAKEFLAGS} \
|
|
|
|
MK_MAN=no MK_HTML=no
|
2016-04-05 23:12:03 +02:00
|
|
|
LIBCOMPATIMAKE+= ${LIBCOMPATWMAKE:NINSTALL=*:NDESTDIR=*} \
|
2016-03-25 20:12:13 +01:00
|
|
|
MK_TOOLCHAIN=no ${IMAKE_INSTALL} \
|
|
|
|
-DLIBRARIES_ONLY
|
2016-03-12 00:56:33 +01:00
|
|
|
|
|
|
|
_LC_LIBDIRS.yes= lib gnu/lib
|
2016-03-12 19:41:27 +01:00
|
|
|
_LC_LIBDIRS.${MK_CDDL:tl}+= cddl/lib
|
|
|
|
_LC_LIBDIRS.${MK_CRYPT:tl}+= secure/lib
|
|
|
|
_LC_LIBDIRS.${MK_KERBEROS:tl}+= kerberos5/lib
|
2016-03-12 00:56:33 +01:00
|
|
|
|
2016-03-25 20:12:38 +01:00
|
|
|
_LC_INCDIRS= \
|
|
|
|
include \
|
|
|
|
lib/ncurses/ncursesw \
|
|
|
|
${_LC_LIBDIRS.yes}
|
|
|
|
|
2016-03-12 00:56:33 +01:00
|
|
|
# Shared logic
|
|
|
|
build${libcompat}: .PHONY
|
|
|
|
@echo
|
|
|
|
@echo "--------------------------------------------------------------"
|
|
|
|
@echo ">>> stage 5.1: building lib${libcompat} shim libraries"
|
|
|
|
@echo "--------------------------------------------------------------"
|
|
|
|
mkdir -p ${LIBCOMPATTMP}/usr/include
|
|
|
|
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
|
|
|
|
-p ${LIBCOMPATTMP}/usr >/dev/null
|
|
|
|
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
|
|
|
|
-p ${LIBCOMPATTMP}/usr/include >/dev/null
|
|
|
|
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \
|
|
|
|
-p ${LIBCOMPATTMP}/usr >/dev/null
|
|
|
|
.if ${MK_DEBUG_FILES} != "no"
|
|
|
|
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
|
|
|
|
-p ${LIBCOMPATTMP}/usr/lib >/dev/null
|
|
|
|
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \
|
|
|
|
-p ${LIBCOMPATTMP}/usr/lib/debug/usr >/dev/null
|
|
|
|
.endif
|
|
|
|
mkdir -p ${WORLDTMP}
|
|
|
|
ln -sf ${.CURDIR}/sys ${WORLDTMP}
|
|
|
|
.for _t in obj includes
|
2016-03-25 20:12:38 +01:00
|
|
|
.for _dir in ${_LC_INCDIRS}
|
2016-03-31 19:27:14 +02:00
|
|
|
${_+_}cd ${.CURDIR}/${_dir}; ${LIBCOMPATWMAKE} MK_INCLUDES=yes \
|
|
|
|
DIRPRFX=${_dir}/ ${_t}
|
2016-03-12 00:56:33 +01:00
|
|
|
.endfor
|
|
|
|
.endfor
|
|
|
|
.for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic
|
|
|
|
${_+_}cd ${.CURDIR}/${_dir}; \
|
|
|
|
WORLDTMP=${WORLDTMP} \
|
|
|
|
MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
|
|
|
|
MAKEOBJDIRPREFIX=${LIBCOMPAT_OBJTREE} ${MAKE} SSP_CFLAGS= DESTDIR= \
|
|
|
|
DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
|
|
|
|
build-tools
|
|
|
|
.endfor
|
|
|
|
${_+_}cd ${.CURDIR}; \
|
|
|
|
${LIBCOMPATWMAKE} -f Makefile.inc1 -DNO_FSCHG libraries
|
|
|
|
.if ${libcompat} == "32"
|
2016-03-31 01:50:23 +02:00
|
|
|
.for _t in obj all
|
2016-03-12 00:56:33 +01:00
|
|
|
${_+_}cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIBCOMPATWMAKE} \
|
|
|
|
-DNO_FSCHG DIRPRFX=libexec/rtld-elf/ ${_t}
|
|
|
|
${_+_}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
|
|
|
|
.if ${libcompat} == "32"
|
|
|
|
${_+_}cd ${.CURDIR}/libexec/rtld-elf; \
|
|
|
|
PROG=ld-elf32.so.1 ${LIBCOMPATIMAKE} ${.TARGET:S/32$//}
|
|
|
|
${_+_}cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIBCOMPATIMAKE} \
|
|
|
|
${.TARGET:S/32$//}
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.endif
|