#!/bin/sh # Build (and run) toto.mod through the V3 pipeline. # # ./M2 -> gen_ssa/.ssa # qbe -> gen_ssa/.s # cc (+ runtime shim) -> gen_ssa/ # # toto.mod is `MODULE toto;` and imports TestIO, so the session is # TestIO.def, TestIO.mod, then the program module last. # # Usage: ./invoke.sh (from anywhere; it cd's to its own dir) set -e cd "$(dirname "$0")" PROG=toto # output name = module name (lowercase) ./M2 TestIO.def TestIO.mod toto.mod qbe -o "gen_ssa/$PROG.s" "gen_ssa/$PROG.ssa" cc "gen_ssa/$PROG.s" ../runtime/syslib/shim.c -o "gen_ssa/$PROG" -lm echo "--- running gen_ssa/$PROG ---" if "./gen_ssa/$PROG"; then rc=0; else rc=$?; fi echo "exit=$rc"