2012-08-22 23:22:51 -07:00
|
|
|
# $OpenBSD: Makefile.cross,v 1.56 2012/08/23 06:22:51 deraadt 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.
|
2009-09-21 12:44:23 -07:00
|
|
|
.if (${TARGET} == "armish" || ${TARGET} == "beagle" || \
|
2010-05-31 10:38:03 -07:00
|
|
|
${TARGET} == "gumstix" || ${TARGET} == "palm" || \
|
|
|
|
${TARGET} == "zaurus")
|
2005-09-11 16:10:07 -07:00
|
|
|
TARGET_ARCH= arm
|
2012-06-20 11:45:44 -07:00
|
|
|
.elif (${TARGET} == "hp300" || ${TARGET} == "mvme68k")
|
2005-09-11 16:10:07 -07:00
|
|
|
TARGET_ARCH= m68k
|
2006-05-09 14:17:11 -07:00
|
|
|
.elif (${TARGET} == "aviion" || ${TARGET} == "luna88k" || \
|
|
|
|
${TARGET} == "mvme88k")
|
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
|
2006-12-19 15:17:54 -08:00
|
|
|
.elif (${TARGET} == "solbourne")
|
|
|
|
TARGET_ARCH= sparc
|
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?
|
|
|
|
LP64_ARCH = amd64 alpha hppa64 ia64 mips64 sparc64 vax64
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
# XXX
|
|
|
|
BINMODE?=555
|
|
|
|
BINOWN?=root
|
2011-06-16 03:09:51 -07:00
|
|
|
BINGRP?=bin
|
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}\" \
|
|
|
|
LDFLAGS=\"${CROSSLDFLAGS}\"
|
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
|
|
|
OLD_BINUTILS_ARCH=m68k m88k vax
|
|
|
|
|
|
|
|
.for _arch in ${TARGET_ARCH}
|
|
|
|
.if !empty(GCC2_ARCH:M${_arch})
|
|
|
|
COMPILER_VERSION?=gcc2
|
|
|
|
.elif !empty(GCC4_ARCH:M${_arch})
|
|
|
|
COMPILER_VERSION?=gcc4
|
2010-05-31 21:33:40 -07:00
|
|
|
.else
|
2011-07-04 17:15:03 -07:00
|
|
|
COMPILER_VERSION?=gcc3
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !empty(BINUTILS217_ARCH:M${_arch})
|
|
|
|
BINUTILS_VERSION=binutils-2.17
|
|
|
|
.else
|
|
|
|
BINUTILS_VERSION=binutils
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !empty(OLD_BINUTILS_ARCH:M${_arch})
|
|
|
|
NEW_BINUTILS?= No
|
|
|
|
BINUTILS= ar as ld nm ranlib objcopy objdump strings strip
|
|
|
|
.else
|
|
|
|
NEW_BINUTILS?= Yes
|
|
|
|
BINUTILS= ar as gasp ld nm objcopy objdump ranlib readelf size \
|
|
|
|
strings strip
|
2010-05-31 21:33:40 -07:00
|
|
|
.endif
|
2011-07-04 17:15:03 -07:00
|
|
|
BINUTILS_DIR=gnu/usr.bin/${BINUTILS_VERSION}
|
|
|
|
.endfor
|
2010-05-31 21:33:40 -07:00
|
|
|
|
2005-01-10 09:47:15 -08:00
|
|
|
# no libcrypto.... these won't build
|
2008-09-06 09:26:39 -07:00
|
|
|
#NO_CROSS+= dc login_krb5 login_krb5-or-pwd passwd ppp tcpdump telnet \
|
|
|
|
# ftp gzsig sasyncd vnconfig
|
|
|
|
|
2005-01-10 09:47:15 -08:00
|
|
|
# explicit cross-compile
|
|
|
|
NO_CROSS+=bind
|
2008-09-06 09:26:39 -07:00
|
|
|
NO_CROSS+=httpd
|
|
|
|
NO_CROSS+=microcode
|
2011-07-04 17:15:03 -07:00
|
|
|
NO_CROSS+=groff lynx binutils binutils-2.17 perl texinfo gcc cvs
|
2010-09-19 21:49:08 -07:00
|
|
|
NO_CROSS+=nsd
|
2012-04-06 07:55:51 -07:00
|
|
|
NO_CROSS+=nginx
|
2012-07-13 08:54:10 -07:00
|
|
|
NO_CROSS+=sqlite3
|
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"
|
|
|
|
# this config is allowed
|
|
|
|
.elif ${TARGET_IS_LP64} != ${MACHINE_IS_LP64}
|
2011-09-23 01:09:20 -07:00
|
|
|
@echo "host and target have different size longs"
|
|
|
|
@echo "cross compiler generates bad code; aborting"; exit 1
|
|
|
|
.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
|
|
|
|
@(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}; \
|
2005-01-09 12:36:20 -08:00
|
|
|
MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
2006-05-04 12:41:06 -07:00
|
|
|
USING_NEW_BINUTILS=${NEW_BINUTILS} \
|
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 && \
|
|
|
|
MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
2006-05-04 12:41:06 -07:00
|
|
|
USING_NEW_BINUTILS=${NEW_BINUTILS} \
|
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 && \
|
|
|
|
DESTDIR=${CROSSDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
2010-05-31 21:33:40 -07:00
|
|
|
COMPILER_VERSION=${COMPILER_VERSION} \
|
2006-05-04 12:41:06 -07:00
|
|
|
USING_NEW_BINUTILS=${NEW_BINUTILS} \
|
2010-02-05 14:36:27 -08:00
|
|
|
MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
|
|
|
USING_NEW_BINUTILS=${NEW_BINUTILS} \
|
|
|
|
TARGET_ARCH=${TARGET_ARCH} TARGET_CPU=${TARGET_CPU} \
|
2005-01-09 12:36:20 -08:00
|
|
|
${MAKE} -f Makefile.bsd-wrapper install)
|
2006-05-04 12:41:06 -07:00
|
|
|
.if ${NEW_BINUTILS:L} != "yes"
|
2005-01-09 12:36:20 -08:00
|
|
|
(cd ${.CURDIR}/gnu/usr.bin/gas; \
|
2005-01-10 09:47:15 -08:00
|
|
|
TARGET_MACHINE_ARCH=${TARGET_ARCH} \
|
2005-01-09 12:36:20 -08:00
|
|
|
MAKEOBJDIR=obj.${MACHINE}.${TARGET} ${MAKE} depend all; \
|
2005-01-10 09:47:15 -08:00
|
|
|
TARGET_MACHINE_ARCH=${TARGET_ARCH} \
|
2005-01-09 12:36:20 -08:00
|
|
|
DESTDIR=${CROSSDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
|
|
|
${MAKE} NOMAN= install)
|
|
|
|
ln -sf ${CROSSDIR}/usr/bin/as \
|
2005-09-11 16:08:30 -07:00
|
|
|
${CROSSDIR}/usr/${TARGET_CANON}/bin/as
|
2005-01-09 12:36:20 -08:00
|
|
|
(cd ${.CURDIR}/gnu/usr.bin/ld; \
|
2005-01-10 09:47:15 -08:00
|
|
|
TARGET_MACHINE_ARCH=${TARGET_ARCH} \
|
2005-01-09 12:36:20 -08:00
|
|
|
MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
|
|
|
${MAKE} NOPIC= NOMAN= depend all; \
|
2005-01-10 09:47:15 -08:00
|
|
|
TARGET_MACHINE_ARCH=${TARGET_ARCH} \
|
2005-01-09 12:36:20 -08:00
|
|
|
DESTDIR=${CROSSDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
|
|
|
${MAKE} NOPIC= NOMAN= install)
|
|
|
|
ln -sf ${CROSSDIR}/usr/bin/ld \
|
2005-01-10 09:47:15 -08:00
|
|
|
${CROSSDIR}/usr/${TARGET_CANON}/bin/ld
|
2005-01-09 12:36:20 -08:00
|
|
|
(cd ${.CURDIR}/usr.bin/ar; \
|
2006-04-19 11:32:39 -07:00
|
|
|
ELF_TOOLCHAIN=no \
|
2005-01-09 12:36:20 -08:00
|
|
|
MAKEOBJDIR=obj.${MACHINE}.${TARGET} ${MAKE} NOMAN= depend all; \
|
2006-04-19 11:32:39 -07:00
|
|
|
ELF_TOOLCHAIN=no \
|
2005-01-09 12:36:20 -08:00
|
|
|
DESTDIR=${CROSSDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
|
|
|
${MAKE} NOMAN= install)
|
|
|
|
ln -sf ${CROSSDIR}/usr/bin/ar \
|
2005-01-10 09:47:15 -08:00
|
|
|
${CROSSDIR}/usr/${TARGET_CANON}/bin/ar
|
2010-05-31 21:33:40 -07:00
|
|
|
@(cd ${.CURDIR}/usr.bin/ranlib; \
|
2006-04-19 11:32:39 -07:00
|
|
|
ELF_TOOLCHAIN=no \
|
2005-01-09 12:36:20 -08:00
|
|
|
MAKEOBJDIR=obj.${MACHINE}.${TARGET} ${MAKE} NOMAN= depend all; \
|
2006-04-19 11:32:39 -07:00
|
|
|
ELF_TOOLCHAIN=no \
|
2005-01-09 12:36:20 -08:00
|
|
|
DESTDIR=${CROSSDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
|
|
|
${MAKE} NOMAN= install)
|
|
|
|
ln -sf ${CROSSDIR}/usr/bin/ranlib \
|
2005-01-10 09:47:15 -08:00
|
|
|
${CROSSDIR}/usr/${TARGET_CANON}/bin/ranlib
|
2005-01-09 12:36:20 -08:00
|
|
|
(cd ${.CURDIR}/usr.bin/strip; \
|
|
|
|
MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
2005-01-10 09:47:15 -08:00
|
|
|
${MAKE} TARGET_MACHINE_ARCH=${TARGET_ARCH} \
|
2005-01-09 12:36:20 -08:00
|
|
|
NOMAN= depend all; \
|
|
|
|
DESTDIR=${CROSSDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
2005-01-10 09:47:15 -08:00
|
|
|
${MAKE} TARGET_MACHINE_ARCH=${TARGET_ARCH} \
|
2005-01-09 12:36:20 -08:00
|
|
|
NOMAN= install)
|
|
|
|
ln -sf ${CROSSDIR}/usr/bin/strip \
|
2005-01-10 09:47:15 -08:00
|
|
|
${CROSSDIR}/usr/${TARGET_CANON}/bin/strip
|
2005-01-09 12:36:20 -08:00
|
|
|
.endif
|
|
|
|
@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}
|
2010-05-31 21:33:40 -07:00
|
|
|
.if ${COMPILER_VERSION:L} == "gcc4"
|
|
|
|
(cd ${.CURDIR}/gnu/usr.bin/cc; \
|
|
|
|
MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
|
|
|
TARGET_ARCH=${TARGET_ARCH} TARGET_CPU=${TARGET_CPU} \
|
|
|
|
CROSSDIR=${CROSSDIR} \
|
|
|
|
MACHINE=${TARGET} \
|
|
|
|
PATH=${CROSSPATH} ${MAKE} depend )
|
|
|
|
(cd ${.CURDIR}/gnu/usr.bin/cc; \
|
|
|
|
MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
|
|
|
TARGET_ARCH=${TARGET_ARCH} TARGET_CPU=${TARGET_CPU} \
|
|
|
|
CROSSDIR=${CROSSDIR} \
|
|
|
|
MACHINE=${TARGET} \
|
|
|
|
${MAKE} all )
|
|
|
|
(cd ${.CURDIR}/gnu/usr.bin/cc; \
|
|
|
|
env CROSSDIR=${CROSSDIR} DESTDIR=${CROSSDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
|
|
|
TARGET_ARCH=${TARGET_ARCH} TARGET_CPU=${TARGET_CPU} \
|
|
|
|
MACHINE=${TARGET} \
|
|
|
|
PATH=${CROSSPATH} ${MAKE} install)
|
2010-09-25 10:45:13 -07:00
|
|
|
cp -f ${CROSSDIR}/usr/bin/g++ ${CROSSDIR}/usr/bin/${TARGET_CANON}-g++
|
2010-05-31 21:33:40 -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
|
2010-09-25 10:45:13 -07:00
|
|
|
cp -f ${CROSSDIR}/usr/bin/gcc ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-cc
|
2010-05-31 21:33:40 -07:00
|
|
|
ln -sf ${TARGET_CANON}-cc ${CROSSDIR}/usr/${TARGET_CANON}/bin/cc
|
2010-09-25 10:45:13 -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
|
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#' \
|
2010-07-09 10:36:08 -07:00
|
|
|
-e 's/@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
|
|
|
|
.elif ${COMPILER_VERSION:L} == "gcc3"
|
2005-01-09 12:36:20 -08:00
|
|
|
(cd ${.CURDIR}/gnu/usr.bin/gcc; \
|
|
|
|
MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
2010-02-05 14:36:27 -08:00
|
|
|
TARGET_ARCH=${TARGET_ARCH} TARGET_CPU=${TARGET_CPU} \
|
|
|
|
CROSSDIR=${CROSSDIR} \
|
2008-09-06 09:26:39 -07:00
|
|
|
PATH=${CROSSPATH} ${MAKE} -f Makefile.bsd-wrapper depend && \
|
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} \
|
|
|
|
CROSSDIR=${CROSSDIR} \
|
2005-01-09 12:36:20 -08:00
|
|
|
${MAKE} -f Makefile.bsd-wrapper all && \
|
2008-09-06 09:26:39 -07:00
|
|
|
env CROSSDIR=${CROSSDIR} DESTDIR=${CROSSDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
|
|
|
PATH=${CROSSPATH} ${MAKE} -f Makefile.bsd-wrapper install)
|
|
|
|
cp -f ${CROSSDIR}/usr/bin/${TARGET_CANON}-g++ ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-c++
|
|
|
|
cp -f ${CROSSDIR}/usr/bin/gcc ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-cc
|
|
|
|
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
|
|
|
|
ln -sf ${TARGET_CANON}-cc ${CROSSDIR}/usr/${TARGET_CANON}/bin/cc
|
|
|
|
ln -sf ${TARGET_CANON}-c++ ${CROSSDIR}/usr/${TARGET_CANON}/bin/c++
|
|
|
|
rm -f ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-cpp
|
|
|
|
sed -e 's#/usr/libexec/cpp#${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-libexeccpp#' \
|
2010-07-09 10:36:08 -07:00
|
|
|
-e 's/@GNUC@/-D__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
|
|
|
.else
|
|
|
|
(cd ${CROSSDIR}/usr/obj/gnu/egcs/gcc; \
|
|
|
|
/bin/sh ${.CURDIR}/gnu/egcs/gcc/configure \
|
|
|
|
--with-gnu-as --with-gnu-ld --prefix ${CROSSDIR}/usr \
|
2005-01-10 09:47:15 -08:00
|
|
|
--target ${TARGET_CANON} \
|
2005-01-09 12:36:20 -08:00
|
|
|
--enable-languages="c,c++" --enable-cpp --disable-nls \
|
|
|
|
--with-gxx-include-dir=${CROSSDIR}/usr/include/g++ && \
|
|
|
|
PATH=${CROSSPATH} ${MAKE} BISON=yacc LANGUAGES="${CROSSLANGS}" \
|
|
|
|
CFLAGS="${CFLAGS} -I${.CURDIR}/gnu/lib/libiberty/include" \
|
|
|
|
LIBIBERTY_INCLUDES=${.CURDIR}/gnu/lib/libiberty/include \
|
|
|
|
DEMANGLER_PROG= DEMANGLE_H= LDFLAGS="${LDSTATIC}" build_infodir=. \
|
|
|
|
GCC_FOR_TARGET="./xgcc -B./ -I${CROSSDIR}/usr/include" && \
|
|
|
|
${MAKE} BISON=yacc LANGUAGES="${CROSSLANGS}" LDFLAGS="${LDSTATIC}" \
|
|
|
|
GCC_FOR_TARGET="./xgcc -B./ -I${CROSSDIR}/usr/include" \
|
|
|
|
CFLAGS="${CFLAGS} -I${.CURDIR}/gnu/lib/libiberty/include" \
|
|
|
|
LIBIBERTY_INCLUDES=${.CURDIR}/gnu/lib/libiberty/include \
|
|
|
|
build_infodir=. INSTALL_MAN= INSTALL_HEADERS_DIR= install)
|
2008-09-06 09:26:39 -07:00
|
|
|
mv -f ${CROSSDIR}/usr/bin/cpp ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-libexeccpp
|
|
|
|
rm -f ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-cpp
|
|
|
|
sed -e 's#/usr/libexec/cpp#${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-libexeccpp#' \
|
2010-07-09 10:36:08 -07:00
|
|
|
-e 's/@GNUC@/-D__GNUC__/' \
|
2005-01-09 12:36:20 -08:00
|
|
|
-e 's#/usr/include#${CROSSDIR}/usr/include#' \
|
2008-09-06 09:26:39 -07:00
|
|
|
-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
|
|
|
|
ln -sf gcc ${CROSSDIR}/usr/${TARGET_CANON}/bin/cc
|
|
|
|
ln -sf gcc ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-cc
|
|
|
|
cp -f ${CROSSDIR}/usr/bin/${TARGET_CANON}-g++ ${CROSSDIR}/usr/${TARGET_CANON}/bin/${TARGET_CANON}-c++
|
|
|
|
ln -sf ${TARGET_CANON}-c++ ${CROSSDIR}/usr/${TARGET_CANON}/bin/c++
|
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} \
|
|
|
|
MACHINE_ARCH=${TARGET_ARCH} MACHINE_CPU=${TARGET_CPU}; \
|
|
|
|
export MACHINE MACHINE_ARCH MACHINE_CPU; \
|
2005-01-09 12:36:20 -08:00
|
|
|
(cd ${.CURDIR}/lib; \
|
|
|
|
for lib in csu libc; do \
|
|
|
|
(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} \
|
|
|
|
SKIPDIR=\"${NO_CROSS} libocurses/PSD.doc\" \
|
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} \
|
|
|
|
SKIPDIR=\"${NO_CROSS} libocurses/PSD.doc\" \
|
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}\" \
|
|
|
|
${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 \
|
|
|
|
(cd ${.CURDIR}/$$i; \
|
|
|
|
eval ${CROSSENV} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
|
|
|
|
SKIPDIR=\"${NO_CROSS}\" \
|
|
|
|
${MAKE} depend all 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)
|