# HG changeset patch # User Paul Boddie # Date 1486222482 -3600 # Node ID 22f70469d2f0cfec0af0f794833eedfbaee6fa2c # Parent 2846b907e92b8150af7151e9b51d6d8278f3e620 Explicitly list program modules in an included file, avoiding problems with any obsolete source files still residing amongst the generated sources. diff -r 2846b907e92b -r 22f70469d2f0 generator.py --- a/generator.py Sat Feb 04 16:28:15 2017 +0100 +++ b/generator.py Sat Feb 04 16:34:42 2017 +0100 @@ -425,14 +425,16 @@ "Write scripts used to build the program." f_native = open(join(self.output, "native.mk"), "w") + f_modules = open(join(self.output, "modules.mk"), "w") f_options = open(join(self.output, "options.mk"), "w") try: if debug: print >>f_options, "CFLAGS = -g" - # Identify native modules used by the program. + # Identify modules used by the program. - native_modules = ["native/common.c"] + native_modules = [join("native", "common.c")] + modules = [] for name in self.importer.modules.keys(): parts = name.split(".", 1) @@ -440,12 +442,16 @@ # Identify source files to be built. if parts[0] == "native": - native_modules.append("native/%s.c" % parts[1]) + native_modules.append(join("native", "%s.c" % parts[1])) + else: + modules.append(join("src", "%s.c" % name)) print >>f_native, "SRC =", " ".join(native_modules) + print >>f_modules, "SRC +=", " ".join(modules) finally: f_native.close() + f_modules.close() f_options.close() def make_literal_constant(self, f_decls, f_defs, n, constant): diff -r 2846b907e92b -r 22f70469d2f0 templates/Makefile --- a/templates/Makefile Sat Feb 04 16:28:15 2017 +0100 +++ b/templates/Makefile Sat Feb 04 16:34:42 2017 +0100 @@ -1,7 +1,8 @@ include native.mk +include modules.mk include options.mk -SRC += exceptions.c main.c ops.c progops.c progtypes.c $(wildcard src/*.c) +SRC += exceptions.c main.c ops.c progops.c progtypes.c OBJ = $(SRC:.c=.o) CFLAGS += -Wall -I. -finput-charset=UTF-8 LDFLAGS += -lm -lgc