summaryrefslogtreecommitdiff
path: root/spl.mk
diff options
context:
space:
mode:
Diffstat (limited to 'spl.mk')
-rw-r--r--spl.mk19
1 files changed, 15 insertions, 4 deletions
diff --git a/spl.mk b/spl.mk
index aa6121a..fac0407 100644
--- a/spl.mk
+++ b/spl.mk
@@ -21,11 +21,22 @@
##
include $(SPREADSTM8_PATH)/defines.mk
-CFLAGS += -D$(SPL_MCU)
-CFLAGS += -I$(SPL_PATH)/Libraries/STM8S_StdPeriph_Driver/inc
-CFLAGS += -I./
+SPL_LIB = $(SPL_PATH)/Libraries/STM8S_StdPeriph_Driver
+
+SPL_CFLAGS = -D$(SPL_MCU)
+SPL_CFLAGS += -I$(SPL_LIB)/inc
+SPL_CFLAGS += -I./
+
+CFLAGS += $(SPL_CFLAGS)
+
+ifdef SPL_COMPONENTS
+SRC:=$(SPL_COMPONENTS:%=$(SPL_LIB)/src/stm8s_%.c)
+else
+SPL_DEPS=$(shell $(PP) -MM -D__SDCC $(SPL_CFLAGS) $(SPL_LIB)/inc/stm8s.h)
+SPL_HEADER=$(subst $(SPL_LIB)/inc/,,$(filter $(SPL_LIB)/inc/stm8s_%.h,$(SPL_DEPS)))
+SRC:=$(SPL_HEADER:stm8s_%.h=$(SPL_LIB)/src/stm8s_%.c)
+endif
-SRC:=$(SPL_COMPONENTS:%=$(SPL_PATH)/Libraries/STM8S_StdPeriph_Driver/src/stm8s_%.c)
OBJ = $(SRC:%.c=%.rel)
libspl.a: $(OBJ)