summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathaniel Graff <nathaniel.graff@sifive.com>2019-06-21 17:50:30 +0000
committerGitHub <noreply@github.com>2019-06-21 17:50:30 +0000
commitaee590a1feb11dc29f385543fa65c5319d251ba5 (patch)
tree3ba87fe22dd47703da107cd398ba92f276fb4e50
parent0f5761d7d32edddf93f302f52b903e8acca08c5e (diff)
parentab1c7aab817648eaf7fd80e939742e6060689d16 (diff)
Merge pull request #291 from sifive/fix-list-targets
Default target is the first BSP
-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
#############################################################