GM2 = /home/eric/bin/Modula2/Gm2/bin/gm2 CC = cc FLAGS = -fiso # The whole-program link must be two phases. A single invocation trips gm2's # pass-3 rollup on a compiler-size program ("too many errors in pass 3"), so # the import closure is generated first and the link then consumes it. Phase 1 # exiting 1 is the expected rollup, hence the `|| true`. MODS = Shell Term Posix TextBuf Editor Compiler Runtime Linker LINK = Shell.mod Term.o Posix.o TextBuf.o Editor.o Compiler.o Runtime.o Linker.o all: tpshell tpshell: $(MODS:%=%.o) Shell.mod Makefile $(GM2) $(FLAGS) -fgen-module-list=tpshell.lst -o /dev/null $(LINK) || true $(GM2) $(FLAGS) -fuse-list=tpshell.lst -o $@ $(LINK) Shell.o: Shell.mod Term.def Posix.def Editor.def TextBuf.def Compiler.def Linker.def $(GM2) $(FLAGS) -c Shell.mod Term.o: Term.mod Term.def Posix.def $(GM2) $(FLAGS) -c Term.mod TextBuf.o: TextBuf.mod TextBuf.def $(GM2) $(FLAGS) -c TextBuf.mod Editor.o: Editor.mod Editor.def Term.def TextBuf.def Posix.def $(GM2) $(FLAGS) -c Editor.mod Posix.o: Posix.c Posix.def $(CC) -c Posix.c Compiler.o: Compiler.mod Compiler.def TextBuf.def Runtime.def $(GM2) $(FLAGS) -c Compiler.mod Runtime.o: Runtime.mod Runtime.def $(GM2) $(FLAGS) -c Runtime.mod Linker.o: Linker.mod Linker.def Compiler.def Posix.def $(GM2) $(FLAGS) -c Linker.mod clean: rm -f *.o tpshell tpshell.lst .PHONY: all clean