Cleanup boards/Makefile

Changes:
There was logic in `tools/Config.mk` which was duplicated in `boards/Makefile`.
This PR removes the duplicated logic in boards/Makefile
This commit is contained in:
Alan Rosenthal 2022-01-23 20:58:30 -05:00 committed by Xiang Xiao
parent 31b1fd5c89
commit 35905302d3
4 changed files with 26 additions and 37 deletions

View File

@ -20,26 +20,6 @@
include $(TOPDIR)/Make.defs
# Determine if there is a Kconfig file for any custom board configuration
ifeq ($(CONFIG_ARCH_BOARD_CUSTOM),y)
CUSTOM_DIR = $(patsubst "%",%,$(CONFIG_ARCH_BOARD_CUSTOM_DIR))
ifeq ($(CONFIG_ARCH_BOARD_CUSTOM_DIR_RELPATH),y)
CUSTOM_KPATH = $(TOPDIR)$(DELIM)$(CUSTOM_DIR)$(DELIM)Kconfig
else
CUSTOM_KPATH = $(CUSTOM_DIR)$(DELIM)Kconfig
endif
CUSTOM_KCONFIG = $(if $(wildcard $(CUSTOM_KPATH)),y,)
endif
ifeq ($(CUSTOM_KCONFIG),y)
BOARD_KCONFIG = $(CUSTOM_KPATH)
else
BOARD_KCONFIG = $(TOPDIR)$(DELIM)boards$(DELIM)dummy$(DELIM)dummy_kconfig
endif
DUMMY_KCONFIG = $(TOPDIR)$(DELIM)boards$(DELIM)dummy$(DELIM)Kconfig
# The board configuration should be installed in the arch/ directory
BOARDDIR = $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board
@ -94,19 +74,12 @@ makedepfile: $(CSRCS:.c=.ddc) $(ASRCS:.S=.dds) $(CXXSRCS:.cxx=.ddx)
depend: .depend
$(DUMMY_KCONFIG): $(BOARD_KCONFIG)
$(call DELFILE, $(DUMMY_KCONFIG))
$(call COPYFILE, $(BOARD_KCONFIG), $(DUMMY_KCONFIG))
dirlinks: $(DUMMY_KCONFIG)
context: $(DUMMY_KCONFIG)
context:
ifeq ($(BOARD_INSTALLED),y)
$(Q) $(MAKE) -C $(BOARDDIR) context
endif
clean_context:
$(call DELFILE, $(DUMMY_KCONFIG))
clean: clean_context
$(call DELFILE, $(BIN))

View File

@ -135,14 +135,20 @@ endif
ifeq ($(CONFIG_ARCH_BOARD_CUSTOM),y)
CUSTOM_DIR = $(patsubst "%",%,$(CONFIG_ARCH_BOARD_CUSTOM_DIR))
ifeq ($(CONFIG_ARCH_BOARD_CUSTOM_DIR_RELPATH),y)
BOARD_DIR ?= $(TOPDIR)$(DELIM)$(CUSTOM_DIR)
else
BOARD_DIR ?= $(CUSTOM_DIR)
endif
ifeq ($(CONFIG_ARCH_BOARD_CUSTOM_DIR_RELPATH),y)
BOARD_DIR ?= $(TOPDIR)$(DELIM)$(CUSTOM_DIR)
else
BOARD_DIR ?= $(CUSTOM_DIR)
endif
CUSTOM_BOARD_KPATH = $(BOARD_DIR)$(DELIM)Kconfig
else
BOARD_DIR ?= $(TOPDIR)$(DELIM)boards$(DELIM)$(CONFIG_ARCH)$(DELIM)$(CONFIG_ARCH_CHIP)$(DELIM)$(CONFIG_ARCH_BOARD)
endif
ifeq (,$(wildcard $(CUSTOM_BOARD_KPATH)))
BOARD_KCONFIG = $(TOPDIR)$(DELIM)boards$(DELIM)dummy$(DELIM)dummy_kconfig
else
BOARD_KCONFIG = $(CUSTOM_BOARD_KPATH)
endif
BOARD_COMMON_DIR ?= $(wildcard $(BOARD_DIR)$(DELIM)..$(DELIM)common)
ifeq ($(BOARD_COMMON_DIR),)

View File

@ -328,6 +328,12 @@ arch/dummy/Kconfig:
@echo "CP: $@ to $(CHIP_KCONFIG)"
$(Q) cp -f $(CHIP_KCONFIG) $@
# Copy $(BOARD_KCONFIG) to boards/dummy/Kconfig
boards/dummy/Kconfig:
@echo "CP: $@ to $(BOARD_KCONFIG)"
$(Q) cp -f $(BOARD_KCONFIG) $@
DIRLINKS_SYMLINK = \
include/arch \
include/arch/board \
@ -335,6 +341,7 @@ DIRLINKS_SYMLINK = \
DIRLINKS_FILE = \
arch/dummy/Kconfig \
boards/dummy/Kconfig \
ifneq ($(INCLUDE_ARCH_CHIP_SYMLINK_DIR),)
DIRLINKS_SYMLINK += include/arch/chip
@ -352,8 +359,6 @@ ifneq ($(ARCH_SRC_BOARD_BOARD_SYMLINK),)
DIRLINKS_SYMLINK += $(ARCH_SRC)/board/board
endif
DIRLINKS_EXTERNAL_DIRS = boards
ifneq ($(APPDIR),)
DIRLINKS_EXTERNAL_DIRS += $(APPDIR)
endif

View File

@ -313,6 +313,12 @@ arch\dummy\Kconfig:
@echo "CP: $@ to $(CHIP_KCONFIG)"
$(Q) cp -f $(CHIP_KCONFIG) $@
# Copy $(BOARD_KCONFIG) to boards\dummy\Kconfig
boards\dummy\Kconfig:
@echo "CP: $@ to $(BOARD_KCONFIG)"
$(Q) cp -f $(BOARD_KCONFIG) $@
DIRLINKS_SYMLINK = \
include\arch \
include\arch\board \
@ -320,6 +326,7 @@ DIRLINKS_SYMLINK = \
DIRLINKS_FILE = \
arch\dummy\Kconfig \
boards\dummy\Kconfig \
ifneq ($(INCLUDE_ARCH_CHIP_SYMLINK_DIR),)
DIRLINKS_SYMLINK += include\arch\chip
@ -337,8 +344,6 @@ ifneq ($(ARCH_SRC_BOARD_BOARD_SYMLINK),)
DIRLINKS_SYMLINK += $(ARCH_SRC)\board\board
endif
DIRLINKS_EXTERNAL_DIRS = boards
ifneq ($(APPDIR),)
DIRLINKS_EXTERNAL_DIRS += $(APPDIR)
endif