1# The toolchain we use. 2# You can get it by running DragonOS' `tools/bootstrap.sh` 3TOOLCHAIN="+nightly-2024-07-23-x86_64-unknown-linux-gnu" 4RUSTFLAGS+="-C target-feature=+crt-static -C link-arg=-no-pie" 5 6# 如果是在dadk中编译,那么安装到dadk的安装目录中 7INSTALL_DIR?=$(DADK_CURRENT_BUILD_DIR) 8# 如果是在本地编译,那么安装到当前目录下的install目录中 9INSTALL_DIR?=./install 10 11 12run: 13 RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) run 14 15build: 16 RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) build 17 18clean: 19 RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) clean 20 21test: 22 RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) test 23 24doc: 25 RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) doc 26 27run-release: 28 RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) run --release 29 30build-release: 31 RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) build --release 32 33clean-release: 34 RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) clean --release 35 36test-release: 37 RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) test --release 38 39.PHONY: install 40install: 41 RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) install --path . --no-track --root $(INSTALL_DIR) --force 42