From 9b03a16b43d1042d41ecbea5b0b060fbe6241b49 Mon Sep 17 00:00:00 2001 From: Jan Pochyla Date: Wed, 2 Aug 2017 23:42:04 +0200 Subject: [PATCH] scons: fix FrozenModule, simplify usage --- SConscript | 19 ++++++++++++------- site_scons/site_tools/micropython/__init__.py | 8 +++++--- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/SConscript b/SConscript index 5abaaa5d7..0d2844c71 100644 --- a/SConscript +++ b/SConscript @@ -456,7 +456,6 @@ SOURCE_PY = [ ] env = Environment( - VARIANT_DIR='build', SED='sed', AS='arm-none-eabi-as', AR='arm-none-eabi-ar', @@ -518,15 +517,19 @@ hdr_version = env.Command( # Qstrings # +qstr_micropython = 'vendor/micropython/py/qstrdefs.h' + qstr_collected = env.CollectQstr( - target='genhdr/qstrdefs.collected.h', source=SOURCE_QSTR) + target='genhdr/qstrdefs.collected.h', + source=SOURCE_QSTR) qstr_preprocessed = env.PreprocessQstr( target='genhdr/qstrdefs.preprocessed.h', - source=['vendor/micropython/py/qstrdefs.h', qstr_collected]) + source=[qstr_micropython, qstr_collected]) qstr_generated = env.GenerateQstrDefs( - target='genhdr/qstrdefs.generated.h', source=qstr_preprocessed) + target='genhdr/qstrdefs.generated.h', + source=qstr_preprocessed) env.Ignore(qstr_collected, qstr_generated) @@ -534,10 +537,12 @@ env.Ignore(qstr_collected, qstr_generated) # Frozen modules # -source_mpy = env.FrozenModule(source=SOURCE_PY, suffix='.mpy') +source_mpy = env.FrozenModule(source=SOURCE_PY) -source_mpyc = env.FrozenSource( - target='frozen_mpy.c', source=source_mpy, qstr_header=qstr_preprocessed) +source_mpyc = env.FrozenCFile( + target='frozen_mpy.c', + source=source_mpy, + qstr_header=qstr_preprocessed) env.Depends(source_mpyc, qstr_generated) diff --git a/site_scons/site_tools/micropython/__init__.py b/site_scons/site_tools/micropython/__init__.py index 70930bbf0..35c332f76 100644 --- a/site_scons/site_tools/micropython/__init__.py +++ b/site_scons/site_tools/micropython/__init__.py @@ -20,10 +20,12 @@ def generate(env): action='$MAKEQSTRDATA $SOURCE > $TARGET', ) env['BUILDERS']['FrozenModule'] = SCons.Builder.Builder( - action='$MPY_CROSS -o $TARGET -s $SOURCE $SOURCE', suffix='.mpy') + action='$MPY_CROSS -o $TARGET -s $SOURCE $SOURCE', + suffix='.mpy', + single_source=True, ) - env['BUILDERS']['FrozenSource'] = SCons.Builder.Builder( - action='$MPY_TOOL -f -q $qstr_header $SOURCES > $TARGET') + env['BUILDERS']['FrozenCFile'] = SCons.Builder.Builder( + action='$MPY_TOOL -f -q $qstr_header $SOURCES > $TARGET', ) def exists(env):