blob: f0068e20dd1180a0a46ea4a75afcb5b0b5329b78 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
"""SCons.Tool.asn1
Tool-specific initialization for ASN1
"""
import SCons.Defaults
import SCons.Util
import re
output_re = re.compile(r'^([A-Za-z0-9_-]+)[ \t]*::=', re.M)
def asn1_emitter(target,source,env):
targets = []
for s in source:
node = env.File(s)
contents = node.get_contents()
for j in output_re.findall(contents):
targets.append(str(node.get_dir()) + '/asn1_' + j + '.c')
return targets, source
asn1_builder = SCons.Builder.Builder(action='$ASN1COM',
src_suffix = '.asn1',
suffix='.c',
emitter = asn1_emitter)
def generate(env):
env['ASN1'] = './bin/asn1_compile'
env['ASN1COM'] = '$ASN1 $SOURCE'
env['BUILDERS']['ASN1'] = asn1_builder
def exists(env):
return env.Detect('asn1_compile')
|