diff options
author | Nathaniel Graff <nathaniel.graff@sifive.com> | 2019-02-12 15:33:43 -0800 |
---|---|---|
committer | Nathaniel Graff <nathaniel.graff@sifive.com> | 2019-02-12 15:47:44 -0800 |
commit | 8601cd3c6555b95698495dd122e2edd9ea031a9f (patch) | |
tree | 1d796d219993eaefe7ee00aa1abe66932c7024a0 | |
parent | f645822003024a89dcf5278dbd386250179bf1f1 (diff) |
Move libmetal make targets to scripts/libmetal.mk
Signed-off-by: Nathaniel Graff <nathaniel.graff@sifive.com>
-rw-r--r-- | Makefile | 46 | ||||
-rw-r--r-- | scripts/libmetal.mk | 48 |
2 files changed, 50 insertions, 44 deletions
@@ -131,54 +131,12 @@ list-options: list-programs list-targets endif ############################################################# -# Compiles an instance of the MEE targeted at $(TARGET) +# Import rules to build Freedom Metal ############################################################# ifeq ($(BSP),metal) -MEE_SOURCE_PATH ?= freedom-metal -MEE_LDSCRIPT = $(BSP_DIR)/metal.lds -MEE_HEADER = $(BSP_DIR)/metal.h - -.PHONY: metal -metal: $(BSP_DIR)/install/stamp - -$(BSP_DIR)/build/Makefile: - @rm -rf $(dir $@) - @mkdir -p $(dir $@) - cd $(dir $@) && \ - CFLAGS="-march=$(RISCV_ARCH) -mabi=$(RISCV_ABI) -g -mcmodel=medany" \ - $(abspath $(MEE_SOURCE_PATH)/configure) \ - --host=$(CROSS_COMPILE) \ - --prefix=$(abspath $(BSP_DIR)/install) \ - --disable-maintainer-mode \ - --with-preconfigured \ - --with-machine-name=$(TARGET) \ - --with-machine-header=$(abspath $(MEE_HEADER)) \ - --with-machine-ldscript=$(abspath $(MEE_LDSCRIPT)) \ - --with-builtin-libgloss - touch -c $@ - -$(BSP_DIR)/install/stamp: $(BSP_DIR)/build/Makefile - $(MAKE) -C $(abspath $(BSP_DIR)/build) install - date > $@ - -$(BSP_DIR)/install/lib/libriscv%.a: $(BSP_DIR)/install/stamp ;@: - -$(BSP_DIR)/install/lib/libmetal.a: $(BSP_DIR)/install/lib/libriscv__mmachine__$(TARGET).a - cp $< $@ - -$(BSP_DIR)/install/lib/libmetal-gloss.a: $(BSP_DIR)/install/lib/libriscv__menv__metal.a - cp $< $@ - -.PHONY: clean-metal -clean-metal: - rm -rf $(BSP_DIR)/install - rm -rf $(BSP_DIR)/build -clean: clean-metal +include scripts/libmetal.mk endif -metal_install: metal - $(MAKE) -C $(MEE_SOURCE_PATH) install - ############################################################# # elf2hex ############################################################# diff --git a/scripts/libmetal.mk b/scripts/libmetal.mk new file mode 100644 index 0000000..7cdb7c5 --- /dev/null +++ b/scripts/libmetal.mk @@ -0,0 +1,48 @@ + +############################################################# +# Compiles an instance of the MEE targeted at $(TARGET) +############################################################# +MEE_SOURCE_PATH ?= freedom-metal +MEE_LDSCRIPT = $(BSP_DIR)/metal.lds +MEE_HEADER = $(BSP_DIR)/metal.h + +.PHONY: metal +metal: $(BSP_DIR)/install/stamp + +$(BSP_DIR)/build/Makefile: + @rm -rf $(dir $@) + @mkdir -p $(dir $@) + cd $(dir $@) && \ + CFLAGS="-march=$(RISCV_ARCH) -mabi=$(RISCV_ABI) -g -mcmodel=medany" \ + $(abspath $(MEE_SOURCE_PATH)/configure) \ + --host=$(CROSS_COMPILE) \ + --prefix=$(abspath $(BSP_DIR)/install) \ + --disable-maintainer-mode \ + --with-preconfigured \ + --with-machine-name=$(TARGET) \ + --with-machine-header=$(abspath $(MEE_HEADER)) \ + --with-machine-ldscript=$(abspath $(MEE_LDSCRIPT)) \ + --with-builtin-libgloss + touch -c $@ + +$(BSP_DIR)/install/stamp: $(BSP_DIR)/build/Makefile + $(MAKE) -C $(abspath $(BSP_DIR)/build) install + date > $@ + +$(BSP_DIR)/install/lib/libriscv%.a: $(BSP_DIR)/install/stamp ;@: + +$(BSP_DIR)/install/lib/libmetal.a: $(BSP_DIR)/install/lib/libriscv__mmachine__$(TARGET).a + cp $< $@ + +$(BSP_DIR)/install/lib/libmetal-gloss.a: $(BSP_DIR)/install/lib/libriscv__menv__metal.a + cp $< $@ + +.PHONY: clean-metal +clean-metal: + rm -rf $(BSP_DIR)/install + rm -rf $(BSP_DIR)/build +clean: clean-metal + +metal_install: metal + $(MAKE) -C $(MEE_SOURCE_PATH) install + |