xref: /DragonReach/Makefile (revision dfd3fd9812f3584f9392934d1254e24d17661b2d)
1*dfd3fd98S裕依2439# The toolchain we use.
2*dfd3fd98S裕依2439# You can get it by running DragonOS' `tools/bootstrap.sh`
3*dfd3fd98S裕依2439TOOLCHAIN="+nightly-2023-08-15-x86_64-unknown-linux-gnu"
4*dfd3fd98S裕依2439RUSTFLAGS+="-C target-feature=+crt-static -C link-arg=-no-pie"
5236b9b4fSLoGin
6*dfd3fd98S裕依2439# 如果是在dadk中编译,那么安装到dadk的安装目录中
7*dfd3fd98S裕依2439INSTALL_DIR?=$(DADK_CURRENT_BUILD_DIR)
8*dfd3fd98S裕依2439# 如果是在本地编译,那么安装到当前目录下的install目录中
9*dfd3fd98S裕依2439INSTALL_DIR?=./install
1017ae4661SGnoCiYeH
11236b9b4fSLoGin
124e851715SGnoCiYeHbuild:
13*dfd3fd98S裕依2439	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) build
144e851715SGnoCiYeH
15*dfd3fd98S裕依2439run-dragonreach:
16*dfd3fd98S裕依2439	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) run --bin DragonReach
177ae82d4aSGnoCiYeH
187ae82d4aSGnoCiYeHclean:
19*dfd3fd98S裕依2439	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) clean
20*dfd3fd98S裕依2439
21*dfd3fd98S裕依2439build-release:
22*dfd3fd98S裕依2439	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) build --release
23*dfd3fd98S裕依2439
24*dfd3fd98S裕依2439clean-release:
25*dfd3fd98S裕依2439	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) clean --release
26236b9b4fSLoGin
27236b9b4fSLoGinfmt:
28*dfd3fd98S裕依2439	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) fmt
29236b9b4fSLoGin
30236b9b4fSLoGinfmt-check:
31*dfd3fd98S裕依2439	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) fmt --check
32236b9b4fSLoGin
33*dfd3fd98S裕依2439.PHONY: install
34*dfd3fd98S裕依2439install:
35*dfd3fd98S裕依2439	mkdir -p $(INSTALL_DIR)/etc/reach/system
36*dfd3fd98S裕依2439	cp ./parse_test/shell.service $(INSTALL_DIR)/etc/reach/system/shell.service
37*dfd3fd98S裕依2439	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) install --path . --no-track --root $(INSTALL_DIR) --force
38