26 lines
393 B
Text
26 lines
393 B
Text
|
#!/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
|