blob: 056fc5fd2149bf0ce216d9d2ccb523413ae59a5f [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.liub3b923a2024-06-06 15:15:49 +080011ifeq ($(BUILD_PLATFORM), master)
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.liub3b923a2024-06-06 15:15:49 +080019else ifeq ($(BUILD_PLATFORM), v2102)
b.liu5d5b8ba2024-02-20 14:00:33 +080020
b.liub3b923a2024-06-06 15:15:49 +080021ifeq ($(BUILD_STD_LIBC), glibc)
22BUILD_TOOLCHAIN_DIR = $(ROOT)/toolchain/gcc-8.4-glibc
23CC=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-gnueabi-gcc
24AR=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-gnueabi-ar
25else
b.liu3403c932023-10-10 16:26:35 +080026BUILD_TOOLCHAIN_DIR = $(ROOT)/toolchain/gcc-8.4
b.liu17d7f8b2023-10-08 16:57:59 +080027CC=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-muslgnueabi-gcc
28AR=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-muslgnueabi-ar
b.liub3b923a2024-06-06 15:15:49 +080029endif
liubin281ac462023-07-19 14:22:54 +080030else
31CC=gcc
32AR=ar
33endif
34
35MAKE=make
36
37$(info BUILD_LIB_TYPE=$(BUILD_LIB_TYPE))
38$(info BUILD_PLATFORM=$(BUILD_PLATFORM))
b.liu5d5b8ba2024-02-20 14:00:33 +080039$(info BUILD_BRANCH=$(BUILD_BRANCH))
b.liuf37bd332024-03-18 13:51:24 +080040$(info BUILD_PROJECT=$(BUILD_PROJECT))
liubin281ac462023-07-19 14:22:54 +080041$(info ROOT=$(ROOT))
42$(info CC=$(CC))
43$(info AR=$(AR))
44
b.liu1c1c7212023-12-22 16:35:27 +080045# -Werror=non-virtual-dtor
b.liu778645e2024-06-21 16:47:42 +080046CFLAGS= --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
liubin281ac462023-07-19 14:22:54 +080047
48AWK=awk
49
50#CFLAGS += -Wno-error=format-truncation -Wno-error=format-overflow= -Wno-error=stringop-overread -Wno-error=deprecated-declarations
51
52INC_DIR = \
b.liu9a306862024-03-06 16:49:40 +080053 -I$(LOCAL_PATH)/ \
liubin281ac462023-07-19 14:22:54 +080054 -I$(LOCAL_PATH)/inc \
55 -I$(BUILD_ROOT)/include \
56 -I$(BUILD_ROOT)/include/mbtk \
57 -I$(BUILD_ROOT)/include/lynq \
58 -I$(BUILD_ROOT)/include/mqtt \
59 -I$(BUILD_ROOT)/include/ql
60
61# -DCONFIG_AB_SYSTEM
62DEFINE = \
63 -DMBTK_SUPPORT \
64 -DMARVELL_EXTENDED \
65 -DPXA1826_AUDIO \
66 -D__USE_GNU \
67 -DNOT_DROPPED_FLAGS_TEST \
68 -DNDEBUG \
69 -UDEBUG \
b.liu88831712023-10-10 15:26:32 +080070 -D_FORTIFY_SOURCE=2 \
b.liubcf86c92024-08-19 19:48:28 +080071 -D_GNU_SOURCE \
72 -DMBTK_BUILD_TIME=\""$(shell date +%Y/%m/%d\ %H:%M:%S)\"" \
73 -DMBTK_BUILD_GIT=\""$(shell git log | grep commit | head -1 | cut -d ' ' -f 2)\""
74
75#MBTK_BUILD_GIT="$(shell git log | grep commit | head -1 | cut -d ' ' -f 2)"
76#$(info MBTK_BUILD_GIT=$(MBTK_BUILD_GIT))
liubin281ac462023-07-19 14:22:54 +080077
b.liu4f8e8792023-11-01 23:25:22 +080078#$(info TOPDIR=$(TOPDIR))
b.liuf37bd332024-03-18 13:51:24 +080079# BUILD_PROJECT=$(shell cat $(ROOT)/../build_version | grep PROJECT | cut -d '=' -f 2)
80#$(info BUILD_PROJECT=$(BUILD_PROJECT))
b.liu4f8e8792023-11-01 23:25:22 +080081#BUILD_PROJECT_X=$(shell ${BUILD_PROJECT:0:4})
82#BUILD_PROJECT_X=$(shell echo $(BUILD_PROJECT) | cut -c 1-4)
83#$(info BUILD_PROJECT_X=$(BUILD_PROJECT_X))
84
b.liuf37bd332024-03-18 13:51:24 +080085# 1806
b.liub3b923a2024-06-06 15:15:49 +080086ifeq ($(BUILD_PLATFORM), v2102)
87DEFINE += -DMBTK_PLATFORM_KERNEL_5
b.liu03c74662023-11-17 16:09:48 +080088
b.liuf37bd332024-03-18 13:51:24 +080089ifeq ($(BUILD_PROJECT), L508_X6)
b.liu43da3412023-11-08 15:58:39 +080090DEFINE += -DMBTK_PROJECT_L508_X6
91else
b.liuc25c5472024-06-13 21:35:06 +080092ifeq ($(BUILD_PROJECT), T108_2)
93DEFINE += -DMBTK_PROJECT_T108
94else
b.liuf37bd332024-03-18 13:51:24 +080095ifeq ($(BUILD_PROJECT), T108)
b.liu43da3412023-11-08 15:58:39 +080096DEFINE += -DMBTK_PROJECT_T108
97else
b.liuf37bd332024-03-18 13:51:24 +080098ifeq ($(BUILD_PROJECT), L508)
99DEFINE += -DMBTK_PROJECT_L508
100else
101ifeq ($(BUILD_PROJECT), L509)
102DEFINE += -DMBTK_PROJECT_L509
103else
b.liu03c74662023-11-17 16:09:48 +0800104$(info BUILD_PROJECT=Unknown)
105endif
106endif
b.liuf37bd332024-03-18 13:51:24 +0800107endif
108endif
b.liuc25c5472024-06-13 21:35:06 +0800109endif
b.liuf37bd332024-03-18 13:51:24 +0800110
111# 1803
b.liu03c74662023-11-17 16:09:48 +0800112else
113DEFINE += -DMBTK_POLARSSL_SUPPORT
b.liu5d5b8ba2024-02-20 14:00:33 +0800114
115ifeq ($(BUILD_BRANCH), rls3671)
b.liu03c74662023-11-17 16:09:48 +0800116DEFINE += -DMBTK_MP3_SUPPORT
b.liu5d5b8ba2024-02-20 14:00:33 +0800117endif
118
b.liub3b923a2024-06-06 15:15:49 +0800119DEFINE += -DMBTK_PLATFORM_KERNEL_3
b.liu03c74662023-11-17 16:09:48 +0800120
b.liuf37bd332024-03-18 13:51:24 +0800121ifeq ($(BUILD_PROJECT), L508)
b.liu4f8e8792023-11-01 23:25:22 +0800122DEFINE += -DMBTK_PROJECT_L508
123else
b.liuf37bd332024-03-18 13:51:24 +0800124ifeq ($(BUILD_PROJECT), L509)
b.liu4f8e8792023-11-01 23:25:22 +0800125DEFINE += -DMBTK_PROJECT_L509
126else
b.liuf37bd332024-03-18 13:51:24 +0800127ifeq ($(BUILD_PROJECT), PN1803)
b.liu4f8e8792023-11-01 23:25:22 +0800128DEFINE += -DMBTK_PROJECT_PN1803
b.liuf37bd332024-03-18 13:51:24 +0800129else
130$(info BUILD_PROJECT=Unknown)
b.liu4f8e8792023-11-01 23:25:22 +0800131endif
132endif
133endif
b.liu43da3412023-11-08 15:58:39 +0800134endif
b.liu4f8e8792023-11-01 23:25:22 +0800135
b.liu96f25152024-02-20 17:21:59 +0800136ifeq ($(MBTK_AF_SUPPORT), y)
b.liu5fa9e772023-11-23 18:00:55 +0800137DEFINE += -DMBTK_AF_SUPPORT
138endif
139
b.liuc7ffd092024-01-03 15:23:07 +0800140ifeq ($(MBTK_YX_SUPPORT), y)
141DEFINE += -DMBTK_YX_SUPPORT
142endif
143
b.liuf37bd332024-03-18 13:51:24 +0800144ifeq ($(MBTK_SG_SUPPORT), y)
145DEFINE += -DMBTK_SG_SUPPORT
b.liuf37bd332024-03-18 13:51:24 +0800146endif
147
b.liuf37bd332024-03-18 13:51:24 +0800148ifeq ($(MBTK_ALL_CID_SUPPORT), y)
149DEFINE += -DMBTK_ALL_CID_SUPPORT
150endif
151
b.liu5fa9e772023-11-23 18:00:55 +0800152ifeq ($(MBTK_GNSS_MODE), gnss_6228)
153DEFINE += -DMBTK_GNSS_6228
154else
b.liuec2383b2024-06-25 18:28:53 +0800155ifeq ($(MBTK_GNSS_MODE), gnss_5311)
b.liu5fa9e772023-11-23 18:00:55 +0800156DEFINE += -DMBTK_GNSS_5311
b.liuec2383b2024-06-25 18:28:53 +0800157else
b.liuced8dd02024-06-28 13:28:29 +0800158ifeq ($(MBTK_GNSS_MODE), gnss_8122)
b.liuec2383b2024-06-25 18:28:53 +0800159DEFINE += -DMBTK_GNSS_8122
b.liuced8dd02024-06-28 13:28:29 +0800160else
161DEFINE += -DMBTK_GNSS_ALL
162endif
b.liuec2383b2024-06-25 18:28:53 +0800163endif
b.liu5fa9e772023-11-23 18:00:55 +0800164endif
wangyouqianged88c722023-11-22 16:33:43 +0800165
b.liubb590492024-06-13 16:42:08 +0800166ifeq ($(MBTK_DUMP_SUPPORT), y)
167DEFINE += -DMBTK_DUMP_SUPPORT
168endif
169
b.liubcf86c92024-08-19 19:48:28 +0800170ifeq ($(MBTK_SOURCE_VERSION), 2)
171DEFINE += -DMBTK_SOURCE_VERSION_2
172endif
173
liubin281ac462023-07-19 14:22:54 +0800174LIB_DIR = \
175 -L$(OUT_DIR)/lib
176
177LIBS = -lpthread -lstdc++
178
179# Common temp files to delete from each directory.
180TEMPFILES=core core.* *.o temp.* *.out