parent
e1f93a179a
commit
94bc8353f7
@ -1 +0,0 @@
|
|||||||
Subproject commit a37a65fa13a00c5aa0068c3f2b5d55af6a37dd93
|
|
@ -1,5 +1,55 @@
|
|||||||
# arch = {riscv32, x86_64}
|
# arch = {riscv32, x86_64, aarch64}
|
||||||
arch := riscv32
|
# mode = {debug, release}
|
||||||
|
arch ?= riscv32
|
||||||
|
mode ?= debug
|
||||||
|
|
||||||
all:
|
rust_src_dir := src/bin
|
||||||
cargo xbuild --target $(arch)-ucore.json
|
rust_bin_path := target/$(arch)-ucore/$(mode)
|
||||||
|
user_rust_bins := $(patsubst $(rust_src_dir)/%.rs, $(rust_bin_path)/%, $(wildcard $(rust_src_dir)/*.rs))
|
||||||
|
c_src_dir :=
|
||||||
|
c_bin_path :=
|
||||||
|
user_c_bins :=
|
||||||
|
user_bins := $(user_rust_bins) $(user_c_bins)
|
||||||
|
|
||||||
|
build_path := build
|
||||||
|
sfsroot := $(build_path)/sfsroot-$(arch)
|
||||||
|
sfsimg := $(build_path)/user-$(arch).img
|
||||||
|
|
||||||
|
mksfs := mksfs
|
||||||
|
|
||||||
|
build_args := --target $(arch)-ucore.json
|
||||||
|
ifeq ($(mode), release)
|
||||||
|
build_args := $(build_args) --release
|
||||||
|
endif
|
||||||
|
|
||||||
|
.PHONY: all clean build-rust build-c build mksfs sfsimg
|
||||||
|
|
||||||
|
all: $(sfsimg)
|
||||||
|
|
||||||
|
build-rust:
|
||||||
|
@echo Building user rust programs
|
||||||
|
@cargo xbuild $(build_args)
|
||||||
|
|
||||||
|
build-c:
|
||||||
|
@echo Building user C programs
|
||||||
|
|
||||||
|
build: build-rust build-c
|
||||||
|
|
||||||
|
mksfs:
|
||||||
|
ifeq ($(shell which $(mksfs)),)
|
||||||
|
@cargo install --git https://github.com/wangrunji0408/SimpleFileSystem-Rust --features="std"
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(sfsroot): build
|
||||||
|
@mkdir -p $(sfsroot)/
|
||||||
|
@cp $(user_bins) $(sfsroot)/
|
||||||
|
|
||||||
|
$(sfsimg): mksfs $(sfsroot)
|
||||||
|
@echo Creating SFS image at $@
|
||||||
|
@$(mksfs) zip $(sfsroot) $@
|
||||||
|
|
||||||
|
sfsimg: $(sfsimg)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@cargo clean
|
||||||
|
@rm -rf $(build_path)
|
||||||
|
Loading…
Reference in new issue