rockchip: Clean up parent directory creation for M0
The dependencies in the M0 Makefile are not correctly laid out, which
may lead to errors with make -j if the binary target gets evaluated
before the target that creates the directory. In addition, the M0
Makefile just calls mkdir without using the platform-independent macros
from the main ARM TF build system. This patch fixes those issues,
removes some unused (and broken) M0 build targets and merges the two M0
output directories into one (since there's no real point splitting it up
and it creates more hassle).
Change-Id: Ia5002479cf9c57fea7aefa8ca88e373df3a51f61
Signed-off-by: Julius Werner <jwerner@chromium.org>
diff --git a/plat/rockchip/rk3399/drivers/m0/Makefile b/plat/rockchip/rk3399/drivers/m0/Makefile
index 8adc47e..a041929 100644
--- a/plat/rockchip/rk3399/drivers/m0/Makefile
+++ b/plat/rockchip/rk3399/drivers/m0/Makefile
@@ -39,16 +39,11 @@
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/
@@ -86,14 +81,12 @@
$(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
@@ -124,11 +117,8 @@
$(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 $@"
@@ -139,18 +129,4 @@
@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)))