blob: 3a87aa3e2f5b696c1c13666207a7fb687052a345 [file] [log] [blame]
liubin281ac462023-07-19 14:22:54 +08001# Common make definitions, customized for each platform
2
3# Definitions required in all program directories to compile and link
4# C programs using gcc.
5
b.liu3403c932023-10-10 16:26:35 +08006
liubin281ac462023-07-19 14:22:54 +08007OUT_DIR = $(ROOT)/out
8BUILD_ROOT = $(ROOT)/mbtk
liubin281ac462023-07-19 14:22:54 +08009LOCAL_PATH=.
10
b.liu3403c932023-10-10 16:26:35 +080011ifeq ($(BUILD_PLATFORM), asr1803)
12BUILD_TOOLCHAIN_DIR = $(ROOT)/toolchain/gcc-4.9
liubin281ac462023-07-19 14:22:54 +080013CC=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-uclibcgnueabi-gcc
14AR=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-uclibcgnueabi-ar
b.liu3403c932023-10-10 16:26:35 +080015else ifeq ($(BUILD_PLATFORM), asr1806)
16BUILD_TOOLCHAIN_DIR = $(ROOT)/toolchain/gcc-8.4
b.liu17d7f8b2023-10-08 16:57:59 +080017CC=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-muslgnueabi-gcc
18AR=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-muslgnueabi-ar
liubin281ac462023-07-19 14:22:54 +080019else
20CC=gcc
21AR=ar
22endif
23
24MAKE=make
25
26$(info BUILD_LIB_TYPE=$(BUILD_LIB_TYPE))
27$(info BUILD_PLATFORM=$(BUILD_PLATFORM))
28$(info ROOT=$(ROOT))
29$(info CC=$(CC))
30$(info AR=$(AR))
31
32CFLAGS= --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
33
34AWK=awk
35
36#CFLAGS += -Wno-error=format-truncation -Wno-error=format-overflow= -Wno-error=stringop-overread -Wno-error=deprecated-declarations
37
38INC_DIR = \
39 -I$(LOCAL_PATH)/inc \
40 -I$(BUILD_ROOT)/include \
41 -I$(BUILD_ROOT)/include/mbtk \
42 -I$(BUILD_ROOT)/include/lynq \
43 -I$(BUILD_ROOT)/include/mqtt \
44 -I$(BUILD_ROOT)/include/ql
45
46# -DCONFIG_AB_SYSTEM
47DEFINE = \
48 -DMBTK_SUPPORT \
49 -DMARVELL_EXTENDED \
50 -DPXA1826_AUDIO \
51 -D__USE_GNU \
52 -DNOT_DROPPED_FLAGS_TEST \
53 -DNDEBUG \
54 -UDEBUG \
b.liu88831712023-10-10 15:26:32 +080055 -D_FORTIFY_SOURCE=2 \
56 -D_GNU_SOURCE
b.liu9a8e82b2023-10-10 16:09:50 +080057
b.liu3403c932023-10-10 16:26:35 +080058ifeq ($(BUILD_PLATFORM), asr1803)
b.liu9a8e82b2023-10-10 16:09:50 +080059DEFINE += -DMBTK_POLARSSL_SUPPORT
b.liuc1064f82023-10-11 16:47:39 +080060DEFINE += -DMBTK_MP3_SUPPORT
b.liu9a8e82b2023-10-10 16:09:50 +080061endif
liubin281ac462023-07-19 14:22:54 +080062
b.liu4f8e8792023-11-01 23:25:22 +080063#$(info TOPDIR=$(TOPDIR))
64BUILD_PROJECT=$(shell cat $(ROOT)/../build_version | grep PROJECT | cut -d '=' -f 2)
65$(info BUILD_PROJECT=$(BUILD_PROJECT))
66#BUILD_PROJECT_X=$(shell ${BUILD_PROJECT:0:4})
67#BUILD_PROJECT_X=$(shell echo $(BUILD_PROJECT) | cut -c 1-4)
68#$(info BUILD_PROJECT_X=$(BUILD_PROJECT_X))
69
b.liu43da3412023-11-08 15:58:39 +080070ifeq ($(shell echo $(BUILD_PROJECT) | cut -c 1-7), L508_X6)
71$(info BUILD_PROJECT=L508_X6)
72DEFINE += -DMBTK_PROJECT_L508_X6
73else
74ifeq ($(shell echo $(BUILD_PROJECT) | cut -c 1-4), T108)
75$(info BUILD_PROJECT=T108)
76DEFINE += -DMBTK_PROJECT_T108
77else
b.liu4f8e8792023-11-01 23:25:22 +080078ifeq ($(shell echo $(BUILD_PROJECT) | cut -c 1-4), L508)
79$(info BUILD_PROJECT=L508)
80DEFINE += -DMBTK_PROJECT_L508
81else
82ifeq ($(shell echo $(BUILD_PROJECT) | cut -c 1-4), L509)
83$(info BUILD_PROJECT=L509)
84DEFINE += -DMBTK_PROJECT_L509
85else
86ifeq ($(shell echo $(BUILD_PROJECT) | cut -c 1-6), PN1803)
87$(info BUILD_PROJECT=PN1803)
88DEFINE += -DMBTK_PROJECT_PN1803
89endif
90endif
91endif
b.liu43da3412023-11-08 15:58:39 +080092endif
93endif
b.liu4f8e8792023-11-01 23:25:22 +080094
liubin281ac462023-07-19 14:22:54 +080095LIB_DIR = \
96 -L$(OUT_DIR)/lib
97
98LIBS = -lpthread -lstdc++
99
100# Common temp files to delete from each directory.
101TEMPFILES=core core.* *.o temp.* *.out