From b891a2ff44e99392e258c2f39ec0852c4b5dbfab Mon Sep 17 00:00:00 2001 From: Tilman Sauerbeck Date: Wed, 8 Jan 2020 14:32:29 +0100 Subject: [PATCH] build: Split SConscript.libcommon in two. Split it in SConscript.libcommon.c, dealing with the C code that's used to build libcommon.a, and SConscript.libcommon.rs, used to build libcommon.rlib. This will be useful for native builds used for testing in the future. --- SConscript.libcommon.c | 22 ++++++++++++++++ ...cript.libcommon => SConscript.libcommon.rs | 26 +++---------------- SConscript.target | 3 ++- 3 files changed, 27 insertions(+), 24 deletions(-) create mode 100644 SConscript.libcommon.c rename SConscript.libcommon => SConscript.libcommon.rs (55%) diff --git a/SConscript.libcommon.c b/SConscript.libcommon.c new file mode 100644 index 0000000..0766312 --- /dev/null +++ b/SConscript.libcommon.c @@ -0,0 +1,22 @@ +Import('env') +env = env.Clone() + +source_files = [ + 'src/common/startup.c', + 'src/common/asm_helpers.c', + 'src/common/systick.c', + 'src/common/ringbuf.c', + 'src/common/flash.c', + 'src/common/uart0.c', + 'src/common/usb_device_ch9.c', + 'src/common/usb_device_dci.c', + 'src/common/usb_device_descriptor.c', + 'src/common/usb_device_khci.c', + 'src/common/usb_osa_bm.c', + 'src/common/virtual_com.c', +] + +libcommon_a = env.Library('libcommon.a', source_files) + +for f in source_files: + Depends(libcommon_a, f) diff --git a/SConscript.libcommon b/SConscript.libcommon.rs similarity index 55% rename from SConscript.libcommon rename to SConscript.libcommon.rs index b0864a4..23f8277 100644 --- a/SConscript.libcommon +++ b/SConscript.libcommon.rs @@ -1,7 +1,7 @@ Import('env') env = env.Clone() -source_files_rs = [ +source_files = [ 'src/common/lib.rs', # Must be listed first (see below). 'src/common/register.rs', 'src/common/nvic.rs', @@ -29,27 +29,7 @@ source_files_rs = [ 'src/common/varint.rs', ] -source_files_c = [ - 'src/common/startup.c', - 'src/common/asm_helpers.c', - 'src/common/systick.c', - 'src/common/ringbuf.c', - 'src/common/flash.c', - 'src/common/uart0.c', - 'src/common/usb_device_ch9.c', - 'src/common/usb_device_dci.c', - 'src/common/usb_device_descriptor.c', - 'src/common/usb_device_khci.c', - 'src/common/usb_osa_bm.c', - 'src/common/virtual_com.c', -] - -libcommon_rlib = env.Rustc('libcommon.rlib', source_files_rs[0]) +libcommon_rlib = env.Rustc('libcommon.rlib', source_files[0]) -for f in source_files_rs: +for f in source_files: Depends(libcommon_rlib, f) - -libcommon_a = env.Library('libcommon.a', source_files_c) - -for f in source_files_c: - Depends(libcommon_a, f) diff --git a/SConscript.target b/SConscript.target index 74ea714..fa4ca17 100644 --- a/SConscript.target +++ b/SConscript.target @@ -50,7 +50,8 @@ env.Append(LINKFLAGS = [ '-Wl,--gc-sections' ]) -SConscript('SConscript.libcommon', exports='env', duplicate=0) +SConscript('SConscript.libcommon.c', exports='env', duplicate=0) +SConscript('SConscript.libcommon.rs', exports='env', duplicate=0) bootloader_source_files = [ 'src/bootloader/main.rs', # Must be listed first (see below). -- 2.30.2