-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·39 lines (35 loc) · 921 Bytes
/
Copy pathrun.sh
File metadata and controls
executable file
·39 lines (35 loc) · 921 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bash
# Build and run zscript via Make (see Makefile targets: release, debug, run).
# default: make run (debug build, then ASAN_OPTIONS + LC_ALL as in Makefile "run")
# --release: make release
# --compile: make debug (build only)
# --dbg: make debug; gdb … (Makefile has no gdb target; convenience only)
set -e
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$ROOT"
# clear exits non-zero without a TTY; do not trip `set -e`
if [[ -t 1 ]]; then clear; fi
if [[ "${1:-}" == "--format" ]]; then
echo "Running clang-format..."
find src -type f \( -name '*.c' -o -name '*.h' \) -print0 | xargs -0 clang-format -i
clang-format -i main.c
echo "Formatting complete."
exit 0
fi
case "${1:-}" in
--release)
make release
exit 0
;;
--compile)
make debug
exit 0
;;
--dbg)
make debug
gdb -ex run -ex bt --args "$ROOT/dist/zscript.exe" --run "${2:-}"
;;
*)
make run
;;
esac