ninja: Move things which aren't rules or build statements up to generate()
@@ -220,6 +220,14 @@ int dummy;
outfile.write('# It is autogenerated by the Meson build system.\n')
outfile.write('# Do not edit by hand.\n\n')
outfile.write('ninja_required_version = 1.5.1\n\n')
+
+ num_pools = self.environment.coredata.backend_options['backend_max_links'].value
+ if num_pools > 0:
+ outfile.write('''pool link_pool
+ depth = %d
+
+''' % num_pools)
+
with self.detect_vs_dep_prefix(tempfilename) as outfile:
self.generate_rules(outfile)
self.generate_phony(outfile)
@@ -238,6 +246,8 @@ int dummy;
outfile.write('# Suffix\n\n')
self.generate_utils(outfile)
self.generate_ending(outfile)
+ default = 'default all\n\n'
+ outfile.write(default)
# Only overwrite the old build file after the new one has been
# fully created.
os.replace(tempfilename, outfilename)
@@ -774,12 +784,6 @@ int dummy;
outfile.write('# Rules for compiling.\n\n')
self.generate_compile_rules(outfile)
outfile.write('# Rules for linking.\n\n')
- num_pools = self.environment.coredata.backend_options['backend_max_links'].value
- if num_pools > 0:
- outfile.write('''pool link_pool
- depth = %d
-
-''' % num_pools)
if self.environment.is_cross_build():
self.generate_static_link_rules(True, outfile)
self.generate_static_link_rules(False, outfile)
@@ -2706,9 +2710,6 @@ rule FORTRAN_DEP_HACK%s
elem = NinjaBuildElement(self.all_outputs, 'all', 'phony', targetlist)
elem.write(outfile)
- default = 'default all\n\n'
- outfile.write(default)
-
elem = NinjaBuildElement(self.all_outputs, 'meson-clean', 'CUSTOM_COMMAND', 'PHONY')
elem.add_item('COMMAND', [self.ninja_command, '-t', 'clean'])
elem.add_item('description', 'Cleaning.')
