[fix] Couldn't compile *.s src files

This commit is contained in:
iysheng 2020-07-16 22:25:09 +08:00
parent fe67df3408
commit 8e08b58964
1 changed files with 17 additions and 0 deletions

View File

@ -55,6 +55,20 @@ $(if $(strip $(LOCALS)),$(eval $(LOCALS): $(S_SRC)
@$(CROSS_COMPILE)gcc $$(AFLAGS) -c $$< -o $$@))
endef
define add_s_file
$(eval S_SRC := $(1:$(BSP_ROOT)/%=%)) \
$(eval S_SRC := $(S_SRC:$(RTT_ROOT)/%=%)) \
$(eval SOBJ := $(1:%.s=%.o)) \
$(eval SOBJ := $(SOBJ:$(BSP_ROOT)/%=$(BSP_BUILD_DIR)/%)) \
$(eval SOBJ := $(SOBJ:$(RTT_ROOT)/%=$(RTT_BUILD_DIR)/%)) \
$(eval LOCALS := $(addprefix $(BUILD_DIR)/,$(SOBJ))) \
$(eval OBJS += $(LOCALS)) \
$(if $(strip $(LOCALS)),$(eval $(LOCALS): $(S_SRC)
@if [ ! -d $$(@D) ]; then mkdir -p $$(@D); fi
@echo cc $$<
@$(CROSS_COMPILE)gcc $$(AFLAGS) -c $$< -o $$@))
endef
add_flg = $(eval CFLAGS += $1) \
$(eval AFLAGS += $1) \
$(eval CXXFLAGS += $1)
@ -89,6 +103,9 @@ $(if $(SRCS),$(foreach f,$(SRCS),$(call add_cxx_file,$(f))))
SRCS := $(strip $(filter %.S,$(SRC_FILES)))
$(if $(SRCS),$(foreach f,$(SRCS),$(call add_S_file,$(f))))
SRCS := $(strip $(filter %.s,$(SRC_FILES)))
$(if $(SRCS),$(foreach f,$(SRCS),$(call add_s_file,$(f))))
CFLAGS += $(CPPPATHS)
CXXFLAGS += $(CPPPATHS)
AFLAGS += $(CPPPATHS)