diff options
author | Nathaniel Graff <nathaniel.graff@sifive.com> | 2019-01-11 21:36:49 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-11 21:36:49 +0000 |
commit | 39c32deaad0418da56745e04e42c340264740054 (patch) | |
tree | 506933c21e23f28d67625028fc9769833c3f9b80 /Makefile | |
parent | 4788459f11eaf46858a72004dd0d0db0a990e1df (diff) | |
parent | c514bede796f9ecca7f36c4ad99081e556f66c5e (diff) |
Merge pull request #141 from sifive/out-of-tree
Support out-of-tree programs and BSPs
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -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 |