blob: f6cca729a8353bb7ef0e4655ab16f34d987aba31 [file] [log] [blame]
# Common make definitions, customized for each platform
# Definitions required in all program directories to compile and link
# C programs using gcc.
OUT_DIR = $(ROOT)/out
BUILD_ROOT = $(ROOT)/mbtk
LOCAL_PATH=.
ifeq ($(BUILD_PLATFORM), asr1803)
BUILD_TOOLCHAIN_DIR = $(ROOT)/toolchain/gcc-4.9
CC=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-uclibcgnueabi-gcc
AR=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-uclibcgnueabi-ar
else ifeq ($(BUILD_PLATFORM), asr1806)
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
else
CC=gcc
AR=ar
endif
MAKE=make
$(info BUILD_LIB_TYPE=$(BUILD_LIB_TYPE))
$(info BUILD_PLATFORM=$(BUILD_PLATFORM))
$(info ROOT=$(ROOT))
$(info CC=$(CC))
$(info AR=$(AR))
CFLAGS= --sysroot=$(BUILD_TOOLCHAIN_DIR) -Os -pipe -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=non-virtual-dtor -Werror=address -Werror=sequence-point -ffunction-sections -Wl,--gc-sections -Wl,--no-undefined
AWK=awk
#CFLAGS += -Wno-error=format-truncation -Wno-error=format-overflow= -Wno-error=stringop-overread -Wno-error=deprecated-declarations
INC_DIR = \
-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
#$(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))
ifeq ($(BUILD_PLATFORM), asr1806)
DEFINE += -DMBTK_PLATFORM_ASR1806
ifeq ($(shell echo $(BUILD_PROJECT) | cut -c 1-7), L508_X6)
$(info BUILD_PROJECT=L508_X6)
DEFINE += -DMBTK_PROJECT_L508_X6
else
ifeq ($(shell echo $(BUILD_PROJECT) | cut -c 1-4), T108)
$(info BUILD_PROJECT=T108)
DEFINE += -DMBTK_PROJECT_T108
else
$(info BUILD_PROJECT=Unknown)
endif
endif
else
DEFINE += -DMBTK_POLARSSL_SUPPORT
DEFINE += -DMBTK_MP3_SUPPORT
DEFINE += -DMBTK_PLATFORM_ASR1803
ifeq ($(shell echo $(BUILD_PROJECT) | cut -c 1-4), L508)
$(info BUILD_PROJECT=L508)
DEFINE += -DMBTK_PROJECT_L508
else
ifeq ($(shell echo $(BUILD_PROJECT) | cut -c 1-4), L509)
$(info BUILD_PROJECT=L509)
DEFINE += -DMBTK_PROJECT_L509
else
ifeq ($(shell echo $(BUILD_PROJECT) | cut -c 1-6), PN1803)
$(info BUILD_PROJECT=PN1803)
DEFINE += -DMBTK_PROJECT_PN1803
endif
endif
endif
endif
LIB_DIR = \
-L$(OUT_DIR)/lib
LIBS = -lpthread -lstdc++
# Common temp files to delete from each directory.
TEMPFILES=core core.* *.o temp.* *.out