summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathaniel Graff <nathaniel.graff@sifive.com>2019-03-12 10:22:46 -0700
committerNathaniel Graff <nathaniel.graff@sifive.com>2019-03-12 15:37:07 -0700
commite106e9e51e8c8e9aca053f1cdc3d49c85df98212 (patch)
tree0e60d656718c8d58f7841639caa3c9187c0be465
parent1b72ca73835d6064b467a126a392f4539fa2f10a (diff)
Build program into SRC_DIR/CONFIGURATION/PROGRAM
Signed-off-by: Nathaniel Graff <nathaniel.graff@sifive.com>
-rw-r--r--Makefile4
-rw-r--r--scripts/standalone.mk9
2 files changed, 8 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 96e8fd5..3853c53 100644
--- a/Makefile
+++ b/Makefile
@@ -25,8 +25,8 @@ PROGRAM_ROOT ?= $(abspath .)
SRC_DIR = $(PROGRAM_ROOT)/software/$(PROGRAM)
-PROGRAM_ELF = $(SRC_DIR)/$(PROGRAM).elf
-PROGRAM_HEX = $(SRC_DIR)/$(PROGRAM).hex
+PROGRAM_ELF = $(SRC_DIR)/$(CONFIGURATION)/$(PROGRAM).elf
+PROGRAM_HEX = $(SRC_DIR)/$(CONFIGURATION)/$(PROGRAM).hex
#############################################################
# BSP Loading
diff --git a/scripts/standalone.mk b/scripts/standalone.mk
index 73b9776..17fec17 100644
--- a/scripts/standalone.mk
+++ b/scripts/standalone.mk
@@ -112,8 +112,8 @@ include $(CONFIGURATION).mk
# Software
#############################################################
-PROGRAM_ELF ?= $(SRC_DIR)/$(PROGRAM).elf
-PROGRAM_HEX ?= $(SRC_DIR)/$(PROGRAM).hex
+PROGRAM_ELF ?= $(SRC_DIR)/$(CONFIGURATION)/$(PROGRAM).elf
+PROGRAM_HEX ?= $(SRC_DIR)/$(CONFIGURATION)/$(PROGRAM).hex
.PHONY: all
all: software
@@ -135,7 +135,8 @@ $(PROGRAM_ELF): \
$(BSP_DIR)/install/lib/$(CONFIGURATION)/libmetal.a \
$(BSP_DIR)/install/lib/$(CONFIGURATION)/libmetal-gloss.a \
$(BSP_DIR)/metal.lds
- $(MAKE) -C $(dir $@) $(basename $(notdir $@)) \
+ mkdir -p $(dir $@)
+ $(MAKE) -C $(SRC_DIR) $(basename $(notdir $@)) \
AR=$(RISCV_AR) \
CC=$(RISCV_GCC) \
CXX=$(RISCV_GXX) \
@@ -143,6 +144,7 @@ $(PROGRAM_ELF): \
CXXFLAGS="$(RISCV_CXXFLAGS)" \
LDFLAGS="$(RISCV_LDFLAGS)" \
LDLIBS="$(RISCV_LDLIBS)"
+ mv $(SRC_DIR)/$(basename $(notdir $@)) $@
touch -c $@
$(RISCV_SIZE) $@
@@ -158,6 +160,7 @@ endif
.PHONY: clean-software
clean-software:
$(MAKE) -C $(SRC_DIR) clean
+ rm -rf $(SRC_DIR)/$(CONFIGURATION)
.PHONY: clean
clean: clean-software