#!/bin/sh

# ABLE objcopy wrapper

# Find the able library prefix
if test "x${ABLE_LIB}" = "x"; then
    # The ABLE_LIB isn't set, try the default install path
    ABLE_LIB=/opt/simtec/able
    if [ ! -d "${ABLE_LIB}" ]; then
	# try using the $0 and assuming the library root is above it
	ABLE_LIB=$(dirname $(dirname $(readlink -f "$0")))
	if [ ! -d "${ABLE_LIB}" ]; then
	    echo >&2 ABLE Library path is not valid.
	    exit 2
	fi
    fi
fi
if [ ! -f "${ABLE_LIB}/able-settings.sh" ]; then
    echo >&2 ABLE Library is not correctly installed.
    exit 2
fi

. ${ABLE_LIB}/able-settings.sh

exec ${ABLE_INTERNAL_CROSS}objcopy "$@"
