blob: ce5ab9fbe77aa28a3013e2a32d7cd8b02a23c864 [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
b.liu1c1c7212023-12-22 16:35:27 +080032# -Werror=non-virtual-dtor
33CFLAGS= --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=address -Werror=sequence-point -ffunction-sections -Wl,--gc-sections -Wl,--no-undefined
liubin281ac462023-07-19 14:22:54 +080034
35AWK=awk
36
37#CFLAGS += -Wno-error=format-truncation -Wno-error=format-overflow= -Wno-error=stringop-overread -Wno-error=deprecated-declarations
38
39INC_DIR = \
40 -I$(LOCAL_PATH)/inc \
41 -I$(BUILD_ROOT)/include \
42 -I$(BUILD_ROOT)/include/mbtk \
43 -I$(BUILD_ROOT)/include/lynq \
44 -I$(BUILD_ROOT)/include/mqtt \
45 -I$(BUILD_ROOT)/include/ql
46
47# -DCONFIG_AB_SYSTEM
48DEFINE = \
49 -DMBTK_SUPPORT \
50 -DMARVELL_EXTENDED \
51 -DPXA1826_AUDIO \
52 -D__USE_GNU \
53 -DNOT_DROPPED_FLAGS_TEST \
54 -DNDEBUG \
55 -UDEBUG \
b.liu88831712023-10-10 15:26:32 +080056 -D_FORTIFY_SOURCE=2 \
57 -D_GNU_SOURCE
liubin281ac462023-07-19 14:22:54 +080058
b.liu4f8e8792023-11-01 23:25:22 +080059#$(info TOPDIR=$(TOPDIR))
60BUILD_PROJECT=$(shell cat $(ROOT)/../build_version | grep PROJECT | cut -d '=' -f 2)
61$(info BUILD_PROJECT=$(BUILD_PROJECT))
62#BUILD_PROJECT_X=$(shell ${BUILD_PROJECT:0:4})
63#BUILD_PROJECT_X=$(shell echo $(BUILD_PROJECT) | cut -c 1-4)
64#$(info BUILD_PROJECT_X=$(BUILD_PROJECT_X))
65
b.liu03c74662023-11-17 16:09:48 +080066ifeq ($(BUILD_PLATFORM), asr1806)
67DEFINE += -DMBTK_PLATFORM_ASR1806
68
b.liu43da3412023-11-08 15:58:39 +080069ifeq ($(shell echo $(BUILD_PROJECT) | cut -c 1-7), L508_X6)
70$(info BUILD_PROJECT=L508_X6)
71DEFINE += -DMBTK_PROJECT_L508_X6
72else
73ifeq ($(shell echo $(BUILD_PROJECT) | cut -c 1-4), T108)
74$(info BUILD_PROJECT=T108)
75DEFINE += -DMBTK_PROJECT_T108
76else
b.liu03c74662023-11-17 16:09:48 +080077$(info BUILD_PROJECT=Unknown)
78endif
79endif
80else
81DEFINE += -DMBTK_POLARSSL_SUPPORT
82DEFINE += -DMBTK_MP3_SUPPORT
83DEFINE += -DMBTK_PLATFORM_ASR1803
84
b.liu4f8e8792023-11-01 23:25:22 +080085ifeq ($(shell echo $(BUILD_PROJECT) | cut -c 1-4), L508)
86$(info BUILD_PROJECT=L508)
87DEFINE += -DMBTK_PROJECT_L508
88else
89ifeq ($(shell echo $(BUILD_PROJECT) | cut -c 1-4), L509)
90$(info BUILD_PROJECT=L509)
91DEFINE += -DMBTK_PROJECT_L509
92else
93ifeq ($(shell echo $(BUILD_PROJECT) | cut -c 1-6), PN1803)
94$(info BUILD_PROJECT=PN1803)
95DEFINE += -DMBTK_PROJECT_PN1803
96endif
97endif
98endif
b.liu43da3412023-11-08 15:58:39 +080099endif
b.liu4f8e8792023-11-01 23:25:22 +0800100
b.liu5fa9e772023-11-23 18:00:55 +0800101MBTK_AT_SUPPORT=$(shell cat $(ROOT)/config | grep CONFIG_AT_SUPPORT | cut -d '=' -f 2)
102$(info MBTK_AT_SUPPORT=$(MBTK_AT_SUPPORT))
103ifeq ($(MBTK_AT_SUPPORT), y)
104DEFINE += -DMBTK_AF_SUPPORT
105endif
106
107MBTK_GNSS_MODE=$(shell cat $(ROOT)/config | grep CONFIG_MBTK_GNSS_MODE | cut -d '=' -f 2)
108$(info MBTK_GNSS_MODE=$(MBTK_GNSS_MODE))
109ifeq ($(MBTK_GNSS_MODE), gnss_6228)
110DEFINE += -DMBTK_GNSS_6228
111else
112DEFINE += -DMBTK_GNSS_5311
113endif
wangyouqianged88c722023-11-22 16:33:43 +0800114
liubin281ac462023-07-19 14:22:54 +0800115LIB_DIR = \
116 -L$(OUT_DIR)/lib
117
118LIBS = -lpthread -lstdc++
119
120# Common temp files to delete from each directory.
121TEMPFILES=core core.* *.o temp.* *.out