From 35905302d32238a104d20f5a2f52e7f4b46c195b Mon Sep 17 00:00:00 2001 From: Alan Rosenthal Date: Sun, 23 Jan 2022 20:58:30 -0500 Subject: [PATCH] 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 --- boards/Makefile | 29 +---------------------------- tools/Config.mk | 16 +++++++++++----- tools/Unix.mk | 9 +++++++-- tools/Win.mk | 9 +++++++-- 4 files changed, 26 insertions(+), 37 deletions(-) diff --git a/boards/Makefile b/boards/Makefile index 2663c7e994..cf28f17777 100644 --- a/boards/Makefile +++ b/boards/Makefile @@ -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)) diff --git a/tools/Config.mk b/tools/Config.mk index 182c7cd4bc..a5091e6737 100644 --- a/tools/Config.mk +++ b/tools/Config.mk @@ -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),) diff --git a/tools/Unix.mk b/tools/Unix.mk index 418ca8b174..565a7e7dd8 100644 --- a/tools/Unix.mk +++ b/tools/Unix.mk @@ -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 diff --git a/tools/Win.mk b/tools/Win.mk index 7f2bdbe25d..d42230cb31 100644 --- a/tools/Win.mk +++ b/tools/Win.mk @@ -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