blob: 03ca9615e7d707bc539a1ddd06f6ee2cf98c1ff6 [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.liu3743bce2024-03-22 19:27:58 +08006
7ROOT = $(BUILD_ROOT)/..
liubin281ac462023-07-19 14:22:54 +08008OUT_DIR = $(ROOT)/out
liubin281ac462023-07-19 14:22:54 +08009LOCAL_PATH=.
10
b.liu3403c932023-10-10 16:26:35 +080011ifeq ($(BUILD_PLATFORM), asr1803)
b.liu5d5b8ba2024-02-20 14:00:33 +080012ifeq ($(BUILD_BRANCH), rls3895)
13BUILD_TOOLCHAIN_DIR = $(ROOT)/toolchain/gcc-4.9-rls3895
14else
b.liu3403c932023-10-10 16:26:35 +080015BUILD_TOOLCHAIN_DIR = $(ROOT)/toolchain/gcc-4.9
b.liu5d5b8ba2024-02-20 14:00:33 +080016endif
liubin281ac462023-07-19 14:22:54 +080017CC=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-uclibcgnueabi-gcc
18AR=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-uclibcgnueabi-ar
b.liu3403c932023-10-10 16:26:35 +080019else ifeq ($(BUILD_PLATFORM), asr1806)
b.liu5d5b8ba2024-02-20 14:00:33 +080020
b.liu3403c932023-10-10 16:26:35 +080021BUILD_TOOLCHAIN_DIR = $(ROOT)/toolchain/gcc-8.4
b.liu5d5b8ba2024-02-20 14:00:33 +080022
b.liu17d7f8b2023-10-08 16:57:59 +080023CC=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-muslgnueabi-gcc
24AR=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-muslgnueabi-ar
liubin281ac462023-07-19 14:22:54 +080025else
26CC=gcc
27AR=ar
28endif
29
30MAKE=make
31
32$(info BUILD_LIB_TYPE=$(BUILD_LIB_TYPE))
33$(info BUILD_PLATFORM=$(BUILD_PLATFORM))
b.liu5d5b8ba2024-02-20 14:00:33 +080034$(info BUILD_BRANCH=$(BUILD_BRANCH))
b.liuf37bd332024-03-18 13:51:24 +080035$(info BUILD_PROJECT=$(BUILD_PROJECT))
liubin281ac462023-07-19 14:22:54 +080036$(info ROOT=$(ROOT))
37$(info CC=$(CC))
38$(info AR=$(AR))
39
b.liu1c1c7212023-12-22 16:35:27 +080040# -Werror=non-virtual-dtor
41CFLAGS= --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 +080042
43AWK=awk
44
45#CFLAGS += -Wno-error=format-truncation -Wno-error=format-overflow= -Wno-error=stringop-overread -Wno-error=deprecated-declarations
46
47INC_DIR = \
b.liu9a306862024-03-06 16:49:40 +080048 -I$(LOCAL_PATH)/ \
liubin281ac462023-07-19 14:22:54 +080049 -I$(LOCAL_PATH)/inc \
50 -I$(BUILD_ROOT)/include \
51 -I$(BUILD_ROOT)/include/mbtk \
52 -I$(BUILD_ROOT)/include/lynq \
53 -I$(BUILD_ROOT)/include/mqtt \
54 -I$(BUILD_ROOT)/include/ql
55
56# -DCONFIG_AB_SYSTEM
57DEFINE = \
58 -DMBTK_SUPPORT \
59 -DMARVELL_EXTENDED \
60 -DPXA1826_AUDIO \
61 -D__USE_GNU \
62 -DNOT_DROPPED_FLAGS_TEST \
63 -DNDEBUG \
64 -UDEBUG \
b.liu88831712023-10-10 15:26:32 +080065 -D_FORTIFY_SOURCE=2 \
66 -D_GNU_SOURCE
liubin281ac462023-07-19 14:22:54 +080067
b.liu4f8e8792023-11-01 23:25:22 +080068#$(info TOPDIR=$(TOPDIR))
b.liuf37bd332024-03-18 13:51:24 +080069# BUILD_PROJECT=$(shell cat $(ROOT)/../build_version | grep PROJECT | cut -d '=' -f 2)
70#$(info BUILD_PROJECT=$(BUILD_PROJECT))
b.liu4f8e8792023-11-01 23:25:22 +080071#BUILD_PROJECT_X=$(shell ${BUILD_PROJECT:0:4})
72#BUILD_PROJECT_X=$(shell echo $(BUILD_PROJECT) | cut -c 1-4)
73#$(info BUILD_PROJECT_X=$(BUILD_PROJECT_X))
74
b.liuf37bd332024-03-18 13:51:24 +080075# 1806
b.liu03c74662023-11-17 16:09:48 +080076ifeq ($(BUILD_PLATFORM), asr1806)
77DEFINE += -DMBTK_PLATFORM_ASR1806
78
b.liuf37bd332024-03-18 13:51:24 +080079ifeq ($(BUILD_PROJECT), L508_X6)
b.liu43da3412023-11-08 15:58:39 +080080DEFINE += -DMBTK_PROJECT_L508_X6
81else
b.liuf37bd332024-03-18 13:51:24 +080082ifeq ($(BUILD_PROJECT), T108)
b.liu43da3412023-11-08 15:58:39 +080083DEFINE += -DMBTK_PROJECT_T108
84else
b.liuf37bd332024-03-18 13:51:24 +080085ifeq ($(BUILD_PROJECT), L508)
86DEFINE += -DMBTK_PROJECT_L508
87else
88ifeq ($(BUILD_PROJECT), L509)
89DEFINE += -DMBTK_PROJECT_L509
90else
b.liu03c74662023-11-17 16:09:48 +080091$(info BUILD_PROJECT=Unknown)
92endif
93endif
b.liuf37bd332024-03-18 13:51:24 +080094endif
95endif
96
97# 1803
b.liu03c74662023-11-17 16:09:48 +080098else
99DEFINE += -DMBTK_POLARSSL_SUPPORT
b.liu5d5b8ba2024-02-20 14:00:33 +0800100
101ifeq ($(BUILD_BRANCH), rls3671)
b.liu03c74662023-11-17 16:09:48 +0800102DEFINE += -DMBTK_MP3_SUPPORT
b.liu5d5b8ba2024-02-20 14:00:33 +0800103endif
104
b.liu03c74662023-11-17 16:09:48 +0800105DEFINE += -DMBTK_PLATFORM_ASR1803
106
b.liuf37bd332024-03-18 13:51:24 +0800107ifeq ($(BUILD_PROJECT), L508)
b.liu4f8e8792023-11-01 23:25:22 +0800108DEFINE += -DMBTK_PROJECT_L508
109else
b.liuf37bd332024-03-18 13:51:24 +0800110ifeq ($(BUILD_PROJECT), L509)
b.liu4f8e8792023-11-01 23:25:22 +0800111DEFINE += -DMBTK_PROJECT_L509
112else
b.liuf37bd332024-03-18 13:51:24 +0800113ifeq ($(BUILD_PROJECT), PN1803)
b.liu4f8e8792023-11-01 23:25:22 +0800114DEFINE += -DMBTK_PROJECT_PN1803
b.liuf37bd332024-03-18 13:51:24 +0800115else
116$(info BUILD_PROJECT=Unknown)
b.liu4f8e8792023-11-01 23:25:22 +0800117endif
118endif
119endif
b.liu43da3412023-11-08 15:58:39 +0800120endif
b.liu4f8e8792023-11-01 23:25:22 +0800121
b.liu96f25152024-02-20 17:21:59 +0800122MBTK_AF_SUPPORT=$(shell cat $(ROOT)/config | grep CONFIG_AF_SUPPORT | cut -d '=' -f 2)
123$(info MBTK_AF_SUPPORT=$(MBTK_AF_SUPPORT))
124ifeq ($(MBTK_AF_SUPPORT), y)
b.liu5fa9e772023-11-23 18:00:55 +0800125DEFINE += -DMBTK_AF_SUPPORT
126endif
127
b.liuc7ffd092024-01-03 15:23:07 +0800128MBTK_YX_SUPPORT=$(shell cat $(ROOT)/config | grep CONFIG_YX_SUPPORT | cut -d '=' -f 2)
129$(info MBTK_YX_SUPPORT=$(MBTK_YX_SUPPORT))
130ifeq ($(MBTK_YX_SUPPORT), y)
131DEFINE += -DMBTK_YX_SUPPORT
132endif
133
b.liuf37bd332024-03-18 13:51:24 +0800134MBTK_SG_SUPPORT=$(shell cat $(ROOT)/config | grep CONFIG_SG_SUPPORT | cut -d '=' -f 2)
135$(info MBTK_SG_SUPPORT=$(MBTK_SG_SUPPORT))
136ifeq ($(MBTK_SG_SUPPORT), y)
137DEFINE += -DMBTK_SG_SUPPORT
138DEFINE += -DMBTK_ALL_CID_SUPPORT
139endif
140
141MBTK_ALL_CID_SUPPORT=$(shell cat $(ROOT)/config | grep CONFIG_MBTK_ALL_CID_SUPPORT | cut -d '=' -f 2)
142$(info MBTK_ALL_CID_SUPPORT=$(MBTK_ALL_CID_SUPPORT))
143ifeq ($(MBTK_ALL_CID_SUPPORT), y)
144DEFINE += -DMBTK_ALL_CID_SUPPORT
145endif
146
b.liu5fa9e772023-11-23 18:00:55 +0800147MBTK_GNSS_MODE=$(shell cat $(ROOT)/config | grep CONFIG_MBTK_GNSS_MODE | cut -d '=' -f 2)
148$(info MBTK_GNSS_MODE=$(MBTK_GNSS_MODE))
149ifeq ($(MBTK_GNSS_MODE), gnss_6228)
150DEFINE += -DMBTK_GNSS_6228
151else
152DEFINE += -DMBTK_GNSS_5311
153endif
wangyouqianged88c722023-11-22 16:33:43 +0800154
liubin281ac462023-07-19 14:22:54 +0800155LIB_DIR = \
156 -L$(OUT_DIR)/lib
157
158LIBS = -lpthread -lstdc++
159
160# Common temp files to delete from each directory.
161TEMPFILES=core core.* *.o temp.* *.out