aboutsummaryrefslogtreecommitdiff
path: root/scripts/run.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/run.sh')
-rwxr-xr-xscripts/run.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/scripts/run.sh b/scripts/run.sh
new file mode 100755
index 0000000..6d71521
--- /dev/null
+++ b/scripts/run.sh
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+root="$(cd "$(dirname "$0")/.." && pwd)"
+cd "$root"
+
+if [ $# -lt 1 ]; then
+ echo "usage: $(basename "$0") <file.hdass>" >&2
+ exit 1
+fi
+
+file="$1"
+name="$(basename "${file%.*}")"
+
+docker compose up -d >/dev/null
+
+docker compose exec -T -e SRC="$file" -e NAME="$name" hdass bash -c '
+ set -e
+ cd /hdass
+ premake5 gmake >/dev/null
+ make config=debug >/dev/null
+ ./bin/debug-linux/hdass "$SRC" -o "/tmp/$NAME.asm"
+ nasm -f elf64 "/tmp/$NAME.asm" -o "/tmp/$NAME.o"
+ ld -e main "/tmp/$NAME.o" -o "/tmp/$NAME"
+ set +e
+ "/tmp/$NAME"
+ printf "\n[exit %s]\n" "$?"
+' </dev/null