build.sh 987 B

1234567891011121314151617181920212223242526272829303132
  1. #!/bin/sh
  2. #
  3. # Builds the M2c compiler (step 2: scalars + MC64 backend).
  4. # Requires GNU Modula-2 (gm2) and the Coco/R CR binary.
  5. #
  6. # Usage: ./build.sh (from the m2c directory)
  7. #
  8. # Pipeline: M2c.atg -> M2cS/M2cP/M2c (.mod) -> gm2 -fiso -> ./M2c
  9. #
  10. CRBIN="${CRBIN:-/home/eric/Projets/Projets-Modula2/MyWork/CocoGm2/CR}"
  11. echo "=== Regenerating M2cS / M2cP / M2c from M2c.atg ==="
  12. CRFRAMES="$(pwd)" "$CRBIN" -m -C M2c.atg || exit 1
  13. echo "=== Deleting all o files ==="
  14. rm -f ./*.o
  15. echo "=== Compiling the needed modules ==="
  16. for m in FileIO SymTab MGen M2cS M2cP M2c; do
  17. gm2 -fiso -c "$m.mod" || exit 1
  18. done
  19. echo "=== Phase 1: generating the module list ==="
  20. gm2 -fiso -fgen-module-list=modules.lst -o /dev/null \
  21. M2cS.o M2cP.o FileIO.o SymTab.o MGen.o M2c.mod || exit 1
  22. echo "=== Phase 2: compiling main module and linking using the module list ==="
  23. gm2 -fiso -fuse-list=modules.lst -o M2c \
  24. M2cS.o M2cP.o FileIO.o SymTab.o MGen.o M2c.mod || exit 1
  25. echo "=== M2c built ==="