Makefile 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # The toolchain we use.
  2. # You can get it by running DragonOS' `tools/bootstrap.sh`
  3. TOOLCHAIN="+nightly-2024-07-23-x86_64-unknown-linux-gnu"
  4. RUSTFLAGS+="-C target-feature=+crt-static -C link-arg=-no-pie"
  5. # 如果是在dadk中编译,那么安装到dadk的安装目录中
  6. INSTALL_DIR?=$(DADK_CURRENT_BUILD_DIR)
  7. # 如果是在本地编译,那么安装到当前目录下的install目录中
  8. INSTALL_DIR?=./install
  9. run:
  10. RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) run
  11. build:
  12. RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) build
  13. clean:
  14. RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) clean
  15. test:
  16. RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) test
  17. doc:
  18. RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) doc
  19. run-release:
  20. RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) run --release
  21. build-release:
  22. RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) build --release
  23. clean-release:
  24. RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) clean --release
  25. test-release:
  26. RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) test --release
  27. .PHONY: install
  28. install:
  29. RUSTFLAGS=$(RUSTFLAGS) cargo $(TOOLCHAIN) install --path . --no-track --root $(INSTALL_DIR) --force