aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/backend/ninjabackend.py
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2019-04-10 15:45:14 +0100
committerJon Turney <jon.turney@dronecode.org.uk>2019-04-23 11:22:51 +0100
commit7bc1db2d7b05836545ef5a9452383a9940c0348c (patch)
tree75bc374186600cfdc208b09cd42b94649da68a16 /mesonbuild/backend/ninjabackend.py
parent42e9028868bdbf0c9e007bf446608c6eba4077bc (diff)
downloadmeson-7bc1db2d7b05836545ef5a9452383a9940c0348c.zip
meson-7bc1db2d7b05836545ef5a9452383a9940c0348c.tar.gz
meson-7bc1db2d7b05836545ef5a9452383a9940c0348c.tar.bz2
ninja: Move things which aren't rules or build statements up to generate()
Diffstat (limited to 'mesonbuild/backend/ninjabackend.py')
-rw-r--r--mesonbuild/backend/ninjabackend.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 89fa543..f1527da 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -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.')