25 lines
393 B
Bash
Executable file
25 lines
393 B
Bash
Executable file
#!/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
|