| 12345678910111213141516171819202122232425262728293031 |
- #!/bin/bash
- # TP3 tpshell - two-phase ISO build, exactly the proven CocoGm2 recipe.
- # Phase 1: -fgen-module-list=modules.lst (generates the import closure list)
- # Phase 2: -fuse-list=modules.lst (links using that list)
- # This avoids gm2's whole-program pass-3 identifier cap on compiler-size programs.
- set -u
- D=/home/eric/Projets/Projets-Modula2/MyWork/TP3-comp/shell
- GM2=/home/eric/bin/Modula2/Gm2/bin/gm2
- cd "$D" || exit 9
- FLAGS="-fiso"
- echo "== compiling each module (isolated -c) =="
- for m in Shell Term Posix TextBuf Editor Compiler ; do
- $GM2 $FLAGS -c $m.mod >/tmp/tp_c_$m 2>&1 \
- || { echo "COMPILE_FAIL $m"; grep -m3 "error:" /tmp/tp_c_$m; exit 1; }
- done
- echo "ok: Shell Term Posix TextBuf Editor Compiler"
- echo "== Phase 1: generate module list =="
- rm -f modules.lst
- $GM2 $FLAGS -fgen-module-list=modules.lst -o /dev/null \
- Shell.mod Term.o Posix.o TextBuf.o Editor.o Compiler.o >/tmp/tp_p1 2>&1
- echo "p1_rc=$? list: $(tr '\n' ' ' < modules.lst)"
- echo "== Phase 2: link with the list =="
- rm -f tpshell
- $GM2 $FLAGS -fuse-list=modules.lst -o tpshell \
- Shell.mod Term.o Posix.o TextBuf.o Editor.o Compiler.o >/tmp/tp_p2 2>&1
- echo "p2_rc=$?"
- grep -cE "error:|undefined" /tmp/tp_p2
- ls -l tpshell 2>/dev/null | awk '{print "tpshell bytes:",$5}'
|