xref: /DragonOS/user/apps/test_socket/Makefile (revision 7c28051e8c601312d3d0fd7bcb71bc71450d10c0)
1*7c28051eSlinfengTOOLCHAIN="+nightly-2024-11-05-x86_64-unknown-linux-gnu"
26046f775S裕依RUSTFLAGS+=""
36046f775S裕依
46046f775S裕依ifdef DADK_CURRENT_BUILD_DIR
56046f775S裕依# 如果是在dadk中编译,那么安装到dadk的安装目录中
66046f775S裕依	INSTALL_DIR = $(DADK_CURRENT_BUILD_DIR)
76046f775S裕依else
86046f775S裕依# 如果是在本地编译,那么安装到当前目录下的install目录中
96046f775S裕依	INSTALL_DIR = ./install
106046f775S裕依endif
116046f775S裕依
126046f775S裕依ifeq ($(ARCH), x86_64)
136046f775S裕依	export RUST_TARGET=x86_64-unknown-linux-musl
146046f775S裕依else ifeq ($(ARCH), riscv64)
156046f775S裕依	export RUST_TARGET=riscv64gc-unknown-linux-gnu
166046f775S裕依else
176046f775S裕依# 默认为x86_86,用于本地编译
186046f775S裕依	export RUST_TARGET=x86_64-unknown-linux-musl
196046f775S裕依endif
206046f775S裕依
216046f775S裕依run:
226046f775S裕依	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) run --target $(RUST_TARGET)
236046f775S裕依
246046f775S裕依build:
256046f775S裕依	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) build --target $(RUST_TARGET)
266046f775S裕依
276046f775S裕依clean:
286046f775S裕依	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) clean --target $(RUST_TARGET)
296046f775S裕依
306046f775S裕依test:
316046f775S裕依	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) test --target $(RUST_TARGET)
326046f775S裕依
336046f775S裕依doc:
346046f775S裕依	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) doc --target $(RUST_TARGET)
356046f775S裕依
366046f775S裕依fmt:
376046f775S裕依	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) fmt
386046f775S裕依
396046f775S裕依fmt-check:
406046f775S裕依	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) fmt --check
416046f775S裕依
426046f775S裕依run-release:
436046f775S裕依	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) run --target $(RUST_TARGET) --release
446046f775S裕依
456046f775S裕依build-release:
466046f775S裕依	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) build --target $(RUST_TARGET) --release
476046f775S裕依
486046f775S裕依clean-release:
496046f775S裕依	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) clean --target $(RUST_TARGET) --release
506046f775S裕依
516046f775S裕依test-release:
526046f775S裕依	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) test --target $(RUST_TARGET) --release
536046f775S裕依
546046f775S裕依.PHONY: install
556046f775S裕依install:
566046f775S裕依	RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) install --target $(RUST_TARGET) --path . --no-track --root $(INSTALL_DIR) --force
57