rCore-Tutorial-v3/user/Makefile

21 lines
578 B
Makefile
Raw Normal View History

2020-11-18 14:29:53 +04:00
TARGET := riscv64gc-unknown-none-elf
MODE := debug
2020-11-18 14:29:53 +04:00
APP_DIR := src/bin
TARGET_DIR := target/$(TARGET)/$(MODE)
APPS := $(wildcard $(APP_DIR)/*.rs)
ELFS := $(patsubst $(APP_DIR)/%.rs, $(TARGET_DIR)/%, $(APPS))
BINS := $(patsubst $(APP_DIR)/%.rs, $(TARGET_DIR)/%.bin, $(APPS))
2020-11-18 14:29:53 +04:00
OBJDUMP := rust-objdump --arch-name=riscv64
OBJCOPY := rust-objcopy --binary-architecture=riscv64
elf: $(APPS)
@python3 build.py
2020-11-18 14:29:53 +04:00
binary: elf
$(foreach elf, $(ELFS), $(OBJCOPY) $(elf) --strip-all -O binary $(patsubst $(TARGET_DIR)/%, $(TARGET_DIR)/%.bin, $(elf));)
2020-11-18 14:29:53 +04:00
build: binary
clean:
@cargo clean