17c958c9eSVal213include ../env.mk 27c958c9eSVal213 37c958c9eSVal213# 设置编译器 47c958c9eSVal213ifeq ($(ARCH), x86_64) 5*415e46eaSLoGinCCPREFIX=x86_64-linux-gnu- 67c958c9eSVal213else ifeq ($(ARCH), riscv64) 7*415e46eaSLoGinCCPREFIX=riscv64-linux-gnu- 87c958c9eSVal213endif 97c958c9eSVal213 10*415e46eaSLoGinexport CC=$(CCPREFIX)gcc 11*415e46eaSLoGinexport LD=$(CCPREFIX)ld 12*415e46eaSLoGinexport AS=$(CCPREFIX)as 13*415e46eaSLoGinexport NM=$(CCPREFIX)nm 14*415e46eaSLoGinexport AR=$(CCPREFIX)ar 15*415e46eaSLoGinexport OBJCOPY=$(CCPREFIX)objcopy 167c958c9eSVal213 177c958c9eSVal213export DEBUG=DEBUG 187c958c9eSVal213 197c958c9eSVal213export CFLAGS_DEFINE_ARCH="__$(ARCH)__" 207c958c9eSVal213 217c958c9eSVal213export GLOBAL_CFLAGS := -fno-builtin -fno-stack-protector -D $(CFLAGS_DEFINE_ARCH) -D $(EMULATOR) -O1 227c958c9eSVal213 237c958c9eSVal213ifeq ($(ARCH), x86_64) 247c958c9eSVal213GLOBAL_CFLAGS += -mcmodel=large -m64 257c958c9eSVal213else ifeq ($(ARCH), riscv64) 2623ef2b33SLoGinGLOBAL_CFLAGS += -mcmodel=medany -march=rv64gc -mabi=lp64d 277c958c9eSVal213endif 287c958c9eSVal213 297c958c9eSVal213ifeq ($(DEBUG), DEBUG) 307c958c9eSVal213GLOBAL_CFLAGS += -g 317c958c9eSVal213endif 32703ce5a7SLoGin 33703ce5a7SLoGinexport RUSTFLAGS := -C link-args=-znostart-stop-gc 34703ce5a7SLoGinexport RUSTDOCFLAGS := -C link-args=-znostart-stop-gc