1*fae6e9adSlinfengTOOLCHAIN="+nightly-2024-07-23-x86_64-unknown-linux-gnu" 2*fae6e9adSlinfengRUSTFLAGS+="" 3*fae6e9adSlinfeng 4*fae6e9adSlinfengifdef DADK_CURRENT_BUILD_DIR 5*fae6e9adSlinfeng# 如果是在dadk中编译,那么安装到dadk的安装目录中 6*fae6e9adSlinfeng INSTALL_DIR = $(DADK_CURRENT_BUILD_DIR) 7*fae6e9adSlinfengelse 8*fae6e9adSlinfeng# 如果是在本地编译,那么安装到当前目录下的install目录中 9*fae6e9adSlinfeng INSTALL_DIR = ./install 10*fae6e9adSlinfengendif 11*fae6e9adSlinfeng 12*fae6e9adSlinfengifeq ($(ARCH), x86_64) 13*fae6e9adSlinfeng export RUST_TARGET=x86_64-unknown-linux-musl 14*fae6e9adSlinfengelse ifeq ($(ARCH), riscv64) 15*fae6e9adSlinfeng export RUST_TARGET=riscv64gc-unknown-linux-gnu 16*fae6e9adSlinfengelse 17*fae6e9adSlinfeng# 默认为x86_86,用于本地编译 18*fae6e9adSlinfeng export RUST_TARGET=x86_64-unknown-linux-musl 19*fae6e9adSlinfengendif 20*fae6e9adSlinfeng 21*fae6e9adSlinfengrun: 22*fae6e9adSlinfeng RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) run --target $(RUST_TARGET) 23*fae6e9adSlinfeng 24*fae6e9adSlinfengbuild:build-ebpf 25*fae6e9adSlinfeng RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) build --target $(RUST_TARGET) 26*fae6e9adSlinfeng 27*fae6e9adSlinfengclean:clean-ebpf 28*fae6e9adSlinfeng RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) clean --target $(RUST_TARGET) 29*fae6e9adSlinfeng 30*fae6e9adSlinfengtest: 31*fae6e9adSlinfeng RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) test --target $(RUST_TARGET) 32*fae6e9adSlinfeng 33*fae6e9adSlinfengdoc: 34*fae6e9adSlinfeng RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) doc --target $(RUST_TARGET) 35*fae6e9adSlinfeng 36*fae6e9adSlinfengfmt: 37*fae6e9adSlinfeng RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) fmt 38*fae6e9adSlinfeng 39*fae6e9adSlinfengfmt-check: 40*fae6e9adSlinfeng RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) fmt --check 41*fae6e9adSlinfeng 42*fae6e9adSlinfengrun-release: 43*fae6e9adSlinfeng RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) run --target $(RUST_TARGET) --release 44*fae6e9adSlinfeng 45*fae6e9adSlinfengbuild-release:build-ebpf 46*fae6e9adSlinfeng RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) build --target $(RUST_TARGET) --release 47*fae6e9adSlinfeng 48*fae6e9adSlinfengclean-release:clean-ebpf 49*fae6e9adSlinfeng RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) clean --target $(RUST_TARGET) --release 50*fae6e9adSlinfeng 51*fae6e9adSlinfengtest-release: 52*fae6e9adSlinfeng RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) test --target $(RUST_TARGET) --release 53*fae6e9adSlinfeng 54*fae6e9adSlinfengbuild-ebpf: 55*fae6e9adSlinfeng cd ./syscall_ebpf && RUST_LOG=debug cargo xtask build --release 56*fae6e9adSlinfengclean-ebpf: 57*fae6e9adSlinfeng cd ./syscall_ebpf && cargo clean 58*fae6e9adSlinfeng 59*fae6e9adSlinfeng.PHONY: install 60*fae6e9adSlinfenginstall:build-ebpf 61*fae6e9adSlinfeng RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) install --target $(RUST_TARGET) --path . --no-track --root $(INSTALL_DIR) --force 62