summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathaniel Graff <nathaniel.graff@sifive.com>2019-06-21 10:40:39 -0700
committerNathaniel Graff <nathaniel.graff@sifive.com>2019-06-21 10:40:39 -0700
commitab1c7aab817648eaf7fd80e939742e6060689d16 (patch)
tree3ba87fe22dd47703da107cd398ba92f276fb4e50
parent0f5761d7d32edddf93f302f52b903e8acca08c5e (diff)
Default target is the first BSP
Signed-off-by: Nathaniel Graff <nathaniel.graff@sifive.com>
-rw-r--r--Makefile16
1 files changed, 5 insertions, 11 deletions
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
#############################################################