6 from SCons.Builder
import Builder
10 reg_re = re.compile(
r'^\s*(REG_[A-Z0-9_]+\s*\([\S ]+\))', re.M)
13 def build_map(target, source, env):
17 map_file = open(str(target[0]),
'w')
21 for source_file
in source:
23 if str(source_file).endswith(env.subst(
'$SHLIBSUFFIX')):
26 contents = source_file.get_text_contents()
27 for entry
in reg_re.findall(contents):
28 map_file.write(entry +
'\n')
34 return "Module map file empty. Did you forget REG_MODULE(...) in your module source file?"
40 map_builder = Builder(action=build_map)
41 map_builder.action.cmdstr =
'${MAPCOMSTR}'
45 env[
'BUILDERS'][
'RegMap'] = map_builder