blob: 0a814d727a0047c520546c93efede410b6498f9b [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=.
b.liua6a2bd12025-08-14 12:14:58 +080010HOME_DIR := $(shell echo ~)
liubin281ac462023-07-19 14:22:54 +080011
b.liua6a2bd12025-08-14 12:14:58 +080012#BUILD_TOOLCHAIN_DIR = $(ROOT)/toolchain/gcc-$(BUILD_GCC_VERSION)-$(BUILD_STD_LIBC)
13BUILD_TOOLCHAIN_DIR = $(HOME_DIR)/openwrt_toolchains/gcc-$(BUILD_GCC_VERSION)-$(BUILD_STD_LIBC)
b.liudeb8e422024-12-14 17:36:56 +080014
b.liub3b923a2024-06-06 15:15:49 +080015ifeq ($(BUILD_STD_LIBC), glibc)
b.liub3b923a2024-06-06 15:15:49 +080016CC=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-gnueabi-gcc
17AR=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-gnueabi-ar
18else
b.liu17d7f8b2023-10-08 16:57:59 +080019CC=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-muslgnueabi-gcc
20AR=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-muslgnueabi-ar
b.liub3b923a2024-06-06 15:15:49 +080021endif
liubin281ac462023-07-19 14:22:54 +080022
23MAKE=make
24
25$(info BUILD_LIB_TYPE=$(BUILD_LIB_TYPE))
26$(info BUILD_PLATFORM=$(BUILD_PLATFORM))
b.liu5d5b8ba2024-02-20 14:00:33 +080027$(info BUILD_BRANCH=$(BUILD_BRANCH))
b.liuf37bd332024-03-18 13:51:24 +080028$(info BUILD_PROJECT=$(BUILD_PROJECT))
liubin281ac462023-07-19 14:22:54 +080029$(info ROOT=$(ROOT))
30$(info CC=$(CC))
31$(info AR=$(AR))
32
b.liu1c1c7212023-12-22 16:35:27 +080033# -Werror=non-virtual-dtor
b.liu08f38c62024-11-06 20:03:46 +080034#CFLAGS= --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
b.liudeb8e422024-12-14 17:36:56 +080035CFLAGS = --sysroot=$(BUILD_TOOLCHAIN_DIR) -Os -pipe -rdynamic -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -Wall -Werror -g -Wno-error=format
b.liu08f38c62024-11-06 20:03:46 +080036
b.liu355b1842024-11-21 16:23:53 +080037CFLAGS_TEST = --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 +080038
39AWK=awk
40
41#CFLAGS += -Wno-error=format-truncation -Wno-error=format-overflow= -Wno-error=stringop-overread -Wno-error=deprecated-declarations
42
43INC_DIR = \
b.liu9a306862024-03-06 16:49:40 +080044 -I$(LOCAL_PATH)/ \
liubin281ac462023-07-19 14:22:54 +080045 -I$(LOCAL_PATH)/inc \
46 -I$(BUILD_ROOT)/include \
47 -I$(BUILD_ROOT)/include/mbtk \
48 -I$(BUILD_ROOT)/include/lynq \
49 -I$(BUILD_ROOT)/include/mqtt \
50 -I$(BUILD_ROOT)/include/ql
51
52# -DCONFIG_AB_SYSTEM
b.liub171c9a2024-11-12 19:23:29 +080053# -DMBTK_DUMP_SUPPORT
liubin281ac462023-07-19 14:22:54 +080054DEFINE = \
55 -DMBTK_SUPPORT \
56 -DMARVELL_EXTENDED \
57 -DPXA1826_AUDIO \
58 -D__USE_GNU \
59 -DNOT_DROPPED_FLAGS_TEST \
60 -DNDEBUG \
61 -UDEBUG \
b.liu88831712023-10-10 15:26:32 +080062 -D_FORTIFY_SOURCE=2 \
b.liubcf86c92024-08-19 19:48:28 +080063 -D_GNU_SOURCE \
64 -DMBTK_BUILD_TIME=\""$(shell date +%Y/%m/%d\ %H:%M:%S)\"" \
65 -DMBTK_BUILD_GIT=\""$(shell git log | grep commit | head -1 | cut -d ' ' -f 2)\""
66
67#MBTK_BUILD_GIT="$(shell git log | grep commit | head -1 | cut -d ' ' -f 2)"
68#$(info MBTK_BUILD_GIT=$(MBTK_BUILD_GIT))
liubin281ac462023-07-19 14:22:54 +080069
b.liu4f8e8792023-11-01 23:25:22 +080070#$(info TOPDIR=$(TOPDIR))
b.liuf37bd332024-03-18 13:51:24 +080071# BUILD_PROJECT=$(shell cat $(ROOT)/../build_version | grep PROJECT | cut -d '=' -f 2)
72#$(info BUILD_PROJECT=$(BUILD_PROJECT))
b.liu4f8e8792023-11-01 23:25:22 +080073#BUILD_PROJECT_X=$(shell ${BUILD_PROJECT:0:4})
74#BUILD_PROJECT_X=$(shell echo $(BUILD_PROJECT) | cut -c 1-4)
75#$(info BUILD_PROJECT_X=$(BUILD_PROJECT_X))
76
yq.wangf75381b2024-10-09 23:00:23 -070077DEFINE += -DMBTK_ALL_CID_SUPPORT
78
b.liu88370142024-12-23 14:11:57 +080079ifeq ($(MBTK_SOURCE_VERSION), 2)
b.liubcf86c92024-08-19 19:48:28 +080080DEFINE += -DMBTK_SOURCE_VERSION_2
81endif
82
b.liu9f91db32025-02-13 11:24:18 +080083#ifeq ($(MBTK_DEV_INFO_VERSION), 2)
84#DEFINE += -DMBTK_DEV_INFO_VERSION_2
85#endif
b.liu472cfaf2024-12-19 19:08:19 +080086
b.liu61ad9172025-01-09 14:33:55 +080087ifeq ($(CONFIG_MBTK_5G_SUPPORT), Y)
88DEFINE += -DMBTK_5G_SUPPORT
89endif
90
liubin281ac462023-07-19 14:22:54 +080091LIB_DIR = \
92 -L$(OUT_DIR)/lib
93
94LIBS = -lpthread -lstdc++
95
96# Common temp files to delete from each directory.
97TEMPFILES=core core.* *.o temp.* *.out