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