Skip to content

Instantly share code, notes, and snippets.

@bluerise

bluerise/armmake

Last active Dec 21, 2017
Embed
What would you like to do?
Wrapper to have make use the correct cross compiler
#!/bin/ksh
MACHINE=armv7
MACHINE_ARCH=arm
MACHINE_COMP=armv7
VERSION=1.0
#this is true for most archs
MACHINE_CPU=${MACHINE_ARCH}
TARGET=${MACHINE}
HOST=$(uname -m)
export MAKEOBJDIR=obj.${HOST}.${MACHINE}
export HOST MACHINE TARGET
ABI=-gnueabihf
CROSSDIR=/usr/cross/${MACHINE}
CROSS=${MACHINE_COMP}-unknown-bitrig${VERSION}${ABI}
PATH=$PATH:${CROSSDIR}/usr/${CROSS}/bin:${CROSSDIR}/usr/bin
export BSDOBJDIR=${CROSSDIR}/usr/obj
MACHINE=${MACHINE} \
MACHINE_ARCH=${MACHINE_ARCH} \
MACHINE_CPU=${MACHINE_CPU} \
CROSSDIR=${CROSSDIR} \
CC=${CROSS}-clang \
CPP=${CROSS}-cpp \
CXX=${CROSS}-clang++ \
AS=${CROSS}-as \
LD=${CROSS}-ld \
SIZE=size \
STRIP=${CROSS}-strip \
OBJDUMP=${CROSS}-objdump \
OBJCOPY=${CROSS}-objcopy \
make \
MACHINE=${MACHINE} \
MACHINE_ARCH=${MACHINE_ARCH} \
OBJMACHINE=${MACHINE_ARCH} \
MAKEOBJDIR=obj.${HOST}.${MACHINE} \
"$@"
@bluerise

This comment has been minimized.

Copy link
Owner Author

@bluerise bluerise commented Dec 5, 2015

To run this on OpenBSD, replace:
MACHINE_COMP=arm
VERSION=5.8
ABI=
CROSS=${MACHINE_COMP}-unknown-openbsd${VERSION}${ABI}
CC=${CROSS}-cc
CXX=${CROSS}-c++ \

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.