Build rule for static linking and some comments.
This commit is contained in:
parent
3d5dd90432
commit
7b611c2c11
|
@ -143,7 +143,7 @@ class GnuCXXCompiler(CXXCompiler):
|
||||||
return 'gch'
|
return 'gch'
|
||||||
|
|
||||||
class ArLinker():
|
class ArLinker():
|
||||||
std_flags = ['cr']
|
std_flags = ['csr']
|
||||||
|
|
||||||
def __init__(self, exelist):
|
def __init__(self, exelist):
|
||||||
self.exelist = exelist
|
self.exelist = exelist
|
||||||
|
|
|
@ -59,9 +59,28 @@ class NinjaGenerator(Generator):
|
||||||
def generate(self):
|
def generate(self):
|
||||||
outfilename = os.path.join(self.environment.get_build_dir(), self.ninja_filename)
|
outfilename = os.path.join(self.environment.get_build_dir(), self.ninja_filename)
|
||||||
outfile = open(outfilename, 'w')
|
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)
|
self.generate_rules(outfile)
|
||||||
|
|
||||||
def generate_rules(self, 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:
|
for compiler in self.build.compilers:
|
||||||
langname = compiler.get_language()
|
langname = compiler.get_language()
|
||||||
rule = 'rule %s_COMPILER\n' % langname
|
rule = 'rule %s_COMPILER\n' % langname
|
||||||
|
@ -69,7 +88,7 @@ class NinjaGenerator(Generator):
|
||||||
(' '.join(compiler.get_exelist()),\
|
(' '.join(compiler.get_exelist()),\
|
||||||
' '.join(compiler.get_output_flags()),\
|
' '.join(compiler.get_output_flags()),\
|
||||||
' '.join(compiler.get_compile_only_flags()))
|
' '.join(compiler.get_compile_only_flags()))
|
||||||
description = ' description = compiling %s object' % langname
|
description = ' description = Compiling object %s' % langname
|
||||||
outfile.write(rule)
|
outfile.write(rule)
|
||||||
outfile.write(command)
|
outfile.write(command)
|
||||||
outfile.write(description)
|
outfile.write(description)
|
||||||
|
|
Loading…
Reference in New Issue