e0/scripts/e0c

26 lines
393 B
Text
Raw Normal View History

2022-06-17 14:50:06 +00:00
#!/usr/bin/env bash
set -e
SOURCE=$?
BITCODE=$(mktemp -d)
OUTPUT=./a.out
usage() { echo "$0 options:" && grep " .)\ #" $0; exit 0; }
[ $# -eq 0 ] && usage
while getopts ":hs:p:" arg; do
case $arg in
o) # Binary output
OUTPUT=${OPTARG}
;;
h | *) # Display help.
usage
exit 0
;;
esac
done
cargo run -- -o $BITCODE $SOURCE
clang -o $OUTPUT $BITCODE