1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-16 04:29:08 +00:00
trezor-firmware/site_scons/site_tools/micropython/__init__.py

38 lines
1.2 KiB
Python
Raw Normal View History

2017-08-01 16:50:28 +00:00
import SCons.Builder
def generate(env):
env.SetDefault(
QSTRCOL='site_scons/site_tools/micropython/qstrdefs.py', )
env['BUILDERS']['CollectQstr'] = SCons.Builder.Builder(
action='$CC -E $CCFLAGS_QSTR $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES'
' | $PYTHON $QSTRCOL > $TARGET')
env['BUILDERS']['PreprocessQstr'] = SCons.Builder.Builder(
action="cat $SOURCES"
" | $SED 's/^Q(.*)/\"&\"/'"
" | $CC -E $CFLAGS $CCFLAGS $_CCCOMCOM -"
" | $SED 's/^\"\(Q(.*)\)\"/\\1/' > $TARGET", )
env['BUILDERS']['GenerateQstrDefs'] = SCons.Builder.Builder(
action='$MAKEQSTRDATA $SOURCE > $TARGET', )
2017-08-05 08:17:16 +00:00
def generate_frozen_module(source, target, env, for_signature):
target = str(target[0])
source = str(source[0])
source_name = source.replace(env['source_dir'], '')
return '$MPY_CROSS -o %s -s %s %s' % (target, source_name, source)
2017-08-01 16:50:28 +00:00
env['BUILDERS']['FrozenModule'] = SCons.Builder.Builder(
2017-08-05 08:17:16 +00:00
generator=generate_frozen_module,
suffix='.mpy',
single_source=True, )
2017-08-01 16:50:28 +00:00
env['BUILDERS']['FrozenCFile'] = SCons.Builder.Builder(
action='$MPY_TOOL -f -q $qstr_header $SOURCES > $TARGET', )
2017-08-01 16:50:28 +00:00
def exists(env):
return True