#!/bin/sh
# This is a script used for cross-compiling.  It sets up the preprocessor
# environment for the desired architecture, after unsetting the one for
# the existing one, before calling the real cpp.
#
# The first argument is the name of the compiling architecture.
# The second argument is the name of the target architecture.
# Both must be have been installed by ../configure.
#
# Note: We are assuming (as is ../configure) that no architecture ends in .undef

CPP="gcc -w -x c -E -U__GNUC__ -nostdinc"

if [ $# -lt 3 ]; then
  echo usage: $0 this_architecture target_architecture
  exit 1
else

SOURCE=$1
TARGET=$2
shift
shift

ARCHDIR=$CYCDIR/config/arch

$CPP -include $SOURCE.undef -include $TARGET $*
fi
