From: Tilman Sauerbeck Date: Wed, 8 Jan 2020 13:32:29 +0000 (+0100) Subject: build: Split SConscript.libcommon in two. X-Git-Url: http://git.code-monkey.de/?a=commitdiff_plain;h=b891a2ff44e99392e258c2f39ec0852c4b5dbfab;p=gps-watch.git 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. --- diff --git a/SConscript.libcommon b/SConscript.libcommon deleted file mode 100644 index b0864a4..0000000 --- a/SConscript.libcommon +++ /dev/null @@ -1,55 +0,0 @@ -Import('env') -env = env.Clone() - -source_files_rs = [ - 'src/common/lib.rs', # Must be listed first (see below). - 'src/common/register.rs', - 'src/common/nvic.rs', - 'src/common/clock.rs', - 'src/common/systick.rs', - 'src/common/port.rs', - 'src/common/gpio.rs', - 'src/common/i2c.rs', - 'src/common/spi.rs', - 'src/common/uart.rs', - 'src/common/watchdog.rs', - 'src/common/crc32.rs', - 'src/common/ringbuf.rs', - 'src/common/buffer.rs', - 'src/common/usb_serial.rs', - 'src/common/display.rs', - 'src/common/screen.rs', - 'src/common/gps.rs', - 'src/common/fmt.rs', - 'src/common/time.rs', - 'src/common/storage.rs', - 'src/common/mx25l.rs', - 'src/common/shell.rs', - 'src/common/yencode.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]) - -for f in source_files_rs: - 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.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.rs b/SConscript.libcommon.rs new file mode 100644 index 0000000..23f8277 --- /dev/null +++ b/SConscript.libcommon.rs @@ -0,0 +1,35 @@ +Import('env') +env = env.Clone() + +source_files = [ + 'src/common/lib.rs', # Must be listed first (see below). + 'src/common/register.rs', + 'src/common/nvic.rs', + 'src/common/clock.rs', + 'src/common/systick.rs', + 'src/common/port.rs', + 'src/common/gpio.rs', + 'src/common/i2c.rs', + 'src/common/spi.rs', + 'src/common/uart.rs', + 'src/common/watchdog.rs', + 'src/common/crc32.rs', + 'src/common/ringbuf.rs', + 'src/common/buffer.rs', + 'src/common/usb_serial.rs', + 'src/common/display.rs', + 'src/common/screen.rs', + 'src/common/gps.rs', + 'src/common/fmt.rs', + 'src/common/time.rs', + 'src/common/storage.rs', + 'src/common/mx25l.rs', + 'src/common/shell.rs', + 'src/common/yencode.rs', + 'src/common/varint.rs', +] + +libcommon_rlib = env.Rustc('libcommon.rlib', source_files[0]) + +for f in source_files: + Depends(libcommon_rlib, 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).