File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#! /bin/sh
22# Compile a source file with uvclang and run the result in the UVM VM.
3- # All arguments are forwarded to uvclang, so flags work as usual:
3+ # All arguments are forwarded to uvclang, so flags work as usual. Works from any
4+ # directory; input paths resolve against your current directory:
45# ./build_and_run.sh examples/synth.c
5- # . /build_and_run.sh -O0 tests/printf.c
6+ # uvclang /build_and_run.sh uvclang/ tests/printf.c # e.g. from the repo root
67set -e
7- cd " $( dirname " $0 " ) "
8+
9+ # Resolve this script's directory so we can find the crates and write out.asm
10+ # here regardless of the caller's working directory. We deliberately do NOT cd:
11+ # staying in the caller's directory lets relative input paths resolve naturally
12+ # (uvclang's own include dir is compiled-in absolute, so it needs no cd).
13+ SCRIPT_DIR=" $( cd " $( dirname " $0 " ) " && pwd) "
14+
815export RUST_BACKTRACE=1
9- cargo run -q -- " $@ " -o out.asm
10- exec cargo run -q --manifest-path ../vm/Cargo.toml -- out.asm
16+ cargo run -q --manifest-path " $SCRIPT_DIR /Cargo.toml " -- " $ @" -o " $SCRIPT_DIR / out.asm"
17+ exec cargo run -q --manifest-path " $SCRIPT_DIR / ../vm/Cargo.toml" -- " $SCRIPT_DIR / out.asm"
You can’t perform that action at this time.
0 commit comments