#!/bin/bash set -- $@ --end-- proc=MD32 si_revision=0.5 verbose= macros= asm_file= preprocess= while [ a$1 != a--end-- ] ; do if [ a$1 = a-proc ] ; then shift proc=$1 shift elif [ a$1 = a-si-revision ] ; then shift si_revision=$1 shift elif [ a$1 = a-v ] ; then verbose=1 shift elif [[ a$1 == a*.S ]] ; then asm_file=$1 preprocess=1 shift elif [[ a$1 == a*.s ]] ; then asm_file=$1 shift elif [ a$1 = a-D ] ; then shift macros="$macros -D $1" shift elif [[ a$1 == a-D* ]] ; then macros="$macros -D ${1:2}" shift else set -- $@ $1 shift fi done shift case $proc in MS15E30-GNU|MS15E30-NLIB) core_version=MS15E30-GNU;; *) echo "$0: Unknown processor $proc" >&2 exit 1;; esac verbose_run() { if [ a$verbose = a1 ] ; then echo $@ fi $@ } if [ a$preprocess = a1 ] ; then tmp_file=`mktemp /tmp/${asm_file}.XXXXXX` verbose_run "md32-elf-cpp $macros $asm_file $tmp_file" verbose_run "md32-elf-as --md32-core-version=$core_version $tmp_file $@" rm -f $tmp_file else verbose_run "md32-elf-as --md32-core-version=$core_version $asm_file $@" fi