build system: Add list-components target for debugging component discovery

This commit is contained in:
Angus Gratton 2017-06-21 15:09:24 +10:00 committed by Angus Gratton
parent aef5e90cce
commit 2c1fe6663d
2 changed files with 18 additions and 1 deletions

View file

@ -125,6 +125,8 @@ These variables all have default values that can be overridden for custom behavi
- ``COMPONENTS``: A list of component names to build into the project. Defaults to all components found in the COMPONENT_DIRS directories.
- ``SRCDIRS``: Directories under the main project directory which contain project-specific "pseudo-components". Defaults to 'main'. The difference between specifying a directory here and specifying it under ``EXTRA_COMPONENT_DIRS`` is that a directory in ``SRCDIRS`` is a component itself (contains a file "component.mk"), whereas a directory in ``EXTRA_COMPONENT_DIRS`` contains component directories which contain a file "component.mk". See the `Example Project` for a concrete case of this.
Running the ``make list-components`` target dumps many of these variables and can help debug the discovery of component directories.
Component Makefiles
-------------------

View file

@ -10,7 +10,7 @@
# where this file is located.
#
.PHONY: build-components menuconfig defconfig all build clean all_binaries check-submodules size size-components size-files
.PHONY: build-components menuconfig defconfig all build clean all_binaries check-submodules size size-components size-files list-components
all: all_binaries
# see below for recipe of 'all' target
#
@ -33,6 +33,7 @@ help:
@echo "make erase_flash - Erase entire flash contents"
@echo "make monitor - Run idf_monitor tool to monitor serial output from app"
@echo "make simple_monitor - Monitor serial output on terminal console"
@echo "make list-components - List all components in the project"
@echo ""
@echo "make app - Build just the app"
@echo "make app-flash - Flash just the app"
@ -439,6 +440,20 @@ endef
$(foreach submodule,$(subst $(IDF_PATH)/,,$(filter $(IDF_PATH)/%,$(COMPONENT_SUBMODULES))),$(eval $(call GenerateSubmoduleCheckTarget,$(submodule))))
# PHONY target to list components in the build and their paths
list-components:
$(info COMPONENT_DIRS (top-level, subdirectories of these are components))
$(foreach cd,$(COMPONENT_DIRS),$(info $(cd)))
$(info $(call dequote,$(SEPARATOR)))
$(info SRCDIRS (extra standalone component directories))
$(foreach sd,$(SRCDIRS),$(info $(sd)))
$(info $(call dequote,$(SEPARATOR)))
$(info COMPONENTS (list of component names))
$(info $(COMPONENTS))
$(info $(call dequote,$(SEPARATOR)))
$(info COMPONENT_PATHS (paths to all components):)
$(foreach cp,$(COMPONENT_PATHS),$(info $(cp)))
# Check toolchain version using the output of xtensa-esp32-elf-gcc --version command.
# The output normally looks as follows
# xtensa-esp32-elf-gcc (crosstool-NG crosstool-ng-1.22.0-59-ga194053) 4.8.5