build: Split SConscript.libcommon in two.
authorTilman Sauerbeck <tilman@code-monkey.de>
Wed, 8 Jan 2020 13:32:29 +0000 (14:32 +0100)
committerTilman Sauerbeck <tilman@code-monkey.de>
Thu, 9 Jan 2020 14:19:36 +0000 (15:19 +0100)
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 [deleted file]
SConscript.libcommon.c [new file with mode: 0644]
SConscript.libcommon.rs [new file with mode: 0644]
SConscript.target

diff --git a/SConscript.libcommon b/SConscript.libcommon
deleted file mode 100644 (file)
index b0864a4..0000000
+++ /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 (file)
index 0000000..0766312
--- /dev/null
@@ -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 (file)
index 0000000..23f8277
--- /dev/null
@@ -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)
index 74ea714f918ad0a9d3ff5887ee1d28f0771d69f0..fa4ca1775d42e3ea4d47efce8000a67bdb06e62a 100644 (file)
@@ -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).