Skip to content

Commit 8e08b58

Browse files
committed
[fix] Couldn't compile *.s src files
1 parent fe67df3 commit 8e08b58

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tools/rtthread.mk

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,20 @@ $(if $(strip $(LOCALS)),$(eval $(LOCALS): $(S_SRC)
5555
@$(CROSS_COMPILE)gcc $$(AFLAGS) -c $$< -o $$@))
5656
endef
5757

58+
define add_s_file
59+
$(eval S_SRC := $(1:$(BSP_ROOT)/%=%)) \
60+
$(eval S_SRC := $(S_SRC:$(RTT_ROOT)/%=%)) \
61+
$(eval SOBJ := $(1:%.s=%.o)) \
62+
$(eval SOBJ := $(SOBJ:$(BSP_ROOT)/%=$(BSP_BUILD_DIR)/%)) \
63+
$(eval SOBJ := $(SOBJ:$(RTT_ROOT)/%=$(RTT_BUILD_DIR)/%)) \
64+
$(eval LOCALS := $(addprefix $(BUILD_DIR)/,$(SOBJ))) \
65+
$(eval OBJS += $(LOCALS)) \
66+
$(if $(strip $(LOCALS)),$(eval $(LOCALS): $(S_SRC)
67+
@if [ ! -d $$(@D) ]; then mkdir -p $$(@D); fi
68+
@echo cc $$<
69+
@$(CROSS_COMPILE)gcc $$(AFLAGS) -c $$< -o $$@))
70+
endef
71+
5872
add_flg = $(eval CFLAGS += $1) \
5973
$(eval AFLAGS += $1) \
6074
$(eval CXXFLAGS += $1)
@@ -89,6 +103,9 @@ $(if $(SRCS),$(foreach f,$(SRCS),$(call add_cxx_file,$(f))))
89103
SRCS := $(strip $(filter %.S,$(SRC_FILES)))
90104
$(if $(SRCS),$(foreach f,$(SRCS),$(call add_S_file,$(f))))
91105

106+
SRCS := $(strip $(filter %.s,$(SRC_FILES)))
107+
$(if $(SRCS),$(foreach f,$(SRCS),$(call add_s_file,$(f))))
108+
92109
CFLAGS += $(CPPPATHS)
93110
CXXFLAGS += $(CPPPATHS)
94111
AFLAGS += $(CPPPATHS)

0 commit comments

Comments
 (0)