1.1 --- a/common.py Fri Feb 24 13:27:44 2017 +0100
1.2 +++ b/common.py Fri Feb 24 16:13:28 2017 +0100
1.3 @@ -31,7 +31,7 @@
1.4
1.5 "Common output functionality."
1.6
1.7 - def check_output(self):
1.8 + def check_output(self, options=None):
1.9
1.10 "Check the existing output and remove it if irrelevant."
1.11
1.12 @@ -41,10 +41,14 @@
1.13 details = self.importer.get_cache_details()
1.14 recorded_details = self.get_output_details()
1.15
1.16 - if recorded_details != details:
1.17 + # Combine cache details with any options.
1.18 +
1.19 + full_details = options and (details + " " + options) or details
1.20 +
1.21 + if recorded_details != full_details:
1.22 self.remove_output()
1.23
1.24 - writefile(self.get_output_details_filename(), details)
1.25 + writefile(self.get_output_details_filename(), full_details)
1.26
1.27 def get_output_details_filename(self):
1.28
2.1 --- a/generator.py Fri Feb 24 13:27:44 2017 +0100
2.2 +++ b/generator.py Fri Feb 24 16:13:28 2017 +0100
2.3 @@ -82,7 +82,7 @@
2.4
2.5 "Write the generated code."
2.6
2.7 - self.check_output()
2.8 + self.check_output("debug=%r gc_sections=%r" % (debug, gc_sections))
2.9 self.write_structures()
2.10 self.write_scripts(debug, gc_sections)
2.11 self.copy_templates()
3.1 --- a/lplc Fri Feb 24 13:27:44 2017 +0100
3.2 +++ b/lplc Fri Feb 24 16:13:28 2017 +0100
3.3 @@ -293,7 +293,7 @@
3.4 if timings: now = stopwatch("Generation", now)
3.5
3.6 t = translator.Translator(i, d, o, generated_dir)
3.7 - t.to_output()
3.8 + t.to_output(debug, gc_sections)
3.9
3.10 if timings: now = stopwatch("Translation", now)
3.11
4.1 --- a/translator.py Fri Feb 24 13:27:44 2017 +0100
4.2 +++ b/translator.py Fri Feb 24 16:13:28 2017 +0100
4.3 @@ -47,7 +47,7 @@
4.4 self.optimiser = optimiser
4.5 self.output = output
4.6
4.7 - def to_output(self):
4.8 + def to_output(self, debug=False, gc_sections=False):
4.9
4.10 "Write a program to the configured output directory."
4.11
4.12 @@ -60,7 +60,7 @@
4.13
4.14 # Clean the output directory of irrelevant data.
4.15
4.16 - self.check_output()
4.17 + self.check_output("debug=%r gc_sections=%r" % (debug, gc_sections))
4.18
4.19 for module in self.importer.modules.values():
4.20 output_filename = join(output, "%s.c" % module.name)