diff options
author | lloyd <[email protected]> | 2011-12-23 16:31:26 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2011-12-23 16:31:26 +0000 |
commit | b1a36938a25baf867123c1d6619d191e089135ff (patch) | |
tree | af08e6613f5f34ca30a113732ca98bcc5d8a2192 | |
parent | a3d81efbd2c56749d4abf9e6a27cb36cbbb10702 (diff) |
Dirty hack to support multiple 'define' options in a module info file.
If the default value is a list we will append to it instead of
overwriting it. (Previouly, multiple define targets 'worked' with last
one winning as the values were progressively overwritten).
This might be useful for other things, compiler warning options maybe?
-rwxr-xr-x | configure.py | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/configure.py b/configure.py index 876108a9f..123c91259 100755 --- a/configure.py +++ b/configure.py @@ -511,7 +511,13 @@ def lex_me_harder(infofile, to_obj, allowed_groups, name_val_pairs): lexer.lineno) elif token in name_val_pairs.keys(): - to_obj.__dict__[token] = lexer.get_token() + next_val = lexer.get_token() + + if type(to_obj.__dict__[token]) is list: + to_obj.__dict__[token].append(next_val) + else: + to_obj.__dict__[token] = next_val + else: # No match -> error raise LexerError('Bad token "%s"' % (token), lexer.lineno) @@ -533,7 +539,7 @@ class ModuleInfo(object): 'comment'], { 'load_on': 'auto', - 'define': None, + 'define': [], 'uses_tr1': 'false', 'need_isa': None, 'mp_bits': 0 }) @@ -598,6 +604,9 @@ class ModuleInfo(object): def internal_headers(self): return self.header_internal + def defines(self): + return ['HAS_' + d for d in self.define] + def compatible_cpu(self, archinfo, options): arch_name = archinfo.basename @@ -940,10 +949,10 @@ def canon_processor(archinfo, proc): return (ainfo.basename, submodel) logging.debug('Known CPU names: ' + ' '.join( - sorted(sum([[ainfo.basename] + \ - ainfo.aliases + \ - [x for (x,_) in ainfo.all_submodels()] - for ainfo in archinfo.values()], [])))) + sorted(flatten([[ainfo.basename] + \ + ainfo.aliases + \ + [x for (x,_) in ainfo.all_submodels()] + for ainfo in archinfo.values()])))) raise Exception('Unknown or unidentifiable processor "%s"' % (proc)) @@ -1131,8 +1140,7 @@ def create_template_vars(build_config, options, modules, cc, arch, osinfo): 'link_to': ' '.join([cc.add_lib_option + lib for lib in link_to()]), - 'module_defines': make_cpp_macros( - sorted(['HAS_' + m.define for m in modules if m.define])), + 'module_defines': make_cpp_macros(sorted(flatten([m.defines() for m in modules]))), 'target_os_defines': make_cpp_macros(osinfo.defines()), |