xref: /DragonReach/Makefile (revision af4e087250481d24f7a6ee7057d648c56a4753e3)
1export RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static
2export RUSTUP_UPDATE_ROOT=https://mirrors.ustc.edu.cn/rust-static/rustup
3
4OUTPUT_DIR = $(DADK_BUILD_CACHE_DIR_DRAGONREACH_0_1_0)
5REACH_ETC_DIR=$(OUTPUT_DIR)/etc/reach
6REACH_BIN_DIR=$(OUTPUT_DIR)/bin/
7TMP_INSTALL_DIR=$(OUTPUT_DIR)/tmp_install
8
9all: build
10
11build:
12	@$(MAKE) -C ./systemctl build
13	cargo +nightly-2023-08-15 -Z build-std=core,alloc,compiler_builtins build --target ./x86_64-unknown-dragonos.json --release
14
15install:
16	mkdir -p $(TMP_INSTALL_DIR)
17	mkdir -p $(REACH_ETC_DIR)
18	mkdir -p $(REACH_ETC_DIR)/system/
19	mkdir -p $(REACH_BIN_DIR)
20	mkdir -p $(REACH_ETC_DIR)/ipc/
21
22	cp ./parse_test/shell.service $(REACH_ETC_DIR)/system/shell.service
23
24	cargo +nightly-2023-08-15 -Z build-std=core,alloc,compiler_builtins install --target $(TARGET) --path .  --root $(TMP_INSTALL_DIR)
25	mv $(TMP_INSTALL_DIR)/bin/DragonReach $(REACH_BIN_DIR)/DragonReach
26
27	cargo -Z build-std=core,alloc,compiler_builtins install --target $(TARGET) --path ./systemctl  --root $(TMP_INSTALL_DIR)
28	mv $(TMP_INSTALL_DIR)/bin/systemctl $(REACH_BIN_DIR)/systemctl
29
30	rm -rf $(TMP_INSTALL_DIR)
31
32build-linux:
33	@$(MAKE) -C ./systemctl build-linux
34	cargo -Z build-std=core,alloc,compiler_builtins build --target x86_64-unknown-linux-gnu
35
36clean:
37	cargo clean
38	@$(MAKE) -C ./systemctl clean
39
40fmt:
41	cargo fmt
42	@$(MAKE) -C ./systemctl fmt
43
44fmt-check:
45	cargo fmt --check
46	@$(MAKE) -C ./systemctl fmt-check
47
48check:
49	cargo -Z build-std=core,alloc,compiler_builtins check --workspace --message-format=json --target ./x86_64-unknown-dragonos.json
50	@$(MAKE) -C ./systemctl check
51