blob: 056fc5fd2149bf0ce216d9d2ccb523413ae59a5f [file] [log] [blame]
# Common make definitions, customized for each platform
# Definitions required in all program directories to compile and link
# C programs using gcc.
ROOT = $(BUILD_ROOT)/..
OUT_DIR = $(ROOT)/out
LOCAL_PATH=.
ifeq ($(BUILD_PLATFORM), master)
ifeq ($(BUILD_BRANCH), rls3895)
BUILD_TOOLCHAIN_DIR = $(ROOT)/toolchain/gcc-4.9-rls3895
else
BUILD_TOOLCHAIN_DIR = $(ROOT)/toolchain/gcc-4.9
endif
CC=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-uclibcgnueabi-gcc
AR=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-uclibcgnueabi-ar
else ifeq ($(BUILD_PLATFORM), v2102)
ifeq ($(BUILD_STD_LIBC), glibc)
BUILD_TOOLCHAIN_DIR = $(ROOT)/toolchain/gcc-8.4-glibc
CC=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-gnueabi-gcc
AR=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-gnueabi-ar
else
BUILD_TOOLCHAIN_DIR = $(ROOT)/toolchain/gcc-8.4
CC=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-muslgnueabi-gcc
AR=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-muslgnueabi-ar
endif
else
CC=gcc
AR=ar
endif
MAKE=make
$(info BUILD_LIB_TYPE=$(BUILD_LIB_TYPE))
$(info BUILD_PLATFORM=$(BUILD_PLATFORM))
$(info BUILD_BRANCH=$(BUILD_BRANCH))
$(info BUILD_PROJECT=$(BUILD_PROJECT))
$(info ROOT=$(ROOT))
$(info CC=$(CC))
$(info AR=$(AR))
# -Werror=non-virtual-dtor
CFLAGS= --sysroot=$(BUILD_TOOLCHAIN_DIR) -Os -pipe -rdynamic -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -mfloat-abi=hard -fno-exceptions -Wno-multichar -ffunction-sections -fdata-sections -funwind-tables -Wa,--noexecstack -fno-short-enums -no-canonical-prefixes -fno-canonical-system-headers -mfpu=neon -fno-builtin-sin -fno-strict-volatile-bitfields -Wno-psabi -mthumb-interwork -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith -g -Wstrict-aliasing=2 -fgcse-after-reload -frerun-cse-after-loop -frename-registers -mthumb -fomit-frame-pointer -fno-strict-aliasing -Werror=format-security -Werror=return-type -Werror=address -Werror=sequence-point -ffunction-sections -Wl,--gc-sections -Wl,--no-undefined -Wno-sign-compare -Wno-pointer-arith
AWK=awk
#CFLAGS += -Wno-error=format-truncation -Wno-error=format-overflow= -Wno-error=stringop-overread -Wno-error=deprecated-declarations
INC_DIR = \
-I$(LOCAL_PATH)/ \
-I$(LOCAL_PATH)/inc \
-I$(BUILD_ROOT)/include \
-I$(BUILD_ROOT)/include/mbtk \
-I$(BUILD_ROOT)/include/lynq \
-I$(BUILD_ROOT)/include/mqtt \
-I$(BUILD_ROOT)/include/ql
# -DCONFIG_AB_SYSTEM
DEFINE = \
-DMBTK_SUPPORT \
-DMARVELL_EXTENDED \
-DPXA1826_AUDIO \
-D__USE_GNU \
-DNOT_DROPPED_FLAGS_TEST \
-DNDEBUG \
-UDEBUG \
-D_FORTIFY_SOURCE=2 \
-D_GNU_SOURCE \
-DMBTK_BUILD_TIME=\""$(shell date +%Y/%m/%d\ %H:%M:%S)\"" \
-DMBTK_BUILD_GIT=\""$(shell git log | grep commit | head -1 | cut -d ' ' -f 2)\""
#MBTK_BUILD_GIT="$(shell git log | grep commit | head -1 | cut -d ' ' -f 2)"
#$(info MBTK_BUILD_GIT=$(MBTK_BUILD_GIT))
#$(info TOPDIR=$(TOPDIR))
# BUILD_PROJECT=$(shell cat $(ROOT)/../build_version | grep PROJECT | cut -d '=' -f 2)
#$(info BUILD_PROJECT=$(BUILD_PROJECT))
#BUILD_PROJECT_X=$(shell ${BUILD_PROJECT:0:4})
#BUILD_PROJECT_X=$(shell echo $(BUILD_PROJECT) | cut -c 1-4)
#$(info BUILD_PROJECT_X=$(BUILD_PROJECT_X))
# 1806
ifeq ($(BUILD_PLATFORM), v2102)
DEFINE += -DMBTK_PLATFORM_KERNEL_5
ifeq ($(BUILD_PROJECT), L508_X6)
DEFINE += -DMBTK_PROJECT_L508_X6
else
ifeq ($(BUILD_PROJECT), T108_2)
DEFINE += -DMBTK_PROJECT_T108
else
ifeq ($(BUILD_PROJECT), T108)
DEFINE += -DMBTK_PROJECT_T108
else
ifeq ($(BUILD_PROJECT), L508)
DEFINE += -DMBTK_PROJECT_L508
else
ifeq ($(BUILD_PROJECT), L509)
DEFINE += -DMBTK_PROJECT_L509
else
$(info BUILD_PROJECT=Unknown)
endif
endif
endif
endif
endif
# 1803
else
DEFINE += -DMBTK_POLARSSL_SUPPORT
ifeq ($(BUILD_BRANCH), rls3671)
DEFINE += -DMBTK_MP3_SUPPORT
endif
DEFINE += -DMBTK_PLATFORM_KERNEL_3
ifeq ($(BUILD_PROJECT), L508)
DEFINE += -DMBTK_PROJECT_L508
else
ifeq ($(BUILD_PROJECT), L509)
DEFINE += -DMBTK_PROJECT_L509
else
ifeq ($(BUILD_PROJECT), PN1803)
DEFINE += -DMBTK_PROJECT_PN1803
else
$(info BUILD_PROJECT=Unknown)
endif
endif
endif
endif
ifeq ($(MBTK_AF_SUPPORT), y)
DEFINE += -DMBTK_AF_SUPPORT
endif
ifeq ($(MBTK_YX_SUPPORT), y)
DEFINE += -DMBTK_YX_SUPPORT
endif
ifeq ($(MBTK_SG_SUPPORT), y)
DEFINE += -DMBTK_SG_SUPPORT
endif
ifeq ($(MBTK_ALL_CID_SUPPORT), y)
DEFINE += -DMBTK_ALL_CID_SUPPORT
endif
ifeq ($(MBTK_GNSS_MODE), gnss_6228)
DEFINE += -DMBTK_GNSS_6228
else
ifeq ($(MBTK_GNSS_MODE), gnss_5311)
DEFINE += -DMBTK_GNSS_5311
else
ifeq ($(MBTK_GNSS_MODE), gnss_8122)
DEFINE += -DMBTK_GNSS_8122
else
DEFINE += -DMBTK_GNSS_ALL
endif
endif
endif
ifeq ($(MBTK_DUMP_SUPPORT), y)
DEFINE += -DMBTK_DUMP_SUPPORT
endif
ifeq ($(MBTK_SOURCE_VERSION), 2)
DEFINE += -DMBTK_SOURCE_VERSION_2
endif
LIB_DIR = \
-L$(OUT_DIR)/lib
LIBS = -lpthread -lstdc++
# Common temp files to delete from each directory.
TEMPFILES=core core.* *.o temp.* *.out