env.mk 781 B

12345678910111213141516171819202122232425262728293031323334
  1. include ../env.mk
  2. # 设置编译器
  3. ifeq ($(ARCH), x86_64)
  4. CCPREFIX=x86_64-linux-gnu-
  5. else ifeq ($(ARCH), riscv64)
  6. CCPREFIX=riscv64-linux-gnu-
  7. endif
  8. export CC=$(CCPREFIX)gcc
  9. export LD=$(CCPREFIX)ld
  10. export AS=$(CCPREFIX)as
  11. export NM=$(CCPREFIX)nm
  12. export AR=$(CCPREFIX)ar
  13. export OBJCOPY=$(CCPREFIX)objcopy
  14. export DEBUG=DEBUG
  15. export CFLAGS_DEFINE_ARCH="__$(ARCH)__"
  16. export GLOBAL_CFLAGS := -fno-builtin -fno-stack-protector -D $(CFLAGS_DEFINE_ARCH) -D $(EMULATOR) -O1
  17. ifeq ($(ARCH), x86_64)
  18. GLOBAL_CFLAGS += -mcmodel=large -m64
  19. else ifeq ($(ARCH), riscv64)
  20. GLOBAL_CFLAGS += -mcmodel=medany -march=rv64gc -mabi=lp64d
  21. endif
  22. ifeq ($(DEBUG), DEBUG)
  23. GLOBAL_CFLAGS += -g
  24. endif
  25. export RUSTFLAGS := -C link-args=-znostart-stop-gc
  26. export RUSTDOCFLAGS := -C link-args=-znostart-stop-gc