1.1 --- a/generator.py Sat Feb 04 16:28:15 2017 +0100
1.2 +++ b/generator.py Sat Feb 04 16:34:42 2017 +0100
1.3 @@ -425,14 +425,16 @@
1.4 "Write scripts used to build the program."
1.5
1.6 f_native = open(join(self.output, "native.mk"), "w")
1.7 + f_modules = open(join(self.output, "modules.mk"), "w")
1.8 f_options = open(join(self.output, "options.mk"), "w")
1.9 try:
1.10 if debug:
1.11 print >>f_options, "CFLAGS = -g"
1.12
1.13 - # Identify native modules used by the program.
1.14 + # Identify modules used by the program.
1.15
1.16 - native_modules = ["native/common.c"]
1.17 + native_modules = [join("native", "common.c")]
1.18 + modules = []
1.19
1.20 for name in self.importer.modules.keys():
1.21 parts = name.split(".", 1)
1.22 @@ -440,12 +442,16 @@
1.23 # Identify source files to be built.
1.24
1.25 if parts[0] == "native":
1.26 - native_modules.append("native/%s.c" % parts[1])
1.27 + native_modules.append(join("native", "%s.c" % parts[1]))
1.28 + else:
1.29 + modules.append(join("src", "%s.c" % name))
1.30
1.31 print >>f_native, "SRC =", " ".join(native_modules)
1.32 + print >>f_modules, "SRC +=", " ".join(modules)
1.33
1.34 finally:
1.35 f_native.close()
1.36 + f_modules.close()
1.37 f_options.close()
1.38
1.39 def make_literal_constant(self, f_decls, f_defs, n, constant):
2.1 --- a/templates/Makefile Sat Feb 04 16:28:15 2017 +0100
2.2 +++ b/templates/Makefile Sat Feb 04 16:34:42 2017 +0100
2.3 @@ -1,7 +1,8 @@
2.4 include native.mk
2.5 +include modules.mk
2.6 include options.mk
2.7
2.8 -SRC += exceptions.c main.c ops.c progops.c progtypes.c $(wildcard src/*.c)
2.9 +SRC += exceptions.c main.c ops.c progops.c progtypes.c
2.10 OBJ = $(SRC:.c=.o)
2.11 CFLAGS += -Wall -I. -finput-charset=UTF-8
2.12 LDFLAGS += -lm -lgc