aboutsummaryrefslogtreecommitdiff
path: root/fe
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi92@disroot.org>2026-05-09 02:56:07 +0200
committerXavier Del Campo Romero <xavi92@disroot.org>2026-09-05 02:06:24 +0200
commit3d55352ca4e7fbe9c2e919696f85328433385235 (patch)
tree283e0d98ecfff4e2775d9bc0538f6f7dea184e8e /fe
downloadprc-3d55352ca4e7fbe9c2e919696f85328433385235.tar.gz
Add project skeletonsingledir
Diffstat (limited to 'fe')
-rwxr-xr-xfe27
1 files changed, 27 insertions, 0 deletions
diff --git a/fe b/fe
new file mode 100755
index 0000000..f6d9270
--- /dev/null
+++ b/fe
@@ -0,0 +1,27 @@
+#! /bin/sh
+
+set -e
+test $# -ne 1 && (echo "$0 <file>"; exit 1)
+
+musl=${musl:-$HOME/musl}
+qbeo=$(mktemp).qbe
+tmp=$(mktemp).s
+obj=$(basename $1 .uc).o
+
+if [ -f ./build/prc ]
+then
+ ./build/prc $1 > $qbeo
+elif [ -f ./prc ]
+then
+ ./prc $1 > $qbeo
+else
+ echo "cannot find prc executable in either $PWD/prc or $PWD/build/prc" >&2
+ exit 1
+fi
+
+# uncomment to print out qbe IL output
+cat $qbeo
+qbe -o $tmp $qbeo
+as -o $obj $tmp
+ld -static -z nodefaultlib --gc-sections -o a.out -L $musl/lib/ $musl/lib/crt* $obj -lc
+rm $tmp $qbeo