invoke.sh 832 B

1234567891011121314151617181920212223
  1. #!/bin/sh
  2. # Build (and run) toto.mod through the V3 pipeline.
  3. #
  4. # ./M2 <session .def/.mod files> <program.mod> -> gen_ssa/<Module>.ssa
  5. # qbe -> gen_ssa/<Module>.s
  6. # cc (+ runtime shim) -> gen_ssa/<Module>
  7. #
  8. # toto.mod is `MODULE toto;` and imports TestIO, so the session is
  9. # TestIO.def, TestIO.mod, then the program module last.
  10. #
  11. # Usage: ./invoke.sh (from anywhere; it cd's to its own dir)
  12. set -e
  13. cd "$(dirname "$0")"
  14. PROG=toto # output name = module name (lowercase)
  15. ./M2 TestIO.def TestIO.mod toto.mod
  16. qbe -o "gen_ssa/$PROG.s" "gen_ssa/$PROG.ssa"
  17. cc "gen_ssa/$PROG.s" ../runtime/syslib/shim.c -o "gen_ssa/$PROG" -lm
  18. echo "--- running gen_ssa/$PROG ---"
  19. if "./gen_ssa/$PROG"; then rc=0; else rc=$?; fi
  20. echo "exit=$rc"