[Tools] Fix the directory issue for Makefile
This commit is contained in:
parent
3b75e30c8d
commit
b6055df950
|
@ -8,50 +8,50 @@ endif
|
||||||
|
|
||||||
$(if $(strip $(BUILD_DIR)),,$(error BUILD_DIR not defined))
|
$(if $(strip $(BUILD_DIR)),,$(error BUILD_DIR not defined))
|
||||||
|
|
||||||
RTT_BUILD_DIR := RT-THREAD_OBJS
|
RTT_BUILD_DIR := .
|
||||||
BSP_BUILD_DIR := BSP_OBJS
|
BSP_BUILD_DIR := bsp
|
||||||
|
|
||||||
#################
|
#################
|
||||||
|
|
||||||
define add_c_file
|
define add_c_file
|
||||||
|
$(eval C_SRC := $(1:$(BSP_ROOT)/%=%)) \
|
||||||
|
$(eval C_SRC := $(C_SRC:$(RTT_ROOT)/%=%)) \
|
||||||
$(eval COBJ := $(1:%.c=%.o)) \
|
$(eval COBJ := $(1:%.c=%.o)) \
|
||||||
$(eval COBJ := $(COBJ:$(RTT_ROOT)/%=$(RTT_BUILD_DIR)/%)) \
|
|
||||||
$(eval COBJ := $(COBJ:$(BSP_ROOT)/%=$(BSP_BUILD_DIR)/%)) \
|
$(eval COBJ := $(COBJ:$(BSP_ROOT)/%=$(BSP_BUILD_DIR)/%)) \
|
||||||
$(eval VPATH += $(dir $1)) \
|
$(eval COBJ := $(COBJ:$(RTT_ROOT)/%=$(RTT_BUILD_DIR)/%)) \
|
||||||
$(eval CSRCS += $1) \
|
|
||||||
$(eval LOCALC := $(addprefix $(BUILD_DIR)/,$(COBJ))) \
|
$(eval LOCALC := $(addprefix $(BUILD_DIR)/,$(COBJ))) \
|
||||||
$(eval OBJS += $(LOCALC)) \
|
$(eval OBJS += $(LOCALC)) \
|
||||||
$(if $(strip $(LOCALC)),$(eval $(LOCALC): $1
|
$(if $(strip $(LOCALC)),$(eval $(LOCALC): $(C_SRC)
|
||||||
@if [ ! -d $$(@D) ]; then mkdir -p $$(@D); fi
|
@if [ ! -d $$(@D) ]; then mkdir -p $$(@D); fi
|
||||||
@echo cc $$@
|
@echo cc $$<
|
||||||
@$(CROSS_COMPILE)gcc $$(CFLAGS) -c $$< -o $$@))
|
@$(CROSS_COMPILE)gcc $$(CFLAGS) -c $$< -o $$@))
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define add_cxx_file
|
define add_cxx_file
|
||||||
|
$(eval CXX_SRC := $(1:$(BSP_ROOT)/%=%)) \
|
||||||
|
$(eval CXX_SRC := $(CXX_SRC:$(RTT_ROOT)/%=%)) \
|
||||||
$(eval CXXOBJ := $(1:%.cpp=%.o)) \
|
$(eval CXXOBJ := $(1:%.cpp=%.o)) \
|
||||||
$(eval CXXOBJ := $(CXXOBJ:$(RTT_ROOT)/%=$(RTT_BUILD_DIR)/%)) \
|
|
||||||
$(eval CXXOBJ := $(CXXOBJ:$(BSP_ROOT)/%=$(BSP_BUILD_DIR)/%)) \
|
$(eval CXXOBJ := $(CXXOBJ:$(BSP_ROOT)/%=$(BSP_BUILD_DIR)/%)) \
|
||||||
$(eval VPATH += $(dir $1)) \
|
$(eval CXXOBJ := $(CXXOBJ:$(RTT_ROOT)/%=$(RTT_BUILD_DIR)/%)) \
|
||||||
$(eval CXXSRCS += $1) \
|
|
||||||
$(eval LOCALCXX := $(addprefix $(BUILD_DIR)/,$(CXXOBJ))) \
|
$(eval LOCALCXX := $(addprefix $(BUILD_DIR)/,$(CXXOBJ))) \
|
||||||
$(eval OBJS += $(LOCALCXX)) \
|
$(eval OBJS += $(LOCALCXX)) \
|
||||||
$(if $(strip $(LOCALCXX)),$(eval $(LOCALCXX): $1
|
$(if $(strip $(LOCALCXX)),$(eval $(LOCALCXX): $(CXX_SRC)
|
||||||
@if [ ! -d $$(@D) ]; then mkdir -p $$(@D); fi
|
@if [ ! -d $$(@D) ]; then mkdir -p $$(@D); fi
|
||||||
@echo cc $$@
|
@echo cc $$<
|
||||||
@$(CROSS_COMPILE)g++ $$(CXXFLAGS) -c $$< -o $$@))
|
@$(CROSS_COMPILE)g++ $$(CXXFLAGS) -c $$< -o $$@))
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define add_S_file
|
define add_S_file
|
||||||
|
$(eval S_SRC := $(1:$(BSP_ROOT)/%=%)) \
|
||||||
|
$(eval S_SRC := $(S_SRC:$(RTT_ROOT)/%=%)) \
|
||||||
$(eval SOBJ := $(1:%.S=%.o)) \
|
$(eval SOBJ := $(1:%.S=%.o)) \
|
||||||
$(eval SOBJ := $(SOBJ:$(RTT_ROOT)/%=$(RTT_BUILD_DIR)/%)) \
|
|
||||||
$(eval SOBJ := $(SOBJ:$(BSP_ROOT)/%=$(BSP_BUILD_DIR)/%)) \
|
$(eval SOBJ := $(SOBJ:$(BSP_ROOT)/%=$(BSP_BUILD_DIR)/%)) \
|
||||||
$(eval VPATH += $(dir $1)) \
|
$(eval SOBJ := $(SOBJ:$(RTT_ROOT)/%=$(RTT_BUILD_DIR)/%)) \
|
||||||
$(eval SSRCS += $(1)) \
|
|
||||||
$(eval LOCALS := $(addprefix $(BUILD_DIR)/,$(SOBJ))) \
|
$(eval LOCALS := $(addprefix $(BUILD_DIR)/,$(SOBJ))) \
|
||||||
$(eval OBJS += $(LOCALS)) \
|
$(eval OBJS += $(LOCALS)) \
|
||||||
$(if $(strip $(LOCALS)),$(eval $(LOCALS): $1
|
$(if $(strip $(LOCALS)),$(eval $(LOCALS): $(S_SRC)
|
||||||
@if [ ! -d $$(@D) ]; then mkdir -p $$(@D); fi
|
@if [ ! -d $$(@D) ]; then mkdir -p $$(@D); fi
|
||||||
@echo cc $$@
|
@echo cc $$<
|
||||||
@$(CROSS_COMPILE)gcc $$(AFLAGS) -c $$< -o $$@))
|
@$(CROSS_COMPILE)gcc $$(AFLAGS) -c $$< -o $$@))
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
@ -68,10 +68,8 @@ add_def = $(eval CFLAGS += -D$1) \
|
||||||
$(eval CXXFLAGS += -D$1)
|
$(eval CXXFLAGS += -D$1)
|
||||||
|
|
||||||
OBJS :=
|
OBJS :=
|
||||||
CSRCS :=
|
#VPATH := $(BSP_ROOT) $(RTT_ROOT)
|
||||||
CXXSRCS :=
|
VPATH := $(RTT_ROOT)
|
||||||
SSRCS :=
|
|
||||||
VPATH :=
|
|
||||||
|
|
||||||
CONFIG_FLG := $(strip $(EXTERN_FLAGS))
|
CONFIG_FLG := $(strip $(EXTERN_FLAGS))
|
||||||
$(if $(CONFIG_FLG),$(foreach f,$(CONFIG_FLG),$(call add_flg,$(f))))
|
$(if $(CONFIG_FLG),$(foreach f,$(CONFIG_FLG),$(call add_flg,$(f))))
|
||||||
|
|
Loading…
Reference in New Issue