build_gm2.sh 786 B

123456789101112131415161718192021222324
  1. #!/bin/sh
  2. # Builds M2make with GNU Modula-2 (gm2 -fiso).
  3. # Usage: ./build_gm2.sh (from the tools/m2make directory)
  4. # Output: b_gm2/M2make
  5. set -e
  6. cd "$(dirname "$0")"
  7. SRC=../../compiler/src
  8. rm -rf b_gm2
  9. mkdir -p b_gm2
  10. cp M2make.mod M2makeOS.def M2makeC.def m2make_os.c b_gm2/
  11. cp M2makeOS_gm2.mod b_gm2/M2makeOS.mod
  12. cp "$SRC/FileIO.def" "$SRC/FileIO.mod" b_gm2/
  13. cd b_gm2
  14. echo "=== Compiling (gm2) ==="
  15. for m in FileIO M2makeOS M2make; do
  16. gm2 -fiso -c "$m.mod" || exit 1
  17. done
  18. echo "=== Generating module list ==="
  19. gm2 -fiso -fgen-module-list=modules.lst -o /dev/null \
  20. FileIO.o M2makeOS.o M2make.mod m2make_os.c || exit 1
  21. echo "=== Linking ==="
  22. gm2 -fiso -fuse-list=modules.lst -o M2make \
  23. FileIO.o M2makeOS.o M2make.mod m2make_os.c || exit 1
  24. echo "=== b_gm2/M2make built ==="