X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=scons%2Fsource_list.py;h=e16d1f9b6d2b6a31dc387323a88fcf6df94ea2a4;hb=c00ee00031dd38a3c12d6661eba5f43d8a422e02;hp=1d5166ba1fefe34266a676ae8bc8abb55936dede;hpb=4c15a77f27204620ed35d97d75e521ca982e1cc5;p=mesa.git diff --git a/scons/source_list.py b/scons/source_list.py index 1d5166ba1fe..e16d1f9b6d2 100644 --- a/scons/source_list.py +++ b/scons/source_list.py @@ -13,6 +13,7 @@ The goal is to allow Makefile's and SConscript's to share source listing. class SourceListParser(object): def __init__(self): + self.symbol_table = {} self._reset() def _reset(self, filename=None): @@ -20,7 +21,6 @@ class SourceListParser(object): self.line_no = 1 self.line_cont = '' - self.symbol_table = {} def _error(self, msg): raise RuntimeError('%s:%d: %s' % (self.filename, self.line_no, msg)) @@ -63,7 +63,7 @@ class SourceListParser(object): self._error('not a variable definition') if op_pos > 0: - if line[op_pos - 1] in [':', '+']: + if line[op_pos - 1] in [':', '+', '?']: op_pos -= 1 else: self._error('only =, :=, and += are supported') @@ -77,6 +77,9 @@ class SourceListParser(object): self.symbol_table[sym] = val elif op == '+=': self.symbol_table[sym] += ' ' + val + elif op == '?=': + if sym not in self.symbol_table: + self.symbol_table[sym] = val def _parse_line(self, line): """Parse a source list line.""" @@ -122,3 +125,6 @@ class SourceListParser(object): raise return self.symbol_table + + def add_symbol(self, name, value): + self.symbol_table[name] = value