From db199c80c3b3b2cfaf6bc86fcf98987e47985c03 Mon Sep 17 00:00:00 2001 From: Nathaniel Graff Date: Thu, 14 Mar 2019 13:55:43 -0700 Subject: Use TARGET_TAGS in Makefile Signed-off-by: Nathaniel Graff --- Makefile | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 7f3eafb..1769d44 100644 --- a/Makefile +++ b/Makefile @@ -131,13 +131,14 @@ include scripts/libmetal.mk ifeq ($(STANDALONE_DEST),) standalone: $(error Please provide STANDALONE_DEST to create a standalone project) -else +else # STANDALONE_DEST != "" $(STANDALONE_DEST): $(STANDALONE_DEST)/%: mkdir -p $@ -ifneq ($(COREIP_MEM_WIDTH),) +ifneq ($(filter rtl,$(TARGET_TAGS)),) +# TARGETs with the "rtl" TARGET_TAG need elf2hex in their standalone project standalone: \ $(STANDALONE_DEST) \ $(STANDALONE_DEST)/bsp \ @@ -169,7 +170,7 @@ standalone: \ echo "PROGRAM = $(PROGRAM)" > $> $> $ $> $> $ Date: Thu, 14 Mar 2019 14:22:51 -0700 Subject: BSPs are any directory with settings.mk Signed-off-by: Nathaniel Graff --- Makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 1769d44..c513359 100644 --- a/Makefile +++ b/Makefile @@ -106,11 +106,12 @@ clean: # format or fixed text of the output without consulting the # Freedom Studio dev team. ############################################################# -# -# Metal boards are any folders that aren't the Legacy BSP or update-targets.sh -EXCLUDE_TARGET_DIRS = drivers env include libwrap update-targets.sh + +# Finds all directories in bsp/ with settings.mk, extracts the name of those directories, and sorts them +ALL_TARGETS = $(sort $(patsubst $(TARGET_ROOT)/bsp/%/,%,$(dir $(shell find $(TARGET_ROOT)/bsp -name settings.mk)))) + list-targets: - @echo bsp-list: $(sort $(filter-out $(EXCLUDE_TARGET_DIRS),$(notdir $(wildcard bsp/*)))) + @echo bsp-list: $(ALL_TARGETS) # Metal programs are any submodules in the software folder list-programs: -- cgit v1.2.3 From 7083079297ea072a5a76b07ab53785372442d01f Mon Sep 17 00:00:00 2001 From: Nathaniel Graff Date: Thu, 14 Mar 2019 15:01:02 -0700 Subject: list-targets accepts TARGET_REQUIRE_TAGS as filter make list-targets TARGET_REQUIRE_TAGS="tag1 tag2 tag3" will list only the BSPs with all of the requested tags. Signed-off-by: Nathaniel Graff --- Makefile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index c513359..c97db4c 100644 --- a/Makefile +++ b/Makefile @@ -107,11 +107,14 @@ clean: # Freedom Studio dev team. ############################################################# -# Finds all directories in bsp/ with settings.mk, extracts the name of those directories, and sorts them -ALL_TARGETS = $(sort $(patsubst $(TARGET_ROOT)/bsp/%/,%,$(dir $(shell find $(TARGET_ROOT)/bsp -name settings.mk)))) +# Find all settings.mk with TARGET_REQUIRE_TAGS in TARGET_TAGS +MATCHING_SETTINGS = $(shell scripts/filter-targets $(TARGET_ROOT)/bsp $(TARGET_REQUIRE_TAGS)) + +# Get the name of the containing directory of all matching settings.mk +MATCHING_TARGETS = $(patsubst $(TARGET_ROOT)/bsp/%/,%,$(dir $(MATCHING_SETTINGS))) list-targets: - @echo bsp-list: $(ALL_TARGETS) + @echo bsp-list: $(sort $(MATCHING_TARGETS)) # Metal programs are any submodules in the software folder list-programs: @@ -228,3 +231,4 @@ debug: $(PROGRAM_ELF) scripts/debug --elf $(PROGRAM_ELF) --openocd $(RISCV_OPENOCD) --gdb $(RISCV_GDB) --openocd-config bsp/$(TARGET)/openocd.cfg endif + -- cgit v1.2.3 From 23070ea89d17af8b4675ba1854910b604e89d9c5 Mon Sep 17 00:00:00 2001 From: Nathaniel Graff Date: Fri, 15 Mar 2019 09:52:47 -0700 Subject: Add the list-target-tags make target `make list-target-tags` returns a list of all unique values in TARGET_TAGS for all of the BSPs. Signed-off-by: Nathaniel Graff --- Makefile | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index c97db4c..4003189 100644 --- a/Makefile +++ b/Makefile @@ -116,6 +116,23 @@ MATCHING_TARGETS = $(patsubst $(TARGET_ROOT)/bsp/%/,%,$(dir $(MATCHING_SETTINGS) list-targets: @echo bsp-list: $(sort $(MATCHING_TARGETS)) +# Lists all available TARGET_TAGS +# +# 1. Find all settings.mk +# 2. Extract the TARGET_TAGS line +# 3. Extract the value of TARGET_TAGS +# 4. Split each tag onto a newline +# 5. Sort the lines +# 6. Find unique tags +# +list-target-tags: + @echo target-tags: $(shell find $(TARGET_ROOT)/bsp -name settings.mk | \ + xargs grep -he "TARGET_TAGS" | \ + sed -r 's/TARGET_TAGS.*=(.*)/\1/' | \ + tr ' ' '\n' | \ + sort | \ + uniq) + # Metal programs are any submodules in the software folder list-programs: @echo program-list: $(shell grep -o '= software/.*$$' .gitmodules | sed 's/.*\///') -- cgit v1.2.3 From 5dd316a7fff887877c229be395db74dd62634586 Mon Sep 17 00:00:00 2001 From: Nathaniel Graff Date: Fri, 15 Mar 2019 10:05:57 -0700 Subject: Mark list-* as PHONY Signed-off-by: Nathaniel Graff --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 4003189..7eb7229 100644 --- a/Makefile +++ b/Makefile @@ -113,6 +113,7 @@ MATCHING_SETTINGS = $(shell scripts/filter-targets $(TARGET_ROOT)/bsp $(TARGET_R # Get the name of the containing directory of all matching settings.mk MATCHING_TARGETS = $(patsubst $(TARGET_ROOT)/bsp/%/,%,$(dir $(MATCHING_SETTINGS))) +.PHONY: list-targets list-targets: @echo bsp-list: $(sort $(MATCHING_TARGETS)) @@ -125,6 +126,7 @@ list-targets: # 5. Sort the lines # 6. Find unique tags # +.PHONY: list-target-tags list-target-tags: @echo target-tags: $(shell find $(TARGET_ROOT)/bsp -name settings.mk | \ xargs grep -he "TARGET_TAGS" | \ @@ -134,9 +136,11 @@ list-target-tags: uniq) # Metal programs are any submodules in the software folder +.PHONY: list-programs list-programs: @echo program-list: $(shell grep -o '= software/.*$$' .gitmodules | sed 's/.*\///') +.PHONY: list-options list-options: list-programs list-targets ############################################################# -- cgit v1.2.3