Made include args always return arrays for consistency.

pull/15/head
Jussi Pakkanen 10 years ago
parent 3ed22fcc56
commit d79b8a19a0
  1. 4
      backends.py
  2. 20
      environment.py
  3. 12
      ninjabackend.py

@ -241,7 +241,7 @@ class Backend():
def get_pch_include_args(self, compiler, target): def get_pch_include_args(self, compiler, target):
args = [] args = []
pchpath = self.get_target_private_dir(target) pchpath = self.get_target_private_dir(target)
includearg = compiler.get_include_arg(pchpath) includeargs = compiler.get_include_args(pchpath)
for lang in ['c', 'cpp']: for lang in ['c', 'cpp']:
p = target.get_pch(lang) p = target.get_pch(lang)
if len(p) == 0: if len(p) == 0:
@ -250,7 +250,7 @@ class Backend():
header = p[0] header = p[0]
args += compiler.get_pch_use_args(pchpath, header) args += compiler.get_pch_use_args(pchpath, header)
if len(args) > 0: if len(args) > 0:
args = [includearg] + args args = includeargs + args
return args return args
def generate_basic_compiler_args(self, target, compiler): def generate_basic_compiler_args(self, target, compiler):

@ -187,8 +187,8 @@ class CCompiler():
def get_std_exe_link_args(self): def get_std_exe_link_args(self):
return [] return []
def get_include_arg(self, path): def get_include_args(self, path):
return '-I' + path return ['-I' + path]
def get_std_shared_lib_link_args(self): def get_std_shared_lib_link_args(self):
return ['-shared'] return ['-shared']
@ -552,8 +552,8 @@ class MonoCompiler():
def get_std_exe_link_args(self): def get_std_exe_link_args(self):
return [] return []
def get_include_arg(self, path): def get_include_args(self, path):
return '' return []
def get_std_shared_lib_link_args(self): def get_std_shared_lib_link_args(self):
return [] return []
@ -694,8 +694,8 @@ class JavaCompiler():
def get_std_exe_link_args(self): def get_std_exe_link_args(self):
return [] return []
def get_include_arg(self, path): def get_include_args(self, path):
return '' return []
def get_std_shared_lib_link_args(self): def get_std_shared_lib_link_args(self):
return [] return []
@ -1228,11 +1228,11 @@ end program prog
return True return True
return False return False
def get_include_arg(self, path): def get_include_args(self, path):
return '-I' + path return ['-I' + path]
def get_module_outdir_arg(self, path): def get_module_outdir_args(self, path):
return '-J' + path return ['-J' + path]
def get_depfile_suffix(self): def get_depfile_suffix(self):
return 'd' return 'd'

@ -1062,7 +1062,7 @@ rule FORTRAN_DEP_HACK
extra_orderdeps = [] extra_orderdeps = []
compiler = self.get_compiler_for_source(src) compiler = self.get_compiler_for_source(src)
commands = self.generate_basic_compiler_args(target, compiler) commands = self.generate_basic_compiler_args(target, compiler)
commands.append(compiler.get_include_arg(self.get_target_private_dir(target))) commands += compiler.get_include_args(self.get_target_private_dir(target))
if isinstance(src, RawFilename): if isinstance(src, RawFilename):
rel_src = src.fname rel_src = src.fname
elif is_generated: elif is_generated:
@ -1100,10 +1100,10 @@ rule FORTRAN_DEP_HACK
for d in i.get_incdirs(): for d in i.get_incdirs():
expdir = os.path.join(basedir, d) expdir = os.path.join(basedir, d)
fulldir = os.path.join(self.environment.get_source_dir(), expdir) fulldir = os.path.join(self.environment.get_source_dir(), expdir)
barg = compiler.get_include_arg(expdir) bargs = compiler.get_include_args(expdir)
sarg = compiler.get_include_arg(fulldir) sargs = compiler.get_include_args(fulldir)
commands.append(barg) commands += bargs
commands.append(sarg) commands += sargs
if self.environment.coredata.use_pch: if self.environment.coredata.use_pch:
commands += self.get_pch_include_args(compiler, target) commands += self.get_pch_include_args(compiler, target)
crstr = '' crstr = ''
@ -1121,7 +1121,7 @@ rule FORTRAN_DEP_HACK
if srcfile == src: if srcfile == src:
depelem = NinjaBuildElement(modfile, 'FORTRAN_DEP_HACK', rel_obj) depelem = NinjaBuildElement(modfile, 'FORTRAN_DEP_HACK', rel_obj)
depelem.write(outfile) depelem.write(outfile)
commands.append(compiler.get_module_outdir_arg(os.path.join(self.get_target_dir(target), target.get_basename() + '.dir'))) commands += compiler.get_module_outdir_args(os.path.join(self.get_target_dir(target), target.get_basename() + '.dir'))
element = NinjaBuildElement(rel_obj, compiler_name, rel_src) element = NinjaBuildElement(rel_obj, compiler_name, rel_src)
for d in header_deps: for d in header_deps:

Loading…
Cancel
Save