|
|
@@ -3,30 +3,37 @@
|
|
|
# Builds the M2c compiler (step 2: scalars + MC64 backend).
|
|
|
# Requires GNU Modula-2 (gm2) and the Coco/R CR binary.
|
|
|
#
|
|
|
-# Usage: ./build.sh (from the m2c directory)
|
|
|
+# Usage: ./build.sh (from the project root)
|
|
|
#
|
|
|
-# Pipeline: M2c.atg -> M2cS/M2cP/M2c (.mod) -> gm2 -fiso -> ./M2c
|
|
|
+# All sources live in src/ (grammar, frames, hand modules, generated
|
|
|
+# scanner/parser/driver). Build objects (.o) stay in the project root
|
|
|
+# (gm2 -I src drops them in the cwd); the binary links to ./M2c.
|
|
|
+#
|
|
|
+# Pipeline: src/M2c.atg -> src/M2cS/M2cP/M2c (.mod)
|
|
|
+# -> gm2 -fiso -I src -> ./M2c
|
|
|
#
|
|
|
|
|
|
CRBIN="${CRBIN:-/home/eric/Projets/Projets-Modula2/MyWork/CocoGm2/CR}"
|
|
|
|
|
|
echo "=== Regenerating M2cS / M2cP / M2c from M2c.atg ==="
|
|
|
+cd src || exit 1
|
|
|
CRFRAMES="$(pwd)" "$CRBIN" -m -C M2c.atg || exit 1
|
|
|
+cd ..
|
|
|
|
|
|
echo "=== Deleting all o files ==="
|
|
|
rm -f ./*.o
|
|
|
|
|
|
echo "=== Compiling the needed modules ==="
|
|
|
for m in FileIO SymTab MGen M2cS M2cP M2c; do
|
|
|
- gm2 -fiso -c "$m.mod" || exit 1
|
|
|
+ gm2 -fiso -I src -c "src/$m.mod" || exit 1
|
|
|
done
|
|
|
|
|
|
echo "=== Phase 1: generating the module list ==="
|
|
|
-gm2 -fiso -fgen-module-list=modules.lst -o /dev/null \
|
|
|
- M2cS.o M2cP.o FileIO.o SymTab.o MGen.o M2c.mod || exit 1
|
|
|
+gm2 -fiso -I src -fgen-module-list=src/modules.lst -o /dev/null \
|
|
|
+ M2cS.o M2cP.o FileIO.o SymTab.o MGen.o src/M2c.mod || exit 1
|
|
|
|
|
|
echo "=== Phase 2: compiling main module and linking using the module list ==="
|
|
|
-gm2 -fiso -fuse-list=modules.lst -o M2c \
|
|
|
- M2cS.o M2cP.o FileIO.o SymTab.o MGen.o M2c.mod || exit 1
|
|
|
+gm2 -fiso -I src -fuse-list=src/modules.lst -o M2c \
|
|
|
+ M2cS.o M2cP.o FileIO.o SymTab.o MGen.o src/M2c.mod || exit 1
|
|
|
|
|
|
echo "=== M2c built ==="
|