RVBTCC/run.sh
2025-03-09 22:28:36 +08:00

17 lines
No EOL
345 B
Bash

if [ $(uname -m) != "riscv64" ]; then
function compile_and_run() {
riscv64-linux-gnu-gcc-12 -static $1.s -o $1.elf
qemu-riscv64 $1.elf
}
else
function compile_and_run() {
gcc $1.s -o $1.elf
./$1.elf
}
fi
gcc boot.c -o boot.elf &&
./boot.elf < $1 > $1.s &&
compile_and_run $1
echo $?
rm $1.s $1.elf boot.elf 2> /dev/null