
# 交叉编译工具链

# # Ubuntu X86 的编译器
CROSS_COMPILE :=
GCCLIB_PATH := /usr/bin
ARCH := x86
BUILD_TYPE := x86

# arm架构编译器
ifeq ($(CROSS), arm)
$(info ===> 3562编译器)
CROSS_COMPILE := aarch64-buildroot-linux-gnu-
GCCLIB_PATH := /opt/atk-dlrk356x-toolchain/bin
ARCH := arm
BUILD_TYPE := arm
endif

# 公司服务器编译器 buildroot 的路径
# CROSS_COMPILE := aarch64-buildroot-linux-gnu-
# CROSS_COMPILE := aarch64-linux-
# GCCLIB_PATH   := /opt/m3568-sdk-v1.0.0-ga/host/bin


# 编译器、链接器和归档工具
CC := $(GCCLIB_PATH)/$(CROSS_COMPILE)gcc
CPP := $(GCCLIB_PATH)/$(CROSS_COMPILE)g++
LD := $(GCCLIB_PATH)/$(CROSS_COMPILE)ld
AR := $(GCCLIB_PATH)/$(CROSS_COMPILE)ar

# 项目根目录

ROOT_DIR := $(realpath $(CURDIR)/../../../../)


# 释放目录
REL_ROOT_DIR = $(ROOT_DIR)/release/$(BUILD_TYPE)
SRC_ROOT_DIR = $(ROOT_DIR)/src

# 包含路径
REL_INC = -I$(ROOT_DIR)/release/inc

# 61850库路径
ifeq ($(CROSS), arm)
LIB_61850 = $(ROOT_DIR)/libiec61850/build-arm
else
LIB_61850 = $(ROOT_DIR)/libiec61850/build
endif

# 编译选项
ifeq ($(CROSS), arm)
C_FLAGS = $(REL_INC) -DRK356x
else
C_FLAGS = $(REL_INC)
endif

#-pthread

# 库和可执行文件输出目录
LIB_REL = $(REL_ROOT_DIR)/lib
EXE_REL = $(REL_ROOT_DIR)/exe

# 导出环境变量
export CC
export CPP
export LD
export AR
export ARCH
export C_FLAGS
export ROOT_DIR
export REL_ROOT_DIR
export SRC_ROOT_DIR
export REL_INC
export LIB_REL_MY
export LIB_REL
export EXE_REL
export LIB_61850
