1# $FreeBSD: head/Makefile.libcompat 297591 2016-04-05 21:12:03Z bdrewery $
| 1# $FreeBSD: head/Makefile.libcompat 297997 2016-04-14 21:06:10Z bdrewery $
|
2 3.if !targets(__<${_this:T}>__) 4__<${_this:T}>__: 5 6# Makefile for the compatibility libraries. 7# - 32-bit compat libraries on PowerPC and AMD64. 8# could also be for mips, but that doesn't work today. 9 10# ------------------------------------------------------------------- 11# 32 bit world 12.if ${TARGET_ARCH} == "amd64" 13.if empty(TARGET_CPUTYPE) 14LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2 15.else 16LIB32CPUFLAGS= -march=${TARGET_CPUTYPE} 17.endif 18LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \ 19 MACHINE_CPU="i686 mmx sse sse2" 20LIB32WMAKEFLAGS= \ 21 AS="${XAS} --32" \ 22 LD="${XLD} -m elf_i386_fbsd -Y P,${LIBCOMPATTMP}/usr/lib32" \ 23 OBJCOPY="${XOBJCOPY}" 24 25.elif ${TARGET_ARCH} == "powerpc64" 26.if empty(TARGET_CPUTYPE) 27LIB32CPUFLAGS= -mcpu=powerpc 28.else 29LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE} 30.endif 31LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc 32LIB32WMAKEFLAGS= \ 33 LD="${XLD} -m elf32ppc_fbsd" \ 34 OBJCOPY="${XOBJCOPY}" 35.endif 36 37 38LIB32CFLAGS= -m32 -DCOMPAT_32BIT 39LIB32DTRACE= ${DTRACE} -32 40LIB32WMAKEFLAGS+= -DCOMPAT_32BIT 41 42# ------------------------------------------------------------------- 43# soft-fp world 44.if ${TARGET_ARCH} == "armv6" 45LIBSOFTCFLAGS= -DCOMPAT_SOFTFP 46LIBSOFTCPUFLAGS= -mfloat-abi=softfp 47LIBSOFTWMAKEENV= CPUTYPE=soft MACHINE=arm MACHINE_ARCH=armv6 48LIBSOFTWMAKEFLAGS= -DCOMPAT_SOFTFP 49.endif 50 51# ------------------------------------------------------------------- 52# Generic code for each type. 53# Set defaults based on type. 54libcompat= ${LIBCOMPAT:tl} 55_LIBCOMPAT_MAKEVARS= _OBJTREE TMP CPUFLAGS CFLAGS CXXFLAGS WMAKEENV \ 56 WMAKEFLAGS WMAKE 57.for _var in ${_LIBCOMPAT_MAKEVARS} 58.if !empty(LIB${LIBCOMPAT}${_var}) 59LIBCOMPAT${_var}?= ${LIB${LIBCOMPAT}${_var}} 60.endif 61.endfor 62 63# Shared flags 64LIBCOMPAT_OBJTREE?= ${OBJTREE}${.CURDIR}/world${libcompat} 65LIBCOMPATTMP?= ${OBJTREE}${.CURDIR}/lib${libcompat} 66 67LIBCOMPATCFLAGS+= ${LIBCOMPATCPUFLAGS} \ 68 -L${LIBCOMPATTMP}/usr/lib${libcompat} \ 69 --sysroot=${LIBCOMPATTMP} \ 70 ${BFLAGS} 71 72# -B is needed to find /usr/lib32/crti.o for GCC and /usr/libsoft/crti.o for 73# Clang/GCC. 74LIBCOMPATCFLAGS+= -B${LIBCOMPATTMP}/usr/lib${libcompat} 75# GCC requires -isystem when using a cross-compiler. 76LIBCOMPATCFLAGS+= -isystem ${LIBCOMPATTMP}/usr/include 77 78.if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc 79# Force using libc++ for external GCC. 80LIBCOMPATCXXFLAGS+= -isystem ${LIBCOMPATTMP}/usr/include/c++/v1 -std=c++11 \ 81 -nostdinc++ -L${LIBCOMPAT_OBJTREE}${.CURDIR}/lib/libc++ 82.endif 83 84# Yes, the flags are redundant. 85LIBCOMPATWMAKEENV+= MAKEOBJDIRPREFIX=${LIBCOMPAT_OBJTREE} \ 86 INSTALL="sh ${.CURDIR}/tools/install.sh" \ 87 PATH=${TMPPATH} \ 88 LIBDIR=/usr/lib${libcompat} \ 89 SHLIBDIR=/usr/lib${libcompat} \ 90 DTRACE="${LIB$COMPATDTRACE:U${DTRACE}}"
| 2 3.if !targets(__<${_this:T}>__) 4__<${_this:T}>__: 5 6# Makefile for the compatibility libraries. 7# - 32-bit compat libraries on PowerPC and AMD64. 8# could also be for mips, but that doesn't work today. 9 10# ------------------------------------------------------------------- 11# 32 bit world 12.if ${TARGET_ARCH} == "amd64" 13.if empty(TARGET_CPUTYPE) 14LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2 15.else 16LIB32CPUFLAGS= -march=${TARGET_CPUTYPE} 17.endif 18LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \ 19 MACHINE_CPU="i686 mmx sse sse2" 20LIB32WMAKEFLAGS= \ 21 AS="${XAS} --32" \ 22 LD="${XLD} -m elf_i386_fbsd -Y P,${LIBCOMPATTMP}/usr/lib32" \ 23 OBJCOPY="${XOBJCOPY}" 24 25.elif ${TARGET_ARCH} == "powerpc64" 26.if empty(TARGET_CPUTYPE) 27LIB32CPUFLAGS= -mcpu=powerpc 28.else 29LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE} 30.endif 31LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc 32LIB32WMAKEFLAGS= \ 33 LD="${XLD} -m elf32ppc_fbsd" \ 34 OBJCOPY="${XOBJCOPY}" 35.endif 36 37 38LIB32CFLAGS= -m32 -DCOMPAT_32BIT 39LIB32DTRACE= ${DTRACE} -32 40LIB32WMAKEFLAGS+= -DCOMPAT_32BIT 41 42# ------------------------------------------------------------------- 43# soft-fp world 44.if ${TARGET_ARCH} == "armv6" 45LIBSOFTCFLAGS= -DCOMPAT_SOFTFP 46LIBSOFTCPUFLAGS= -mfloat-abi=softfp 47LIBSOFTWMAKEENV= CPUTYPE=soft MACHINE=arm MACHINE_ARCH=armv6 48LIBSOFTWMAKEFLAGS= -DCOMPAT_SOFTFP 49.endif 50 51# ------------------------------------------------------------------- 52# Generic code for each type. 53# Set defaults based on type. 54libcompat= ${LIBCOMPAT:tl} 55_LIBCOMPAT_MAKEVARS= _OBJTREE TMP CPUFLAGS CFLAGS CXXFLAGS WMAKEENV \ 56 WMAKEFLAGS WMAKE 57.for _var in ${_LIBCOMPAT_MAKEVARS} 58.if !empty(LIB${LIBCOMPAT}${_var}) 59LIBCOMPAT${_var}?= ${LIB${LIBCOMPAT}${_var}} 60.endif 61.endfor 62 63# Shared flags 64LIBCOMPAT_OBJTREE?= ${OBJTREE}${.CURDIR}/world${libcompat} 65LIBCOMPATTMP?= ${OBJTREE}${.CURDIR}/lib${libcompat} 66 67LIBCOMPATCFLAGS+= ${LIBCOMPATCPUFLAGS} \ 68 -L${LIBCOMPATTMP}/usr/lib${libcompat} \ 69 --sysroot=${LIBCOMPATTMP} \ 70 ${BFLAGS} 71 72# -B is needed to find /usr/lib32/crti.o for GCC and /usr/libsoft/crti.o for 73# Clang/GCC. 74LIBCOMPATCFLAGS+= -B${LIBCOMPATTMP}/usr/lib${libcompat} 75# GCC requires -isystem when using a cross-compiler. 76LIBCOMPATCFLAGS+= -isystem ${LIBCOMPATTMP}/usr/include 77 78.if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc 79# Force using libc++ for external GCC. 80LIBCOMPATCXXFLAGS+= -isystem ${LIBCOMPATTMP}/usr/include/c++/v1 -std=c++11 \ 81 -nostdinc++ -L${LIBCOMPAT_OBJTREE}${.CURDIR}/lib/libc++ 82.endif 83 84# Yes, the flags are redundant. 85LIBCOMPATWMAKEENV+= MAKEOBJDIRPREFIX=${LIBCOMPAT_OBJTREE} \ 86 INSTALL="sh ${.CURDIR}/tools/install.sh" \ 87 PATH=${TMPPATH} \ 88 LIBDIR=/usr/lib${libcompat} \ 89 SHLIBDIR=/usr/lib${libcompat} \ 90 DTRACE="${LIB$COMPATDTRACE:U${DTRACE}}"
|
| 91.if ${MK_META_MODE} != "no" 92# Don't rebuild build-tools targets during normal build. 93LIBCOMPATWMAKEENV+= BUILD_TOOLS_META=.NOMETA_CMP 94.endif
|
91LIBCOMPATWMAKEFLAGS+= CC="${XCC} ${LIBCOMPATCFLAGS}" \ 92 CXX="${XCXX} ${LIBCOMPATCFLAGS} ${LIBCOMPATCXXFLAGS}" \ 93 DESTDIR=${LIBCOMPATTMP} \ 94 -DNO_CPU_CFLAGS \ 95 MK_CTF=no \ 96 -DNO_LINT \ 97 MK_TESTS=no 98LIBCOMPATWMAKE+= ${LIBCOMPATWMAKEENV} ${MAKE} ${LIBCOMPATWMAKEFLAGS} \ 99 MK_MAN=no MK_HTML=no 100LIBCOMPATIMAKE+= ${LIBCOMPATWMAKE:NINSTALL=*:NDESTDIR=*} \ 101 MK_TOOLCHAIN=no ${IMAKE_INSTALL} \ 102 -DLIBRARIES_ONLY 103 104_LC_LIBDIRS.yes= lib gnu/lib 105_LC_LIBDIRS.${MK_CDDL:tl}+= cddl/lib 106_LC_LIBDIRS.${MK_CRYPT:tl}+= secure/lib 107_LC_LIBDIRS.${MK_KERBEROS:tl}+= kerberos5/lib 108 109_LC_INCDIRS= \ 110 include \ 111 lib/ncurses/ncursesw \ 112 ${_LC_LIBDIRS.yes} 113 114# Shared logic 115build${libcompat}: .PHONY 116 @echo 117 @echo "--------------------------------------------------------------" 118 @echo ">>> stage 5.1: building lib${libcompat} shim libraries" 119 @echo "--------------------------------------------------------------" 120 mkdir -p ${LIBCOMPATTMP}/usr/include 121 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 122 -p ${LIBCOMPATTMP}/usr >/dev/null 123 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 124 -p ${LIBCOMPATTMP}/usr/include >/dev/null 125 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ 126 -p ${LIBCOMPATTMP}/usr >/dev/null 127.if ${MK_DEBUG_FILES} != "no" 128 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \ 129 -p ${LIBCOMPATTMP}/usr/lib >/dev/null 130 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ 131 -p ${LIBCOMPATTMP}/usr/lib/debug/usr >/dev/null 132.endif 133 mkdir -p ${WORLDTMP} 134 ln -sf ${.CURDIR}/sys ${WORLDTMP} 135.for _t in obj includes 136.for _dir in ${_LC_INCDIRS} 137 ${_+_}cd ${.CURDIR}/${_dir}; ${LIBCOMPATWMAKE} MK_INCLUDES=yes \ 138 DIRPRFX=${_dir}/ ${_t} 139.endfor 140.endfor 141.for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic 142 ${_+_}cd ${.CURDIR}/${_dir}; \ 143 WORLDTMP=${WORLDTMP} \ 144 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \ 145 MAKEOBJDIRPREFIX=${LIBCOMPAT_OBJTREE} ${MAKE} SSP_CFLAGS= DESTDIR= \ 146 DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \ 147 build-tools 148.endfor 149 ${_+_}cd ${.CURDIR}; \ 150 ${LIBCOMPATWMAKE} -f Makefile.inc1 -DNO_FSCHG libraries 151.if ${libcompat} == "32" 152.for _t in obj all 153 ${_+_}cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIBCOMPATWMAKE} \ 154 -DNO_FSCHG DIRPRFX=libexec/rtld-elf/ ${_t} 155 ${_+_}cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIBCOMPATWMAKE} \ 156 DIRPRFX=usr.bin/ldd ${_t} 157.endfor 158.endif 159 160distribute${libcompat} install${libcompat}: .PHONY 161.for _dir in ${_LC_LIBDIRS.yes} 162 ${_+_}cd ${.CURDIR}/${_dir}; ${LIBCOMPATIMAKE} ${.TARGET:S/${libcompat}$//} 163.endfor 164.if ${libcompat} == "32" 165 ${_+_}cd ${.CURDIR}/libexec/rtld-elf; \ 166 PROG=ld-elf32.so.1 ${LIBCOMPATIMAKE} ${.TARGET:S/32$//} 167 ${_+_}cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIBCOMPATIMAKE} \ 168 ${.TARGET:S/32$//} 169.endif 170 171.endif
| 95LIBCOMPATWMAKEFLAGS+= CC="${XCC} ${LIBCOMPATCFLAGS}" \ 96 CXX="${XCXX} ${LIBCOMPATCFLAGS} ${LIBCOMPATCXXFLAGS}" \ 97 DESTDIR=${LIBCOMPATTMP} \ 98 -DNO_CPU_CFLAGS \ 99 MK_CTF=no \ 100 -DNO_LINT \ 101 MK_TESTS=no 102LIBCOMPATWMAKE+= ${LIBCOMPATWMAKEENV} ${MAKE} ${LIBCOMPATWMAKEFLAGS} \ 103 MK_MAN=no MK_HTML=no 104LIBCOMPATIMAKE+= ${LIBCOMPATWMAKE:NINSTALL=*:NDESTDIR=*} \ 105 MK_TOOLCHAIN=no ${IMAKE_INSTALL} \ 106 -DLIBRARIES_ONLY 107 108_LC_LIBDIRS.yes= lib gnu/lib 109_LC_LIBDIRS.${MK_CDDL:tl}+= cddl/lib 110_LC_LIBDIRS.${MK_CRYPT:tl}+= secure/lib 111_LC_LIBDIRS.${MK_KERBEROS:tl}+= kerberos5/lib 112 113_LC_INCDIRS= \ 114 include \ 115 lib/ncurses/ncursesw \ 116 ${_LC_LIBDIRS.yes} 117 118# Shared logic 119build${libcompat}: .PHONY 120 @echo 121 @echo "--------------------------------------------------------------" 122 @echo ">>> stage 5.1: building lib${libcompat} shim libraries" 123 @echo "--------------------------------------------------------------" 124 mkdir -p ${LIBCOMPATTMP}/usr/include 125 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 126 -p ${LIBCOMPATTMP}/usr >/dev/null 127 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 128 -p ${LIBCOMPATTMP}/usr/include >/dev/null 129 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ 130 -p ${LIBCOMPATTMP}/usr >/dev/null 131.if ${MK_DEBUG_FILES} != "no" 132 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \ 133 -p ${LIBCOMPATTMP}/usr/lib >/dev/null 134 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ 135 -p ${LIBCOMPATTMP}/usr/lib/debug/usr >/dev/null 136.endif 137 mkdir -p ${WORLDTMP} 138 ln -sf ${.CURDIR}/sys ${WORLDTMP} 139.for _t in obj includes 140.for _dir in ${_LC_INCDIRS} 141 ${_+_}cd ${.CURDIR}/${_dir}; ${LIBCOMPATWMAKE} MK_INCLUDES=yes \ 142 DIRPRFX=${_dir}/ ${_t} 143.endfor 144.endfor 145.for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic 146 ${_+_}cd ${.CURDIR}/${_dir}; \ 147 WORLDTMP=${WORLDTMP} \ 148 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \ 149 MAKEOBJDIRPREFIX=${LIBCOMPAT_OBJTREE} ${MAKE} SSP_CFLAGS= DESTDIR= \ 150 DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \ 151 build-tools 152.endfor 153 ${_+_}cd ${.CURDIR}; \ 154 ${LIBCOMPATWMAKE} -f Makefile.inc1 -DNO_FSCHG libraries 155.if ${libcompat} == "32" 156.for _t in obj all 157 ${_+_}cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIBCOMPATWMAKE} \ 158 -DNO_FSCHG DIRPRFX=libexec/rtld-elf/ ${_t} 159 ${_+_}cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIBCOMPATWMAKE} \ 160 DIRPRFX=usr.bin/ldd ${_t} 161.endfor 162.endif 163 164distribute${libcompat} install${libcompat}: .PHONY 165.for _dir in ${_LC_LIBDIRS.yes} 166 ${_+_}cd ${.CURDIR}/${_dir}; ${LIBCOMPATIMAKE} ${.TARGET:S/${libcompat}$//} 167.endfor 168.if ${libcompat} == "32" 169 ${_+_}cd ${.CURDIR}/libexec/rtld-elf; \ 170 PROG=ld-elf32.so.1 ${LIBCOMPATIMAKE} ${.TARGET:S/32$//} 171 ${_+_}cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIBCOMPATIMAKE} \ 172 ${.TARGET:S/32$//} 173.endif 174 175.endif
|