summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorNathaniel Graff <nathaniel.graff@sifive.com>2019-01-11 09:40:15 -0800
committerNathaniel Graff <nathaniel.graff@sifive.com>2019-01-11 09:40:15 -0800
commitc514bede796f9ecca7f36c4ad99081e556f66c5e (patch)
tree506933c21e23f28d67625028fc9769833c3f9b80 /Makefile
parent4788459f11eaf46858a72004dd0d0db0a990e1df (diff)
Add Makefile arguments for out-of-tree BSPs and programs
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile13
1 files changed, 8 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 491a3dd..4efa50c 100644
--- a/Makefile
+++ b/Makefile
@@ -33,6 +33,9 @@ BOARD ?= sifive-hifive1
endif # $(BSP)
+BOARD_ROOT ?= $(abspath .)
+PROGRAM_ROOT ?= $(abspath .)
+
# Variables the user probably shouldn't override.
#############################################################
# BSP Loading
@@ -40,7 +43,7 @@ endif # $(BSP)
# Finds the directory in which this BSP is located, ensuring that there is
# exactly one.
-board_dir := $(wildcard bsp/$(BSP_SUBDIR)/$(BOARD))
+board_dir := $(wildcard $(BOARD_ROOT)/bsp/$(BSP_SUBDIR)/$(BOARD))
ifeq ($(words $(board_dir)),0)
$(error Unable to find BSP for $(BOARD), expected to find either "bsp/$(BOARD)" or "bsp-addons/$(BOARD)")
endif
@@ -151,7 +154,7 @@ endif
#############################################################
ifeq ($(BSP),mee)
MEE_SOURCE_PATH ?= freedom-mee
-MEE_BSP_PATH = bsp/$(BOARD)
+MEE_BSP_PATH = $(BOARD_ROOT)/bsp/$(BOARD)
MEE_LDSCRIPT = $(MEE_BSP_PATH)/mee.lds
MEE_HEADER = $(MEE_BSP_PATH)/mee.h
@@ -218,8 +221,8 @@ clean: clean-elf2hex
#############################################################
# This Section is for Software Compilation
#############################################################
-PROGRAM_ELF = software/$(PROGRAM)/$(PROGRAM)
-PROGRAM_HEX = software/$(PROGRAM)/$(PROGRAM).hex
+PROGRAM_ELF = $(PROGRAM_ROOT)/software/$(PROGRAM)/$(PROGRAM)
+PROGRAM_HEX = $(PROGRAM_ROOT)/software/$(PROGRAM)/$(PROGRAM).hex
ifeq ($(BSP),mee)
.PHONY: software
@@ -230,7 +233,7 @@ software: $(PROGRAM_HEX)
endif
$(PROGRAM_ELF): \
- $(addprefix software/$(PROGRAM)/,$(shell git -C software/$(PROGRAM) ls-files)) \
+ $(addprefix $(PROGRAM_ROOT)/software/$(PROGRAM)/,$(shell git -C $(PROGRAM_ROOT)/software/$(PROGRAM) ls-files)) \
$(MEE_BSP_PATH)/install/lib/libmee.a \
$(MEE_BSP_PATH)/install/lib/libmee-gloss.a \
$(MEE_BSP_PATH)/mee.lds