Apple2GSBuildPipeline/make/orca-rez

69 lines
1.3 KiB
Plaintext
Raw Normal View History

2017-05-17 02:34:15 +00:00
#!/bin/bash
ERROUTPUT=/tmp/orca-rez-err.$$
2017-05-17 02:34:15 +00:00
FILENAME="$1"
shift
DESTBASENAME="$1"
shift
2017-05-17 02:34:15 +00:00
if echo $FILENAME | grep -v '\.rez$' > /dev/null
then
echo Expected first argument to be a *.rez file but got $FILENAME
exit 1
fi
SRCBASENAME=`echo $FILENAME | sed 's/\.rez$//'`
SRCOBJNAME="${SRCBASENAME}.r"
2017-05-17 02:34:15 +00:00
DESTDEPSNAME="${DESTBASENAME}.rez.d"
DESTOBJNAME="${DESTBASENAME}.r"
$ORCA --trace-gsos compile "$@" keep="${SRCOBJNAME}" "$FILENAME" 2> $ERROUTPUT
2017-05-17 02:34:15 +00:00
RESULT=$?
awk '
/^[A-Za-z][A-Za-z]*\(.*\)$/ {
next
}
{
print
}
/^File [^ ]*; Line [0-9][0-9]*;/ {
sub(/;/,"",$4)
LINENO=$4
sub(/^File [^ ]*; Line [0-9][0-9]*/, "", $0)
printf("%s/%s:%d:0:%s\n", PWD, FILE, LINENO, $0)
}
' "PWD=`pwd`" "FILE=$FILENAME" $ERROUTPUT >&2
2017-05-17 02:34:15 +00:00
if [ "$RESULT" -ne 0 ]
then
rm -f $ERROUTPUT
rm -f $SRCOBJNAME
2017-05-17 02:34:15 +00:00
exit $RESULT
fi
mkdir -p `dirname "$DESTOBJNAME"`
mv -f "$SRCOBJNAME" "$DESTOBJNAME" 2> /dev/null
2017-05-17 02:34:15 +00:00
DEPS=`awk '
/^FastFileLoad/ {
sub(/^FastFileLoad\(/, "");
sub(/\)$/, "");
print}' $ERROUTPUT | sort -u | while read FILE
2017-05-17 02:34:15 +00:00
do
if [ -f "$FILE" ]
then
echo $FILE
fi
done`
echo $DESTOBJNAME: $DEPS > $DESTDEPSNAME
rm -f $ERROUTPUT
2017-05-17 02:34:15 +00:00
exit 0