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