ifeq (${V},0)
Q=@
- CHECKCODE_ARGS += --no-summary --terse
else
Q=
endif
export Q
-# All PHONY definition
-.PHONY: all clean distclean ${ARCH}
-all: ${ARCH}
-
.SUFFIXES:
INCLUDES += -Iinclude/
$(notdir $(patsubst %.S,%.o,$(filter %.S,$(1))))
endef
-BUILD_DIR := ${BUILD_PLAT}/obj
-BIN_DIR := ${BUILD_PLAT}/bin
SOURCES := $(C_SOURCES)
-OBJS := $(addprefix $(BUILD_DIR)/,$(call SOURCES_TO_OBJS,$(SOURCES)))
+OBJS := $(addprefix $(BUILD)/,$(call SOURCES_TO_OBJS,$(SOURCES)))
LINKERFILE := src/rk3399m0.ld
-MAPFILE := $(BIN_DIR)/$(PLAT_M0).map
-ELF := $(BIN_DIR)/$(PLAT_M0).elf
-BIN := $(BIN_DIR)/$(PLAT_M0).bin
+MAPFILE := $(BUILD)/$(PLAT_M0).map
+ELF := $(BUILD)/$(PLAT_M0).elf
+BIN := $(BUILD)/$(PLAT_M0).bin
# Function definition related compilation
define MAKE_C
$(and $(REMAIN),$(error Unexpected source files present: $(REMAIN)))
endef
-$(BIN_DIR) :
- $(Q)mkdir -p "$@"
-
-$(BUILD_DIR) : $(BIN_DIR)
- $(Q)mkdir -p "$@"
+.PHONY: all
+all: $(BIN)
$(ELF) : $(OBJS) $(LINKERFILE)
@echo " LD $@"
@echo " BIN $@"
$(Q)$(OC) -O binary $< $@
-.PHONY : ${ARCH}
-${ARCH} : $(BUILD_DIR) $(BIN)
-
-$(eval $(call MAKE_OBJS,$(BUILD_DIR),$(SOURCES),$(1)))
-
-# Other common compilation entries
-clean:
- @echo " CLEAN"
- ${Q}rm -rf ${BUILD_BASE}/${PLAT_M0}
- ${Q}rm -rf ${VER_BIN_DIR}/$(PLAT_M0)*
-
-distclean:
- @echo " DISTCLEAN"
- ${Q}rm -rf ${BUILD_BASE}/${PLAT_M0}
- ${Q}rm -rf ${VER_BIN_DIR}/$(PLAT_M0)*
+$(eval $(call MAKE_OBJS,$(BUILD),$(SOURCES),$(1)))
# M0 source build
PLAT_M0 := ${PLAT}m0
+BUILD_M0 := ${BUILD_PLAT}/m0
-RK3399M0FW=${BUILD_PLAT}/m0/bin/${PLAT_M0}.bin
+RK3399M0FW=${BUILD_M0}/${PLAT_M0}.bin
$(eval $(call add_define,RK3399M0FW))
# CCACHE_EXTRAFILES is needed because ccache doesn't handle .incbin
${BUILD_PLAT}/bl31/pmu_fw.o: CCACHE_EXTRAFILES=$(RK3399M0FW)
${RK_PLAT_SOC}/drivers/pmu/pmu_fw.c: $(RK3399M0FW)
+$(eval $(call MAKE_PREREQ_DIR,${BUILD_M0},))
.PHONY: $(RK3399M0FW)
-$(RK3399M0FW):
- $(MAKE) -C ${RK_PLAT_SOC}/drivers/m0 \
- BUILD_PLAT=$(abspath ${BUILD_PLAT}/m0)
+$(RK3399M0FW): | ${BUILD_M0}
+ $(MAKE) -C ${RK_PLAT_SOC}/drivers/m0 BUILD=$(abspath ${BUILD_PLAT}/m0)