2017-09-12 01:16:13 -07:00
|
|
|
# $OpenBSD: Makefile.cross,v 1.97 2017/09/12 08:16:13 mpi Exp $
|
2005-01-09 12:36:20 -08:00
|
|
|
|
|
|
|
cross-tools: cross-includes cross-binutils cross-gcc cross-lib
|
2008-09-06 09:26:39 -07:00
|
|
|
cross-distrib: cross-tools cross-bin cross-share cross-sys cross-etc-root-var
|
|
|
|
# cross-gnu \
|
2005-01-09 12:36:20 -08:00
|
|
|
|
2005-09-11 16:10:07 -07:00
|
|
|
# Have to compute TARGET_ARCH directly in the Makefile, for .if tests involving
|
|
|
|
# this variable to work.
|
2016-12-18 09:03:08 -08:00
|
|
|
.if (${TARGET} == "arm64")
|
|
|
|
TARGET_ARCH= aarch64
|
|
|
|
.elif (${TARGET} == "armv7")
|
2005-09-11 16:10:07 -07:00
|
|
|
TARGET_ARCH= arm
|
2015-12-08 08:04:41 -08:00
|
|
|
.elif (${TARGET} == "luna88k")
|
2005-09-11 16:10:07 -07:00
|
|
|
TARGET_ARCH= m88k
|
2010-09-20 04:49:39 -07:00
|
|
|
.elif (${TARGET} == "sgi" || ${TARGET} == "octeon")
|
2005-09-11 16:10:07 -07:00
|
|
|
TARGET_ARCH= mips64
|
2010-02-05 14:36:27 -08:00
|
|
|
.elif (${TARGET} == "loongson")
|
|
|
|
TARGET_ARCH= mips64el
|
|
|
|
TARGET_CPU= mips64
|
2011-07-07 12:27:15 -07:00
|
|
|
.elif (${TARGET} == "macppc" || ${TARGET} == "socppc")
|
2005-09-11 16:10:07 -07:00
|
|
|
TARGET_ARCH= powerpc
|
2006-10-06 13:58:15 -07:00
|
|
|
.elif (${TARGET} == "landisk")
|
|
|
|
TARGET_ARCH= sh
|
2005-09-11 16:10:07 -07:00
|
|
|
.else
|
|
|
|
TARGET_ARCH= ${TARGET}
|
|
|
|
.endif
|
2010-02-05 14:36:27 -08:00
|
|
|
TARGET_CPU?= ${TARGET_ARCH}
|
2005-09-11 16:10:07 -07:00
|
|
|
|
2011-09-23 01:09:20 -07:00
|
|
|
# List of LP64 archs
|
|
|
|
# XXX move to bsd.*.mk?
|
2016-12-18 09:03:08 -08:00
|
|
|
LP64_ARCH = aarch64 amd64 alpha mips64 sparc64
|
2011-09-23 01:09:20 -07:00
|
|
|
|
|
|
|
TARGET_IS_LP64 =
|
|
|
|
MACHINE_IS_LP64 =
|
|
|
|
.for _ in ${LP64_ARCH}
|
|
|
|
. if !empty(TARGET_ARCH:M$_)
|
|
|
|
TARGET_IS_LP64 = yes
|
|
|
|
. endif
|
|
|
|
. if !empty(MACHINE_ARCH:M$_)
|
|
|
|
MACHINE_IS_LP64 = yes
|
|
|
|
. endif
|
|
|
|
.endfor
|
|
|
|
|
2008-09-06 09:26:39 -07:00
|
|
|
#CROSSCPPFLAGS?= -nostdinc -I${CROSSDIR}/usr/include
|
|
|
|
#CROSSLDFLAGS?= -nostdlib -L${CROSSDIR}/usr/lib -static
|
|
|
|
CROSSCFLAGS?= ${CROSSCPPFLAGS} -O2 ${PIPE} ${DEBUG}
|
2005-01-09 12:36:20 -08:00
|
|
|
CROSSCXXFLAGS?= ${CROSSCPPFLAGS}
|
2008-09-06 09:26:39 -07:00
|
|
|
#LDSTATIC?= -static
|
|
|
|
|
2005-01-09 12:36:20 -08:00
|
|
|
CROSSDIR= ${DESTDIR}/usr/cross/${TARGET}
|
2008-09-06 09:26:39 -07:00
|
|
|
CROSSENV= AR=${CROSSDIR}/usr/${TARGET_CANON}/bin/ar \
|
|
|
|
AS=${CROSSDIR}/usr/${TARGET_CANON}/bin/as \
|
|
|
|
CC=${CROSSDIR}/usr/${TARGET_CANON}/bin/cc \
|
|
|
|
CPP=${CROSSDIR}/usr/${TARGET_CANON}/bin/cpp \
|
|
|
|
CXX=${CROSSDIR}/usr/${TARGET_CANON}/bin/c++ \
|
|
|
|
LD=${CROSSDIR}/usr/${TARGET_CANON}/bin/ld \
|
|
|
|
OBJCOPY=${CROSSDIR}/usr/${TARGET_CANON}/bin/objcopy \
|
|
|
|
LORDER=/usr/bin/lorder RANLIB=${CROSSDIR}/usr/${TARGET_CANON}/bin/ranlib \
|
|
|
|
STRIP=${CROSSDIR}/usr/${TARGET_CANON}/bin/strip \
|
|
|
|
HOSTCC=\"${CC}\" HOSTCXX=\"${CXX}\" NOMAN= \
|
2005-01-09 12:36:20 -08:00
|
|
|
HOSTCFLAGS=\"${CFLAGS}\" HOSTCXXFLAGS=\"${CXXFLAGS}\" \
|
2005-09-11 16:10:07 -07:00
|
|
|
HOSTLDFLAGS=\"${LDFLAGS}\" \
|
2005-01-09 12:36:20 -08:00
|
|
|
CFLAGS=\"${CROSSCFLAGS}\" CPPFLAGS=\"${CROSSCPPFLAGS}\" \
|
|
|
|
CXXFLAGS=\"${CROSSCXXFLAGS}\" \
|
2017-03-21 03:41:33 -07:00
|
|
|
LDFLAGS=\"${CROSSLDFLAGS}\" \
|
|
|
|
CROSSDIR=\"${CROSSDIR}\"
|
2008-09-06 09:26:39 -07:00
|
|
|
CROSSADDPATH=:${CROSSDIR}/usr/${TARGET_CANON}/bin
|
|
|
|
CROSSPATH= /usr/bin:/bin:/usr/sbin:/sbin${CROSSADDPATH}
|
2005-01-09 12:36:20 -08:00
|
|
|
CROSSLANGS?= c c++
|
|
|
|
|
2005-01-10 09:47:15 -08:00
|
|
|
TARGET_CANON=`cat ${CROSSDIR}/TARGET_CANON`
|
|
|
|
|
2005-01-09 12:36:20 -08:00
|
|
|
CROSSDIRS= ${CROSSDIR}/.dirs_done
|
2008-09-06 09:26:39 -07:00
|
|
|
CROSSOBJ= ${CROSSDIR}/.obj_done
|
|
|
|
CROSSINCLUDES= ${CROSSDIR}/.includes_done
|
|
|
|
CROSSBINUTILS= ${CROSSDIR}/.binutils_done
|
|
|
|
CROSSGCC= ${CROSSDIR}/.gcc_done
|
2010-10-17 01:44:15 -07:00
|
|
|
#NO_CROSS= isakmpd keynote ssh
|
2005-01-09 12:36:20 -08:00
|
|
|
|
2011-11-11 04:26:54 -08:00
|
|
|
.include <bsd.own.mk>
|
|
|
|
|
2011-07-04 17:15:03 -07:00
|
|
|
.for _arch in ${TARGET_ARCH}
|
2016-12-18 09:03:08 -08:00
|
|
|
.if !empty(CLANG_ARCH:M${_arch})
|
|
|
|
COMPILER_VERSION=clang
|
2017-05-23 07:57:30 -07:00
|
|
|
BUILD_CLANG=yes
|
2017-09-12 01:16:13 -07:00
|
|
|
CC=clang
|
|
|
|
CXX=clang++
|
2016-12-18 09:03:08 -08:00
|
|
|
.elif !empty(GCC3_ARCH:M${_arch})
|
2012-11-13 12:51:57 -08:00
|
|
|
COMPILER_VERSION=gcc3
|
2017-09-12 01:16:13 -07:00
|
|
|
CC=gcc
|
|
|
|
CXX=g++
|
2013-08-06 12:11:53 -07:00
|
|
|
.else
|
|
|
|
COMPILER_VERSION=gcc4
|
2017-09-12 01:16:13 -07:00
|
|
|
CC=gcc
|
|
|
|
CXX=g++
|
2011-07-04 17:15:03 -07:00
|
|
|
.endif
|
|
|
|
|
2013-03-10 00:50:42 -08:00
|
|
|
.if !empty(PIE_ARCH:M${_arch})
|
|
|
|
NOPIE_FLAGS=-fno-pie
|
|
|
|
NOPIE_LDFLAGS=-nopie
|
|
|
|
PIE_DEFAULT=${DEFAULT_PIE_DEF}
|
|
|
|
.else
|
|
|
|
NOPIE_FLAGS=
|
|
|
|
PIE_DEFAULT=
|
|
|
|
.endif
|
|
|
|
|
2011-07-04 17:15:03 -07:00
|
|
|
BINUTILS= ar as gasp ld nm objcopy objdump ranlib readelf size \
|
|
|
|
strings strip
|
2015-06-01 10:36:17 -07:00
|
|
|
BINUTILS_DIR=gnu/usr.bin/binutils-2.17
|
2011-07-04 17:15:03 -07:00
|
|
|
.endfor
|
2010-05-31 21:33:40 -07:00
|
|
|
|
2005-01-10 09:47:15 -08:00
|
|
|
# no libcrypto.... these won't build
|
2014-10-08 20:40:12 -07:00
|
|
|
#NO_CROSS+= dc passwd ppp tcpdump telnet ftp sasyncd vnconfig
|
2008-09-06 09:26:39 -07:00
|
|
|
|
2005-01-10 09:47:15 -08:00
|
|
|
# explicit cross-compile
|
2008-09-06 09:26:39 -07:00
|
|
|
NO_CROSS+=microcode
|
2014-07-15 18:23:39 -07:00
|
|
|
NO_CROSS+=groff binutils binutils-2.17 perl texinfo gcc cvs
|
2010-09-19 21:49:08 -07:00
|
|
|
NO_CROSS+=nsd
|
2015-02-07 16:15:22 -08:00
|
|
|
NO_CROSS+=bind
|
|
|
|
NO_CROSS+=unbound
|
2005-01-10 09:47:15 -08:00
|
|
|
|
2005-01-09 12:36:20 -08:00
|
|
|
cross-dirs: ${CROSSDIRS}
|
|
|
|
cross-obj: ${CROSSOBJ}
|
|
|
|
cross-includes: ${CROSSINCLUDES}
|
|
|
|
cross-binutils: ${CROSSBINUTILS}
|
|
|
|
cross-gcc: ${CROSSGCC}
|
|
|
|
|
|
|
|
cross-env:
|
|
|
|
@echo ${CROSSENV} MACHINE=${TARGET} \
|
2007-02-06 09:17:18 -08:00
|
|
|
MACHINE_ARCH=`cat ${CROSSDIR}/TARGET_ARCH` \
|
2010-02-05 14:36:27 -08:00
|
|
|
MACHINE_CPU=`cat ${CROSSDIR}/TARGET_CPU` \
|
2007-02-06 09:17:18 -08:00
|
|
|
BSDOBJDIR=${CROSSDIR}/usr/obj \
|
|
|
|
BSDSRCDIR=${.CURDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET}
|
2005-01-09 12:36:20 -08:00
|
|
|
|
|
|
|
${CROSSDIRS}:
|
2011-11-11 04:26:54 -08:00
|
|
|
.if ${TARGET_ARCH} == "arm" && ${MACHINE_IS_LP64} == "yes"
|
2013-07-06 10:52:57 -07:00
|
|
|
# this config is allowed
|
2011-11-11 04:26:54 -08:00
|
|
|
.elif ${TARGET_IS_LP64} != ${MACHINE_IS_LP64}
|
2013-07-06 10:52:57 -07:00
|
|
|
@echo "host and target have different size longs"
|
|
|
|
@echo "cross compiler generates bad code; aborting"; exit 1
|
2011-09-23 01:09:20 -07:00
|
|
|
.endif
|
2005-01-09 12:36:20 -08:00
|
|
|
@-mkdir -p ${CROSSDIR}
|
2005-09-11 16:10:07 -07:00
|
|
|
@echo ${TARGET_ARCH} > ${CROSSDIR}/TARGET_ARCH
|
2005-01-09 12:36:20 -08:00
|
|
|
@echo TARGET_ARCH is `cat ${CROSSDIR}/TARGET_ARCH`
|
2010-02-05 14:36:27 -08:00
|
|
|
@echo ${TARGET_CPU} > ${CROSSDIR}/TARGET_CPU
|
|
|
|
@echo TARGET_CPU is `cat ${CROSSDIR}/TARGET_CPU`
|
2005-01-09 12:36:20 -08:00
|
|
|
@eval `grep '^osr=' sys/conf/newvers.sh`; \
|
2010-02-05 14:36:27 -08:00
|
|
|
echo ${TARGET_ARCH}-unknown-openbsd$$osr > \
|
2005-01-09 12:36:20 -08:00
|
|
|
${CROSSDIR}/TARGET_CANON
|
|
|
|
@-mkdir -p ${CROSSDIR}
|
2005-01-10 09:47:15 -08:00
|
|
|
@-mkdir -p ${CROSSDIR}/usr/${TARGET_CANON}
|
2005-01-09 12:36:20 -08:00
|
|
|
@ln -sf ${CROSSDIR}/usr/include \
|
2005-01-10 09:47:15 -08:00
|
|
|
${CROSSDIR}/usr/${TARGET_CANON}/include
|
2005-01-09 12:36:20 -08:00
|
|
|
@ln -sf ${CROSSDIR}/usr/lib \
|
2005-01-10 09:47:15 -08:00
|
|
|
${CROSSDIR}/usr/${TARGET_CANON}/lib
|
|
|
|
@-mkdir -p ${CROSSDIR}/usr/${TARGET_CANON}/bin
|
2005-01-09 12:36:20 -08:00
|
|
|
@(cd ${.CURDIR}/etc && DESTDIR=${CROSSDIR} ${MAKE} distrib-dirs)
|
|
|
|
@touch ${CROSSDIRS}
|
|
|
|
|
|
|
|
${CROSSOBJ}: ${CROSSDIRS}
|
|
|
|
@-mkdir -p ${CROSSDIR}/usr/obj
|
2017-01-19 21:00:53 -08:00
|
|
|
@-chgrp ${WOBJGROUP} ${CROSSDIR}/usr/obj
|
|
|
|
@-chmod g+w ${CROSSDIR}/usr/obj
|
2005-01-09 12:36:20 -08:00
|
|
|
@(cd ${.CURDIR} && \
|
|
|
|
BSDOBJDIR=${CROSSDIR}/usr/obj \
|
2010-05-31 21:33:40 -07:00
|
|
|
COMPILER_VERSION=${COMPILER_VERSION} \
|
2005-01-09 12:36:20 -08:00
|
|
|
MACHINE=${TARGET} \
|
2010-02-05 14:36:27 -08:00
|
|
|
MACHINE_ARCH=${TARGET_ARCH} MACHINE_CPU=${TARGET_CPU} \
|
2005-01-09 12:36:20 -08:00
|
|
|
BSDSRCDIR=${.CURDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
|
|
|
${MAKE} obj)
|
|
|
|
@touch ${CROSSOBJ}
|
|
|
|
|
|
|
|
${CROSSINCLUDES}: ${CROSSOBJ}
|
|
|
|
@-mkdir -p ${CROSSDIR}/usr/include
|
|
|
|
@(cd ${.CURDIR}/include && \
|
2010-05-31 21:33:40 -07:00
|
|
|
COMPILER_VERSION=${COMPILER_VERSION} \
|
2010-02-05 14:36:27 -08:00
|
|
|
MACHINE=${TARGET} \
|
|
|
|
MACHINE_ARCH=${TARGET_ARCH} MACHINE_CPU=${TARGET_CPU} \
|
2005-01-09 12:36:20 -08:00
|
|
|
MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
2010-02-05 14:36:27 -08:00
|
|
|
TARGET_ARCH=${TARGET_ARCH} TARGET_CPU=${TARGET_CPU} \
|
2005-01-09 12:36:20 -08:00
|
|
|
${MAKE} prereq && \
|
2010-05-31 21:33:40 -07:00
|
|
|
COMPILER_VERSION=${COMPILER_VERSION} \
|
2010-02-05 14:36:27 -08:00
|
|
|
MACHINE=${TARGET} \
|
|
|
|
MACHINE_ARCH=${TARGET_ARCH} MACHINE_CPU=${TARGET_CPU} \
|
2005-01-09 12:36:20 -08:00
|
|
|
MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
2010-02-05 14:36:27 -08:00
|
|
|
TARGET_ARCH=${TARGET_ARCH} TARGET_CPU=${TARGET_CPU} \
|
2005-01-09 12:36:20 -08:00
|
|
|
${MAKE} DESTDIR=${CROSSDIR} includes)
|
|
|
|
@touch ${CROSSINCLUDES}
|
|
|
|
|
|
|
|
${CROSSBINUTILS}: ${CROSSINCLUDES}
|
2011-07-04 17:15:03 -07:00
|
|
|
(cd ${.CURDIR}/${BINUTILS_DIR}; \
|
2017-03-21 03:41:33 -07:00
|
|
|
env CROSSDIR=${CROSSDIR} \
|
2005-01-09 12:36:20 -08:00
|
|
|
MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
2013-07-05 14:29:51 -07:00
|
|
|
PIE_DEFAULT=${PIE_DEFAULT} \
|
2010-02-05 14:36:27 -08:00
|
|
|
TARGET_ARCH=${TARGET_ARCH} TARGET_CPU=${TARGET_CPU} \
|
|
|
|
PATH=${CROSSPATH} \
|
2005-01-09 12:36:20 -08:00
|
|
|
${MAKE} -f Makefile.bsd-wrapper depend && \
|
2017-03-21 03:41:33 -07:00
|
|
|
env CROSSDIR=${CROSSDIR} \
|
2017-09-12 01:16:13 -07:00
|
|
|
CC=${CC} CXX=${CXX} \
|
2005-01-09 12:36:20 -08:00
|
|
|
MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
2013-07-05 14:29:51 -07:00
|
|
|
PIE_DEFAULT=${PIE_DEFAULT} \
|
2010-02-05 14:36:27 -08:00
|
|
|
TARGET_ARCH=${TARGET_ARCH} TARGET_CPU=${TARGET_CPU} \
|
2005-01-09 12:36:20 -08:00
|
|
|
${MAKE} -f Makefile.bsd-wrapper all && \
|
2017-03-21 03:41:33 -07:00
|
|
|
env CROSSDIR=${CROSSDIR} DESTDIR=${CROSSDIR} \
|
2010-05-31 21:33:40 -07:00
|
|
|
COMPILER_VERSION=${COMPILER_VERSION} \
|
2010-02-05 14:36:27 -08:00
|
|
|
MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
2017-03-21 03:41:33 -07:00
|
|
|
PIE_DEFAULT=${PIE_DEFAULT} \
|
2010-02-05 14:36:27 -08:00
|
|
|
TARGET_ARCH=${TARGET_ARCH} TARGET_CPU=${TARGET_CPU} \
|
2005-01-09 12:36:20 -08:00
|
|
|
${MAKE} -f Makefile.bsd-wrapper install)
|
|
|
|
@for cmd in ${BINUTILS}; do \
|
2008-09-06 09:26:39 -07:00
|
|
|
if [ -e ${CROSSDIR}/usr/bin/${TARGET_CANON}-$$cmd ] ; then \
|
|
|
|
cp -f ${CROSSDIR}/usr/bin/${TARGET_CANON}-$$cmd \
|
|
|
|
${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-$$cmd ; \
|
|
|
|
ln -sf ${TARGET_CANON}-$$cmd \
|
|
|
|
${CROSSDIR}/usr/${TARGET_CANON}/bin/$$cmd ;\
|
|
|
|
if [ -e ${CROSSDIR}/usr/bin/$$cmd ] ; then \
|
|
|
|
rm -f ${CROSSDIR}/usr/bin/$$cmd ;\
|
|
|
|
fi ;\
|
|
|
|
elif [ -e ${CROSSDIR}/usr/bin/$$cmd ] ; then \
|
|
|
|
cp -f ${CROSSDIR}/usr/bin/$$cmd \
|
|
|
|
${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-$$cmd ; \
|
|
|
|
ln -sf ${TARGET_CANON}-$$cmd \
|
|
|
|
${CROSSDIR}/usr/${TARGET_CANON}/bin/$$cmd ;\
|
|
|
|
mv ${CROSSDIR}/usr/bin/$$cmd \
|
|
|
|
${CROSSDIR}/usr/bin/${TARGET_CANON}-$$cmd ;\
|
2005-01-09 12:36:20 -08:00
|
|
|
fi ;\
|
|
|
|
done
|
|
|
|
@touch ${CROSSBINUTILS}
|
|
|
|
|
|
|
|
|
|
|
|
${CROSSGCC}: ${CROSSBINUTILS}
|
2016-12-18 09:03:08 -08:00
|
|
|
.if ${COMPILER_VERSION:L} == "clang"
|
|
|
|
(cd ${.CURDIR}/gnu/usr.bin/clang; \
|
|
|
|
MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
|
|
|
MACHINE_ARCH=${TARGET_ARCH} \
|
|
|
|
${MAKE} obj)
|
|
|
|
(cd ${.CURDIR}/gnu/usr.bin/clang; \
|
2017-09-12 01:16:13 -07:00
|
|
|
CC=${CC} CXX=${CXX} \
|
2016-12-18 09:03:08 -08:00
|
|
|
MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
|
|
|
MACHINE_ARCH=${TARGET_ARCH} \
|
|
|
|
${MAKE} all)
|
|
|
|
(cd ${.CURDIR}/gnu/usr.bin/clang; \
|
|
|
|
DESTDIR=${CROSSDIR} \
|
|
|
|
MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
|
|
|
MACHINE_ARCH=${TARGET_ARCH} \
|
|
|
|
${MAKE} install)
|
|
|
|
mv ${CROSSDIR}/usr/bin/clang ${CROSSDIR}/usr/bin/${TARGET_CANON}-clang
|
|
|
|
mv ${CROSSDIR}/usr/bin/clang++ ${CROSSDIR}/usr/bin/${TARGET_CANON}-clang++
|
2017-05-23 07:57:30 -07:00
|
|
|
mv ${CROSSDIR}/usr/bin/ld ${CROSSDIR}/usr/bin/${TARGET_CANON}-ld
|
2017-01-04 09:26:02 -08:00
|
|
|
cp -f ${CROSSDIR}/usr/bin/${TARGET_CANON}-clang ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-clang
|
2017-05-23 07:57:30 -07:00
|
|
|
cp -f ${CROSSDIR}/usr/bin/${TARGET_CANON}-ld ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-ld
|
2016-12-18 09:03:08 -08:00
|
|
|
ln -sf ${TARGET_CANON}-cc ${CROSSDIR}/usr/${TARGET_CANON}/bin/cc
|
|
|
|
ln -sf ${TARGET_CANON}-c++ ${CROSSDIR}/usr/${TARGET_CANON}/bin/c++
|
2017-05-23 07:57:30 -07:00
|
|
|
ln -sf ${TARGET_CANON}-ld ${CROSSDIR}/usr/${TARGET_CANON}/bin/ld
|
2017-01-04 09:26:02 -08:00
|
|
|
echo "#!/bin/sh\n${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-clang --sysroot ${CROSSDIR} \"$$""@\"" > ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-cc; \
|
|
|
|
chmod +x ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-cc;
|
|
|
|
echo "#!/bin/sh\n${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-clang --driver-mode=g++ --sysroot ${CROSSDIR} \"$$""@\"" > ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-c++; \
|
|
|
|
chmod +x ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-c++;
|
2016-12-18 09:03:08 -08:00
|
|
|
.elif ${COMPILER_VERSION:L} == "gcc3"
|
2013-08-06 12:11:53 -07:00
|
|
|
(cd ${.CURDIR}/gnu/usr.bin/gcc; \
|
2010-05-31 21:33:40 -07:00
|
|
|
MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
|
|
|
TARGET_ARCH=${TARGET_ARCH} TARGET_CPU=${TARGET_CPU} \
|
|
|
|
CROSSDIR=${CROSSDIR} \
|
2013-08-06 12:11:53 -07:00
|
|
|
PATH=${CROSSPATH} ${MAKE} -f Makefile.bsd-wrapper depend && \
|
2010-05-31 21:33:40 -07:00
|
|
|
MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
|
|
|
TARGET_ARCH=${TARGET_ARCH} TARGET_CPU=${TARGET_CPU} \
|
|
|
|
CROSSDIR=${CROSSDIR} \
|
2017-09-12 01:16:13 -07:00
|
|
|
CC=${CC} CXX=${CXX} \
|
2013-08-06 12:11:53 -07:00
|
|
|
${MAKE} -f Makefile.bsd-wrapper all && \
|
2010-05-31 21:33:40 -07:00
|
|
|
env CROSSDIR=${CROSSDIR} DESTDIR=${CROSSDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
2013-08-06 12:11:53 -07:00
|
|
|
PATH=${CROSSPATH} ${MAKE} -f Makefile.bsd-wrapper install)
|
2010-05-31 21:33:40 -07:00
|
|
|
cp -f ${CROSSDIR}/usr/bin/${TARGET_CANON}-g++ ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-c++
|
2010-09-25 10:45:13 -07:00
|
|
|
cp -f ${CROSSDIR}/usr/bin/gcc ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-cc
|
2013-08-06 12:11:53 -07:00
|
|
|
cp -f ${CROSSDIR}/usr/libexec/cpp ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-libexeccpp
|
|
|
|
rm -f ${CROSSDIR}/usr/bin/gcc ${CROSSDIR}/usr/bin/cc ${CROSSDIR}/usr/libexec/cpp
|
2010-05-31 21:33:40 -07:00
|
|
|
ln -sf ${TARGET_CANON}-cc ${CROSSDIR}/usr/${TARGET_CANON}/bin/cc
|
2013-08-06 12:11:53 -07:00
|
|
|
ln -sf ${TARGET_CANON}-c++ ${CROSSDIR}/usr/${TARGET_CANON}/bin/c++
|
2010-05-31 21:33:40 -07:00
|
|
|
rm -f ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-cpp
|
|
|
|
sed -e 's#/usr/libexec/cpp#${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-libexeccpp#' \
|
2013-08-06 12:11:53 -07:00
|
|
|
-e 's/@GNUC@/-D__GNUC__/' \
|
2010-05-31 21:33:40 -07:00
|
|
|
-e 's#/usr/include#${CROSSDIR}/usr/include#' \
|
|
|
|
-e 's/@dollaropt@//' \
|
|
|
|
${.CURDIR}/usr.bin/cpp/cpp.sh > ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-cpp
|
|
|
|
chmod ${BINMODE} ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-cpp
|
|
|
|
chown ${BINOWN}:${BINGRP} ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-cpp
|
|
|
|
ln -sf ${TARGET_CANON}-cpp ${CROSSDIR}/usr/${TARGET_CANON}/bin/cpp
|
2013-08-06 12:11:53 -07:00
|
|
|
.else
|
|
|
|
(cd ${.CURDIR}/gnu/usr.bin/cc; \
|
2017-03-21 03:41:33 -07:00
|
|
|
env CROSSDIR=${CROSSDIR} \
|
2014-05-09 13:14:18 -07:00
|
|
|
PIE_DEFAULT=${PIE_DEFAULT} \
|
2005-01-09 12:36:20 -08:00
|
|
|
MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
2010-02-05 14:36:27 -08:00
|
|
|
TARGET_ARCH=${TARGET_ARCH} TARGET_CPU=${TARGET_CPU} \
|
2013-08-06 12:11:53 -07:00
|
|
|
MACHINE=${TARGET} \
|
|
|
|
PATH=${CROSSPATH} ${MAKE} depend )
|
|
|
|
(cd ${.CURDIR}/gnu/usr.bin/cc; \
|
2017-03-21 03:41:33 -07:00
|
|
|
env CROSSDIR=${CROSSDIR} \
|
2017-09-12 01:16:13 -07:00
|
|
|
COMPILER_VERSION=${COMPILER_VERSION} \
|
|
|
|
CC=${CC} CXX=${CXX} \
|
2014-05-09 13:14:18 -07:00
|
|
|
PIE_DEFAULT=${PIE_DEFAULT} \
|
2005-01-09 12:36:20 -08:00
|
|
|
MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
2010-02-05 14:36:27 -08:00
|
|
|
TARGET_ARCH=${TARGET_ARCH} TARGET_CPU=${TARGET_CPU} \
|
2013-08-06 12:11:53 -07:00
|
|
|
MACHINE=${TARGET} \
|
|
|
|
${MAKE} all )
|
|
|
|
(cd ${.CURDIR}/gnu/usr.bin/cc; \
|
2014-05-09 13:14:18 -07:00
|
|
|
env CROSSDIR=${CROSSDIR} DESTDIR=${CROSSDIR} \
|
2017-09-12 01:16:13 -07:00
|
|
|
COMPILER_VERSION=${COMPILER_VERSION} \
|
2014-05-09 13:14:18 -07:00
|
|
|
PIE_DEFAULT=${PIE_DEFAULT} \
|
|
|
|
MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
2013-08-06 12:11:53 -07:00
|
|
|
TARGET_ARCH=${TARGET_ARCH} TARGET_CPU=${TARGET_CPU} \
|
|
|
|
MACHINE=${TARGET} \
|
|
|
|
PATH=${CROSSPATH} ${MAKE} install)
|
|
|
|
cp -f ${CROSSDIR}/usr/bin/g++ ${CROSSDIR}/usr/bin/${TARGET_CANON}-g++
|
2008-09-06 09:26:39 -07:00
|
|
|
cp -f ${CROSSDIR}/usr/bin/${TARGET_CANON}-g++ ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-c++
|
|
|
|
cp -f ${CROSSDIR}/usr/libexec/cpp ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-libexeccpp
|
2013-08-06 12:11:53 -07:00
|
|
|
cp -f ${CROSSDIR}/usr/bin/gcc ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-cc
|
2008-09-06 09:26:39 -07:00
|
|
|
ln -sf ${TARGET_CANON}-cc ${CROSSDIR}/usr/${TARGET_CANON}/bin/cc
|
2013-08-06 12:11:53 -07:00
|
|
|
|
|
|
|
cp -f ${CROSSDIR}/usr/bin/gcc ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-cc
|
|
|
|
rm -f ${CROSSDIR}/usr/bin/gcc ${CROSSDIR}/usr/bin/g++ ${CROSSDIR}/usr/bin/cc ${CROSSDIR}/usr/libexec/cpp
|
|
|
|
# fix links
|
2008-09-06 09:26:39 -07:00
|
|
|
rm -f ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-cpp
|
|
|
|
sed -e 's#/usr/libexec/cpp#${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-libexeccpp#' \
|
2013-08-06 12:11:53 -07:00
|
|
|
-e 's/@GNUC@//' \
|
2008-09-06 09:26:39 -07:00
|
|
|
-e 's#/usr/include#${CROSSDIR}/usr/include#' \
|
|
|
|
-e 's/@dollaropt@//' \
|
|
|
|
${.CURDIR}/usr.bin/cpp/cpp.sh > ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-cpp
|
|
|
|
chmod ${BINMODE} ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-cpp
|
|
|
|
chown ${BINOWN}:${BINGRP} ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-cpp
|
|
|
|
ln -sf ${TARGET_CANON}-cpp ${CROSSDIR}/usr/${TARGET_CANON}/bin/cpp
|
2005-01-09 12:36:20 -08:00
|
|
|
.endif
|
|
|
|
@touch ${CROSSGCC}
|
|
|
|
|
|
|
|
# XXX MAKEOBJDIR maybe should be obj.${TARGET} here, revisit later
|
|
|
|
cross-lib: ${CROSSGCC}
|
2010-02-05 14:36:27 -08:00
|
|
|
MACHINE=${TARGET} \
|
2015-06-05 14:48:35 -07:00
|
|
|
MACHINE_ARCH=${TARGET_ARCH} MACHINE_CPU=${TARGET_CPU} \
|
|
|
|
BSDOBJDIR=${CROSSDIR}/usr/obj; \
|
|
|
|
export MACHINE MACHINE_ARCH MACHINE_CPU BSDOBJDIR; \
|
2005-01-09 12:36:20 -08:00
|
|
|
(cd ${.CURDIR}/lib; \
|
2017-05-23 07:57:30 -07:00
|
|
|
for lib in csu libcompiler_rt libc; do \
|
2005-01-09 12:36:20 -08:00
|
|
|
(cd $$lib; \
|
|
|
|
eval ${CROSSENV} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
2012-08-02 06:38:38 -07:00
|
|
|
${MAKE} depend all ;\
|
2008-09-06 09:26:39 -07:00
|
|
|
eval ${CROSSENV} MAKEOBJDIR=obj.${MACHINE}.${TARGET} DESTDIR=${CROSSDIR} \
|
2012-08-02 06:38:38 -07:00
|
|
|
${MAKE} install); \
|
2005-01-09 12:36:20 -08:00
|
|
|
done; \
|
|
|
|
eval ${CROSSENV} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
2015-11-14 15:56:48 -08:00
|
|
|
SKIPDIR=\"${NO_CROSS}\" \
|
2012-08-02 06:38:38 -07:00
|
|
|
${MAKE} depend all ; \
|
2008-09-06 09:26:39 -07:00
|
|
|
eval ${CROSSENV} MAKEOBJDIR=obj.${MACHINE}.${TARGET} DESTDIR=${CROSSDIR} \
|
2015-11-14 15:56:48 -08:00
|
|
|
SKIPDIR=\"${NO_CROSS}\" \
|
2012-08-02 06:38:38 -07:00
|
|
|
${MAKE} install)
|
2005-01-09 12:36:20 -08:00
|
|
|
|
|
|
|
cross-bin: ${CROSSOBJ}
|
2010-02-05 14:36:27 -08:00
|
|
|
MACHINE=${TARGET} \
|
|
|
|
MACHINE_ARCH=${TARGET_ARCH} MACHINE_CPU=${TARGET_CPU}; \
|
|
|
|
export MACHINE MACHINE_ARCH MACHINE_CPU; \
|
2005-01-09 12:36:20 -08:00
|
|
|
for i in libexec bin sbin usr.bin usr.sbin; do \
|
|
|
|
(cd ${.CURDIR}/$$i; \
|
|
|
|
eval ${CROSSENV} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
|
|
|
SKIPDIR=\"${BINUTILS} ${NO_CROSS}\" \
|
2008-09-06 09:26:39 -07:00
|
|
|
${MAKE} depend all ; \
|
|
|
|
eval ${CROSSENV} MAKEOBJDIR=obj.${MACHINE}.${TARGET} DESTDIR=${CROSSDIR} \
|
|
|
|
SKIPDIR=\"${BINUTILS} ${NO_CROSS}\" \
|
|
|
|
${MAKE} install); \
|
|
|
|
done
|
|
|
|
|
|
|
|
cross-gnu: ${CROSSOBJ}
|
2010-02-05 14:36:27 -08:00
|
|
|
MACHINE=${TARGET} \
|
|
|
|
MACHINE_ARCH=${TARGET_ARCH} MACHINE_CPU=${TARGET_CPU}; \
|
|
|
|
export MACHINE MACHINE_ARCH MACHINE_CPU; \
|
2008-09-06 09:26:39 -07:00
|
|
|
for i in gnu/lib gnu/usr.sbin gnu/usr.bin ; do \
|
|
|
|
(cd ${.CURDIR}/$$i; \
|
|
|
|
eval ${CROSSENV} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
|
|
|
SKIPDIR=\"${NO_CROSS}\" \
|
|
|
|
${MAKE} depend all ; \
|
|
|
|
eval ${CROSSENV} MAKEOBJDIR=obj.${MACHINE}.${TARGET} DESTDIR=${CROSSDIR} \
|
|
|
|
SKIPDIR=\"${NO_CROSS}\" \
|
|
|
|
${MAKE} install); \
|
|
|
|
done
|
|
|
|
|
|
|
|
cross-share: ${CROSSOBJ}
|
2010-02-05 14:36:27 -08:00
|
|
|
MACHINE=${TARGET} \
|
|
|
|
MACHINE_ARCH=${TARGET_ARCH} MACHINE_CPU=${TARGET_CPU}; \
|
|
|
|
export MACHINE MACHINE_ARCH MACHINE_CPU; \
|
2008-09-06 09:26:39 -07:00
|
|
|
for i in share; do \
|
|
|
|
(cd ${.CURDIR}/$$i; \
|
|
|
|
eval ${CROSSENV} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
|
|
|
SKIPDIR=\"${NO_CROSS}\" \
|
2015-11-09 19:10:53 -08:00
|
|
|
DESTDIR=${CROSSDIR} \
|
2008-09-06 09:26:39 -07:00
|
|
|
${MAKE} depend all install); \
|
|
|
|
done
|
|
|
|
|
|
|
|
cross-sys: ${CROSSOBJ}
|
2010-02-05 14:36:27 -08:00
|
|
|
MACHINE=${TARGET} \
|
|
|
|
MACHINE_ARCH=${TARGET_ARCH} MACHINE_CPU=${TARGET_CPU}; \
|
|
|
|
export MACHINE MACHINE_ARCH MACHINE_CPU; \
|
2008-09-06 09:26:39 -07:00
|
|
|
for i in sys; do \
|
2017-08-11 12:36:37 -07:00
|
|
|
(cd ${.CURDIR}/$$i; \
|
|
|
|
eval ${CROSSENV} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
|
|
|
SKIPDIR=\"${NO_CROSS}\" \
|
|
|
|
${MAKE} depend all); \
|
2008-09-06 09:26:39 -07:00
|
|
|
(cd ${.CURDIR}/$$i; \
|
|
|
|
eval ${CROSSENV} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
|
|
|
SKIPDIR=\"${NO_CROSS}\" \
|
2015-11-09 19:10:53 -08:00
|
|
|
DESTDIR=${CROSSDIR} \
|
2017-08-11 12:36:37 -07:00
|
|
|
${MAKE} install); \
|
2005-01-09 12:36:20 -08:00
|
|
|
done
|
|
|
|
|
|
|
|
cross-etc-root-var: ${CROSSOBJ}
|
|
|
|
(cd ${.CURDIR}/etc && \
|
2010-02-05 14:36:27 -08:00
|
|
|
MACHINE=${TARGET} \
|
|
|
|
MACHINE_ARCH=${TARGET_ARCH} MACHINE_CPU=${TARGET_CPU} \
|
|
|
|
DESTDIR=${CROSSDIR} \
|
|
|
|
${MAKE} distribution-etc-root-var)
|
2005-01-09 12:36:20 -08:00
|
|
|
|
|
|
|
cross-depend:
|
|
|
|
@(cd ${.CURDIR} && \
|
|
|
|
BSDOBJDIR=${CROSSDIR}/usr/obj \
|
|
|
|
BSDSRCDIR=${.CURDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
|
|
|
SKIPDIR="${NO_CROSS}" \
|
|
|
|
${MAKE} depend)
|
|
|
|
|
|
|
|
cross-clean:
|
|
|
|
@(cd ${.CURDIR} && \
|
|
|
|
BSDOBJDIR=${CROSSDIR}/usr/obj \
|
|
|
|
BSDSRCDIR=${.CURDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
|
|
|
SKIPDIR="${NO_CROSS}" \
|
|
|
|
${MAKE} clean)
|
|
|
|
|
|
|
|
cross-cleandir:
|
|
|
|
@(cd ${.CURDIR} && \
|
|
|
|
BSDOBJDIR=${CROSSDIR}/usr/obj \
|
|
|
|
BSDSRCDIR=${.CURDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
|
|
|
SKIPDIR="${NO_CROSS}" \
|
|
|
|
${MAKE} cleandir)
|