# ==============================================================================
#									toolchain makefile
#FileName：		makefile.toolchain
#Author:		 xianfeng.du
#Data：			2022-08-10
#Description:	 toolchain
# ==============================================================================

#MaPU_TC_HOME ?= /public/lixinxin/MaPUIDE/toolchain
MaPU_TC_HOME := /public/share/tools/msdk/toolchain
$(info "MaPU_TC_HOME=" $(MaPU_TC_HOME))
UCP_CC := $(MaPU_TC_HOME)/bin/ucp2
UCP_INC := $(MaPU_TC_HOME)/include/ucp2
UCP_LIB := $(MaPU_TC_HOME)/lib/ucp2

DEFINES ?= 

ifeq ($(debug_option),yes)
	C_OPT_FLAGS ?= -O0
	CC_FLAGS ?= -g
else
	C_OPT_FLAGS ?= -O2
endif

CC_FLAGS := $(C_OPT_FLAGS) -Wall
CC_FLAGS += -Werror
CC_FLAGS += -Wno-constant-conversion -nostdlibinc 
CC_FLAGS += -MMD -MP
#CC_FLAGS += -ffunction-sections -fdata-sections
TAR_FLAGS ?= --target=ucps2
DIA_FLAGS ?=
ifeq ($(diagnostic_option),yes)
	DIA_FLAGS := -mllvm --enable-ucps2-stack-diagnostic
endif

LD_FLAGS := -lm -lc -lgloss -lclang_rt.builtins-ucps2
LD_FLAGS += -lprint -lspinlock -lhwque
GC_FLAGS ?= --gc-sections

LIB_DIRS := $(UCP_LIB)/debug

INC_DIRS := $(DIR_LIB)/inc
INC_DIRS += $(UCP_INC)/newlib
INC_DIRS += $(UCP_INC)/llvm

USER_OBJS := $(UCP_LIB)/debug/crt0.o


