Commit 375d8457 authored by danh-arm's avatar danh-arm Committed by GitHub
Browse files

Merge pull request #750 from jwerner-chromium/m0_build

RK3399 M0 build system improvements
parents d19ce2cb 71581c9c
...@@ -39,16 +39,11 @@ PLAT_M0 ?= rk3399m0 ...@@ -39,16 +39,11 @@ PLAT_M0 ?= rk3399m0
ifeq (${V},0) ifeq (${V},0)
Q=@ Q=@
CHECKCODE_ARGS += --no-summary --terse
else else
Q= Q=
endif endif
export Q export Q
# All PHONY definition
.PHONY: all clean distclean ${ARCH}
all: ${ARCH}
.SUFFIXES: .SUFFIXES:
INCLUDES += -Iinclude/ INCLUDES += -Iinclude/
...@@ -86,22 +81,21 @@ define SOURCES_TO_OBJS ...@@ -86,22 +81,21 @@ define SOURCES_TO_OBJS
$(notdir $(patsubst %.S,%.o,$(filter %.S,$(1)))) $(notdir $(patsubst %.S,%.o,$(filter %.S,$(1))))
endef endef
BUILD_DIR := ${BUILD_PLAT}/obj
BIN_DIR := ${BUILD_PLAT}/bin
SOURCES := $(C_SOURCES) SOURCES := $(C_SOURCES)
OBJS := $(addprefix $(BUILD_DIR)/,$(call SOURCES_TO_OBJS,$(SOURCES))) OBJS := $(addprefix $(BUILD)/,$(call SOURCES_TO_OBJS,$(SOURCES)))
LINKERFILE := src/rk3399m0.ld LINKERFILE := src/rk3399m0.ld
MAPFILE := $(BIN_DIR)/$(PLAT_M0).map MAPFILE := $(BUILD)/$(PLAT_M0).map
ELF := $(BIN_DIR)/$(PLAT_M0).elf ELF := $(BUILD)/$(PLAT_M0).elf
BIN := $(BIN_DIR)/$(PLAT_M0).bin BIN := $(BUILD)/$(PLAT_M0).bin
# Function definition related compilation # Function definition related compilation
define MAKE_C define MAKE_C
$(eval OBJ := $(1)/$(patsubst %.c,%.o,$(notdir $(2)))) $(eval OBJ := $(1)/$(patsubst %.c,%.o,$(notdir $(2))))
-include $(patsubst %.o,%.d,$(OBJ))
$(OBJ) : $(2) $(OBJ) : $(2)
@echo " CC $$<" @echo " CC $$<"
$$(Q)$$(CC) $$(CFLAGS) $$(INCLUDES) -c $$< -o $$@ $$(Q)$$(CC) $$(CFLAGS) $$(INCLUDES) -MMD -MT $$@ -c $$< -o $$@
endef endef
define MAKE_S define MAKE_S
...@@ -124,11 +118,8 @@ define MAKE_OBJS ...@@ -124,11 +118,8 @@ define MAKE_OBJS
$(and $(REMAIN),$(error Unexpected source files present: $(REMAIN))) $(and $(REMAIN),$(error Unexpected source files present: $(REMAIN)))
endef endef
$(BIN_DIR) : .PHONY: all
$(Q)mkdir -p "$@" all: $(BIN)
$(BUILD_DIR) : $(BIN_DIR)
$(Q)mkdir -p "$@"
$(ELF) : $(OBJS) $(LINKERFILE) $(ELF) : $(OBJS) $(LINKERFILE)
@echo " LD $@" @echo " LD $@"
...@@ -139,18 +130,4 @@ $(BIN) : $(ELF) ...@@ -139,18 +130,4 @@ $(BIN) : $(ELF)
@echo " BIN $@" @echo " BIN $@"
$(Q)$(OC) -O binary $< $@ $(Q)$(OC) -O binary $< $@
.PHONY : ${ARCH} $(eval $(call MAKE_OBJS,$(BUILD),$(SOURCES),$(1)))
${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)*
...@@ -90,8 +90,9 @@ $(eval $(call add_define,PLAT_EXTRA_LD_SCRIPT)) ...@@ -90,8 +90,9 @@ $(eval $(call add_define,PLAT_EXTRA_LD_SCRIPT))
# M0 source build # M0 source build
PLAT_M0 := ${PLAT}m0 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)) $(eval $(call add_define,RK3399M0FW))
# CCACHE_EXTRAFILES is needed because ccache doesn't handle .incbin # CCACHE_EXTRAFILES is needed because ccache doesn't handle .incbin
...@@ -99,7 +100,7 @@ export CCACHE_EXTRAFILES ...@@ -99,7 +100,7 @@ export CCACHE_EXTRAFILES
${BUILD_PLAT}/bl31/pmu_fw.o: CCACHE_EXTRAFILES=$(RK3399M0FW) ${BUILD_PLAT}/bl31/pmu_fw.o: CCACHE_EXTRAFILES=$(RK3399M0FW)
${RK_PLAT_SOC}/drivers/pmu/pmu_fw.c: $(RK3399M0FW) ${RK_PLAT_SOC}/drivers/pmu/pmu_fw.c: $(RK3399M0FW)
$(eval $(call MAKE_PREREQ_DIR,${BUILD_M0},))
.PHONY: $(RK3399M0FW) .PHONY: $(RK3399M0FW)
$(RK3399M0FW): $(RK3399M0FW): | ${BUILD_M0}
$(MAKE) -C ${RK_PLAT_SOC}/drivers/m0 \ $(MAKE) -C ${RK_PLAT_SOC}/drivers/m0 BUILD=$(abspath ${BUILD_PLAT}/m0)
BUILD_PLAT=$(abspath ${BUILD_PLAT}/m0)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment