diff --git a/environment.py b/environment.py index fdf0627bf..a1fd4ea53 100755 --- a/environment.py +++ b/environment.py @@ -143,7 +143,7 @@ class GnuCXXCompiler(CXXCompiler): return 'gch' class ArLinker(): - std_flags = ['cr'] + std_flags = ['csr'] def __init__(self, exelist): self.exelist = exelist diff --git a/generators.py b/generators.py index 92bc51822..ce7bd6688 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)