| 1234567891011121314151617181920212223242526272829303132333435363738 |
- #!/bin/sh
- #
- # Builds the M2comp compiler (step 1: Coco/R syntax front end).
- # Requires GNU Modula-2 (gm2 -fiso) and the Coco/R CR binary.
- #
- # Usage: ./build.sh (from the m2comp directory)
- #
- # All sources live in src/ (grammar, frames, hand modules, generated
- # scanner/parser/driver). The binary links to ./M2comp (project root).
- #
- # Pipeline: src/M2comp.atg -> src/M2compS/M2compP/M2comp (.mod)
- # -> gm2 -fiso -> ./M2comp
- #
- CRBIN="${CRBIN:-/home/eric/Projets/Projets-Modula2/MyWork/CocoGm2/CR}"
- echo "=== Regenerating M2compS / M2compP / M2comp from M2comp.atg ==="
- cd src || exit 1
- CRFRAMES="$(pwd)" "$CRBIN" -m -C M2comp.atg || exit 1
- echo "=== Deleting all o files ==="
- rm -f ./*.o
- echo "=== Compiling the needed modules ==="
- for m in FileIO SymTab AST MGen M2compS M2compP M2comp; do
- gm2 -fiso -c "$m.mod" || exit 1
- done
- echo "=== Phase 1: generating the module list ==="
- gm2 -fiso -fgen-module-list=modules.lst -o /dev/null \
- M2compS.o M2compP.o FileIO.o SymTab.o AST.o MGen.o M2comp.mod || exit 1
- echo "=== Phase 2: compiling main module and linking using the module list ==="
- gm2 -fiso -fuse-list=modules.lst -o ../M2comp \
- M2compS.o M2compP.o FileIO.o SymTab.o AST.o MGen.o M2comp.mod || exit 1
- cd ..
- echo "=== M2comp built ==="
|