You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							24 lines
						
					
					
						
							618 B
						
					
					
				
			
		
		
	
	
							24 lines
						
					
					
						
							618 B
						
					
					
				TARGET := riscv64gc-unknown-none-elf
 | 
						|
MODE := release
 | 
						|
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))
 | 
						|
 | 
						|
OBJDUMP := rust-objdump --arch-name=riscv64
 | 
						|
OBJCOPY := rust-objcopy --binary-architecture=riscv64
 | 
						|
 | 
						|
elf: $(APPS)
 | 
						|
	@cargo build --release
 | 
						|
 | 
						|
binary: elf
 | 
						|
	$(foreach elf, $(ELFS), $(OBJCOPY) $(elf) --strip-all -O binary $(patsubst $(TARGET_DIR)/%, $(TARGET_DIR)/%.bin, $(elf));)
 | 
						|
 | 
						|
build: binary
 | 
						|
 | 
						|
clean:
 | 
						|
	@cargo clean
 | 
						|
 | 
						|
.PHONY: elf binary build clean
 |