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