From ab1c7aab817648eaf7fd80e939742e6060689d16 Mon Sep 17 00:00:00 2001 From: Nathaniel Graff Date: Fri, 21 Jun 2019 10:40:39 -0700 Subject: Default target is the first BSP Signed-off-by: Nathaniel Graff --- Makefile | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 8c795d4..15f103d 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,9 @@ $(info Obtaining additional make variables from $(extra_configs)) include $(extra_configs) endif +TARGET_ROOT ?= $(abspath .) +PROGRAM_ROOT ?= $(abspath .) + # Allow BOARD as a synonym for TARGET ifneq ($(BOARD),) TARGET ?= $(BOARD) @@ -18,7 +21,8 @@ endif # Default PROGRAM and TARGET PROGRAM ?= hello -TARGET ?= sifive-hifive1 +TARGET ?= $(shell find $(TARGET_ROOT)/bsp/* -type d | head -n 1 | rev | cut -d '/' -f 1 | rev) +CONFIGURATION ?= debug # Setup differences between host platforms ifeq ($(OS),Windows_NT) @@ -40,9 +44,6 @@ PORT_DIR = freedom-metal endif endif -TARGET_ROOT ?= $(abspath .) -PROGRAM_ROOT ?= $(abspath .) - SRC_DIR = $(PROGRAM_ROOT)/software/$(PROGRAM) PROGRAM_ELF = $(SRC_DIR)/$(CONFIGURATION)/$(PROGRAM).elf @@ -57,10 +58,6 @@ PROGRAM_LST = $(SRC_DIR)/$(CONFIGURATION)/$(PROGRAM).lst # exactly one. BSP_DIR := $(wildcard $(TARGET_ROOT)/bsp/$(TARGET)) -# Only perform these error checks and include the standalone.mk fragment -# if we're not processing one of the "list-" targets -ifneq ($@,$(filter $@, list-targets list-target-tags list-programs list-options)) - ifeq ($(words $(BSP_DIR)),0) $(error Unable to find BSP for $(TARGET), expected to find "bsp/$(TARGET)") endif @@ -82,9 +79,6 @@ endif include scripts/standalone.mk -# End of exclusion when procesinng "list-" targets. -endif - ############################################################# # Prints help message ############################################################# -- cgit v1.2.3