aboutsummaryrefslogtreecommitdiff
path: root/generators.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2013-02-06 20:15:07 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2013-02-06 20:15:07 +0200
commit7b611c2c11591c9dfd184e221ff22b1aae1af4da (patch)
treed0f1db098ab886200d5e51a46b83657f97749a85 /generators.py
parent3d5dd90432e5b18cc0d80ac562410776f93c9449 (diff)
downloadmeson-7b611c2c11591c9dfd184e221ff22b1aae1af4da.zip
meson-7b611c2c11591c9dfd184e221ff22b1aae1af4da.tar.gz
meson-7b611c2c11591c9dfd184e221ff22b1aae1af4da.tar.bz2
Build rule for static linking and some comments.
Diffstat (limited to 'generators.py')
-rwxr-xr-xgenerators.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/generators.py b/generators.py
index 92bc518..ce7bd66 100755
--- a/generators.py
+++ b/generators.py
@@ -59,9 +59,28 @@ class NinjaGenerator(Generator):
def generate(self):
outfilename = os.path.join(self.environment.get_build_dir(), self.ninja_filename)
outfile = open(outfilename, 'w')
+ outfile.write('# This is the build file for project "%s"\n' % self.build.get_project())
+ outfile.write('# It is autogenerated. Do not edit by hand.\n\n')
self.generate_rules(outfile)
def generate_rules(self, outfile):
+ self.generate_compile_rules(outfile)
+ self.generate_link_rules(outfile)
+
+ def generate_link_rules(self, outfile):
+ outfile.write('# Rules for linking.\n\n')
+ static_linker = self.build.static_linker
+ rule = 'rule STATIC_LINKER\n'
+ command = ' command = %s %s $out $LINK_FLAGS $in\n' % \
+ (' '.join(static_linker.get_exelist()),\
+ ' '.join(static_linker.get_std_link_flags()))
+ description = ' description = Static linking library $out\n\n'
+ outfile.write(rule)
+ outfile.write(command)
+ outfile.write(description)
+
+ def generate_compile_rules(self, outfile):
+ outfile.write('# Rules for compiling.\n\n')
for compiler in self.build.compilers:
langname = compiler.get_language()
rule = 'rule %s_COMPILER\n' % langname
@@ -69,7 +88,7 @@ class NinjaGenerator(Generator):
(' '.join(compiler.get_exelist()),\
' '.join(compiler.get_output_flags()),\
' '.join(compiler.get_compile_only_flags()))
- description = ' description = compiling %s object' % langname
+ description = ' description = Compiling object %s' % langname
outfile.write(rule)
outfile.write(command)
outfile.write(description)