1# The toolchain we use. 2# You can get it by running DragonOS' `tools/bootstrap.sh` 3TOOLCHAIN="+nightly-2023-08-15-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 12build: 13 RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) build 14 15run-dragonreach: 16 RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) run --bin DragonReach 17 18clean: 19 RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) clean 20 21build-release: 22 RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) build --release 23 24clean-release: 25 RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) clean --release 26 27fmt: 28 RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) fmt 29 30fmt-check: 31 RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) fmt --check 32 33.PHONY: install 34install: 35 mkdir -p $(INSTALL_DIR)/etc/reach/system 36 mkdir -p $(INSTALL_DIR)/etc/reach/ipc 37 cp ./parse_test/shell.service $(INSTALL_DIR)/etc/reach/system/shell.service 38 RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) install --path . --no-track --root $(INSTALL_DIR) --force 39