3 # Makefile for the 32-bit compat libraries on PowerPC and AMD64.
4 # could also be for mips, but that doesn't work today.
7 LIB32_OBJTREE= ${OBJTREE}${.CURDIR}/world32
8 LIB32TMP= ${OBJTREE}${.CURDIR}/lib32
10 .if ${TARGET_ARCH} == "amd64"
11 .if empty(TARGET_CPUTYPE)
12 LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2
14 LIB32CPUFLAGS= -march=${TARGET_CPUTYPE}
16 LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \
17 MACHINE_CPU="i686 mmx sse sse2"
20 LD="${XLD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \
23 .elif ${TARGET_ARCH} == "powerpc64"
24 .if empty(TARGET_CPUTYPE)
25 LIB32CPUFLAGS= -mcpu=powerpc
27 LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE}
29 LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc
31 LD="${XLD} -m elf32ppc_fbsd" \
36 LIB32FLAGS= -m32 ${LIB32CPUFLAGS} -DCOMPAT_32BIT \
37 -isystem ${LIB32TMP}/usr/include/ \
38 -L${LIB32TMP}/usr/lib32 \
39 -B${LIB32TMP}/usr/lib32
40 .if ${XCC:N${CCACHE_BIN}:M/*}
41 LIB32FLAGS+= --sysroot=${WORLDTMP}
44 # Yes, the flags are redundant.
45 LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${LIB32_OBJTREE} \
46 _LDSCRIPTROOT=${LIB32TMP} \
47 INSTALL="sh ${.CURDIR}/tools/install.sh" \
51 DTRACE="${DTRACE} -32"
52 LIB32WMAKEFLAGS+= CC="${XCC} ${LIB32FLAGS}" \
53 CXX="${XCXX} ${LIB32FLAGS}" \
62 LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} ${LIB32WMAKEFLAGS} \
64 LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} \
65 MK_TOOLCHAIN=no ${IMAKE_INSTALL}
69 @echo "--------------------------------------------------------------"
70 @echo ">>> stage 5.1: building 32 bit shim libraries"
71 @echo "--------------------------------------------------------------"
72 mkdir -p ${LIB32TMP}/usr/include
73 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
74 -p ${LIB32TMP}/usr >/dev/null
75 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
76 -p ${LIB32TMP}/usr/include >/dev/null
77 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib32.dist \
78 -p ${LIB32TMP}/usr >/dev/null
79 .if ${MK_DEBUG_FILES} != "no"
80 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
81 -p ${LIB32TMP}/usr/lib >/dev/null
82 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib32.dist \
83 -p ${LIB32TMP}/usr/lib/debug/usr >/dev/null
86 ln -sf ${.CURDIR}/sys ${WORLDTMP}
87 .for _t in obj includes
88 ${_+_}cd ${.CURDIR}/include; ${LIB32WMAKE} DIRPRFX=include/ ${_t}
89 ${_+_}cd ${.CURDIR}/lib; ${LIB32WMAKE} DIRPRFX=lib/ ${_t}
90 .if ${MK_CDDL} != "no"
91 ${_+_}cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} DIRPRFX=cddl/lib/ ${_t}
93 ${_+_}cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} DIRPRFX=gnu/lib/ ${_t}
94 .if ${MK_CRYPT} != "no"
95 ${_+_}cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} DIRPRFX=secure/lib/ ${_t}
97 .if ${MK_KERBEROS} != "no"
98 ${_+_}cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} DIRPRFX=kerberos5/lib ${_t}
101 .for _dir in usr.bin/lex/lib
102 ${_+_}cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} DIRPRFX=${_dir}/ obj
104 .for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic
105 ${_+_}cd ${.CURDIR}/${_dir}; \
106 WORLDTMP=${WORLDTMP} \
107 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
108 MAKEOBJDIRPREFIX=${LIB32_OBJTREE} ${MAKE} SSP_CFLAGS= DESTDIR= \
109 DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
112 ${_+_}cd ${.CURDIR}; \
113 ${LIB32WMAKE} -f Makefile.inc1 -DNO_FSCHG libraries
114 .for _t in obj depend all
115 ${_+_}cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32WMAKE} \
116 -DNO_FSCHG DIRPRFX=libexec/rtld-elf/ ${_t}
117 ${_+_}cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} \
118 DIRPRFX=usr.bin/ldd ${_t}
121 distribute32 install32: .MAKE .PHONY
122 ${_+_}cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
123 .if ${MK_CDDL} != "no"
124 ${_+_}cd ${.CURDIR}/cddl/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
126 ${_+_}cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
127 .if ${MK_CRYPT} != "no"
128 ${_+_}cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
130 .if ${MK_KERBEROS} != "no"
131 ${_+_}cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
133 ${_+_}cd ${.CURDIR}/libexec/rtld-elf; \
134 PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//}
135 ${_+_}cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} \