xref: /NovaShell/Makefile (revision 4eae9fc5e259896a1dbea68618bc343d9d1d10aa)
1# The toolchain we use.
2# You can get it by running DragonOS' `tools/bootstrap.sh`
3# TOOLCHAIN="+nightly-2023-08-15-x86_64-unknown-linux_dragonos-gnu"
4# RUSTFLAGS+="-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
18check:
19	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) check --all-features
20
21clean:
22	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) clean
23
24test:
25	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) test
26
27doc:
28	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) doc
29
30fmt:
31	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) fmt
32
33fmt-check:
34	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) fmt --check
35
36run-release:
37	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) run --release
38
39build-release:
40	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) build --release
41
42clean-release:
43	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) clean --release
44
45test-release:
46	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) test --release
47
48.PHONY: install
49install:
50	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) install --path . --no-track --root $(INSTALL_DIR) --force
51