liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 1 | # 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.liu | 3743bce | 2024-03-22 19:27:58 +0800 | [diff] [blame^] | 6 |
|
| 7 | ROOT = $(BUILD_ROOT)/..
|
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 8 | OUT_DIR = $(ROOT)/out
|
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 9 | LOCAL_PATH=.
|
| 10 |
|
b.liu | 3403c93 | 2023-10-10 16:26:35 +0800 | [diff] [blame] | 11 | ifeq ($(BUILD_PLATFORM), asr1803)
|
b.liu | 5d5b8ba | 2024-02-20 14:00:33 +0800 | [diff] [blame] | 12 | ifeq ($(BUILD_BRANCH), rls3895)
|
| 13 | BUILD_TOOLCHAIN_DIR = $(ROOT)/toolchain/gcc-4.9-rls3895
|
| 14 | else
|
b.liu | 3403c93 | 2023-10-10 16:26:35 +0800 | [diff] [blame] | 15 | BUILD_TOOLCHAIN_DIR = $(ROOT)/toolchain/gcc-4.9
|
b.liu | 5d5b8ba | 2024-02-20 14:00:33 +0800 | [diff] [blame] | 16 | endif
|
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 17 | CC=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-uclibcgnueabi-gcc
|
| 18 | AR=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-uclibcgnueabi-ar
|
b.liu | 3403c93 | 2023-10-10 16:26:35 +0800 | [diff] [blame] | 19 | else ifeq ($(BUILD_PLATFORM), asr1806)
|
b.liu | 5d5b8ba | 2024-02-20 14:00:33 +0800 | [diff] [blame] | 20 |
|
b.liu | 3403c93 | 2023-10-10 16:26:35 +0800 | [diff] [blame] | 21 | BUILD_TOOLCHAIN_DIR = $(ROOT)/toolchain/gcc-8.4
|
b.liu | 5d5b8ba | 2024-02-20 14:00:33 +0800 | [diff] [blame] | 22 |
|
b.liu | 17d7f8b | 2023-10-08 16:57:59 +0800 | [diff] [blame] | 23 | CC=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-muslgnueabi-gcc
|
| 24 | AR=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-muslgnueabi-ar
|
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 25 | else
|
| 26 | CC=gcc
|
| 27 | AR=ar
|
| 28 | endif
|
| 29 |
|
| 30 | MAKE=make
|
| 31 |
|
| 32 | $(info BUILD_LIB_TYPE=$(BUILD_LIB_TYPE))
|
| 33 | $(info BUILD_PLATFORM=$(BUILD_PLATFORM))
|
b.liu | 5d5b8ba | 2024-02-20 14:00:33 +0800 | [diff] [blame] | 34 | $(info BUILD_BRANCH=$(BUILD_BRANCH))
|
b.liu | f37bd33 | 2024-03-18 13:51:24 +0800 | [diff] [blame] | 35 | $(info BUILD_PROJECT=$(BUILD_PROJECT))
|
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 36 | $(info ROOT=$(ROOT))
|
| 37 | $(info CC=$(CC))
|
| 38 | $(info AR=$(AR))
|
| 39 |
|
b.liu | 1c1c721 | 2023-12-22 16:35:27 +0800 | [diff] [blame] | 40 | # -Werror=non-virtual-dtor
|
| 41 | CFLAGS= --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
|
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 42 |
|
| 43 | AWK=awk
|
| 44 |
|
| 45 | #CFLAGS += -Wno-error=format-truncation -Wno-error=format-overflow= -Wno-error=stringop-overread -Wno-error=deprecated-declarations
|
| 46 |
|
| 47 | INC_DIR = \
|
b.liu | 9a30686 | 2024-03-06 16:49:40 +0800 | [diff] [blame] | 48 | -I$(LOCAL_PATH)/ \
|
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 49 | -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
|
| 57 | DEFINE = \
|
| 58 | -DMBTK_SUPPORT \
|
| 59 | -DMARVELL_EXTENDED \
|
| 60 | -DPXA1826_AUDIO \
|
| 61 | -D__USE_GNU \
|
| 62 | -DNOT_DROPPED_FLAGS_TEST \
|
| 63 | -DNDEBUG \
|
| 64 | -UDEBUG \
|
b.liu | 8883171 | 2023-10-10 15:26:32 +0800 | [diff] [blame] | 65 | -D_FORTIFY_SOURCE=2 \
|
| 66 | -D_GNU_SOURCE
|
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 67 |
|
b.liu | 4f8e879 | 2023-11-01 23:25:22 +0800 | [diff] [blame] | 68 | #$(info TOPDIR=$(TOPDIR))
|
b.liu | f37bd33 | 2024-03-18 13:51:24 +0800 | [diff] [blame] | 69 | # BUILD_PROJECT=$(shell cat $(ROOT)/../build_version | grep PROJECT | cut -d '=' -f 2)
|
| 70 | #$(info BUILD_PROJECT=$(BUILD_PROJECT))
|
b.liu | 4f8e879 | 2023-11-01 23:25:22 +0800 | [diff] [blame] | 71 | #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.liu | f37bd33 | 2024-03-18 13:51:24 +0800 | [diff] [blame] | 75 | # 1806
|
b.liu | 03c7466 | 2023-11-17 16:09:48 +0800 | [diff] [blame] | 76 | ifeq ($(BUILD_PLATFORM), asr1806)
|
| 77 | DEFINE += -DMBTK_PLATFORM_ASR1806
|
| 78 |
|
b.liu | f37bd33 | 2024-03-18 13:51:24 +0800 | [diff] [blame] | 79 | ifeq ($(BUILD_PROJECT), L508_X6)
|
b.liu | 43da341 | 2023-11-08 15:58:39 +0800 | [diff] [blame] | 80 | DEFINE += -DMBTK_PROJECT_L508_X6
|
| 81 | else
|
b.liu | f37bd33 | 2024-03-18 13:51:24 +0800 | [diff] [blame] | 82 | ifeq ($(BUILD_PROJECT), T108)
|
b.liu | 43da341 | 2023-11-08 15:58:39 +0800 | [diff] [blame] | 83 | DEFINE += -DMBTK_PROJECT_T108
|
| 84 | else
|
b.liu | f37bd33 | 2024-03-18 13:51:24 +0800 | [diff] [blame] | 85 | ifeq ($(BUILD_PROJECT), L508)
|
| 86 | DEFINE += -DMBTK_PROJECT_L508
|
| 87 | else
|
| 88 | ifeq ($(BUILD_PROJECT), L509)
|
| 89 | DEFINE += -DMBTK_PROJECT_L509
|
| 90 | else
|
b.liu | 03c7466 | 2023-11-17 16:09:48 +0800 | [diff] [blame] | 91 | $(info BUILD_PROJECT=Unknown)
|
| 92 | endif
|
| 93 | endif
|
b.liu | f37bd33 | 2024-03-18 13:51:24 +0800 | [diff] [blame] | 94 | endif
|
| 95 | endif
|
| 96 |
|
| 97 | # 1803
|
b.liu | 03c7466 | 2023-11-17 16:09:48 +0800 | [diff] [blame] | 98 | else
|
| 99 | DEFINE += -DMBTK_POLARSSL_SUPPORT
|
b.liu | 5d5b8ba | 2024-02-20 14:00:33 +0800 | [diff] [blame] | 100 |
|
| 101 | ifeq ($(BUILD_BRANCH), rls3671)
|
b.liu | 03c7466 | 2023-11-17 16:09:48 +0800 | [diff] [blame] | 102 | DEFINE += -DMBTK_MP3_SUPPORT
|
b.liu | 5d5b8ba | 2024-02-20 14:00:33 +0800 | [diff] [blame] | 103 | endif
|
| 104 |
|
b.liu | 03c7466 | 2023-11-17 16:09:48 +0800 | [diff] [blame] | 105 | DEFINE += -DMBTK_PLATFORM_ASR1803
|
| 106 |
|
b.liu | f37bd33 | 2024-03-18 13:51:24 +0800 | [diff] [blame] | 107 | ifeq ($(BUILD_PROJECT), L508)
|
b.liu | 4f8e879 | 2023-11-01 23:25:22 +0800 | [diff] [blame] | 108 | DEFINE += -DMBTK_PROJECT_L508
|
| 109 | else
|
b.liu | f37bd33 | 2024-03-18 13:51:24 +0800 | [diff] [blame] | 110 | ifeq ($(BUILD_PROJECT), L509)
|
b.liu | 4f8e879 | 2023-11-01 23:25:22 +0800 | [diff] [blame] | 111 | DEFINE += -DMBTK_PROJECT_L509
|
| 112 | else
|
b.liu | f37bd33 | 2024-03-18 13:51:24 +0800 | [diff] [blame] | 113 | ifeq ($(BUILD_PROJECT), PN1803)
|
b.liu | 4f8e879 | 2023-11-01 23:25:22 +0800 | [diff] [blame] | 114 | DEFINE += -DMBTK_PROJECT_PN1803
|
b.liu | f37bd33 | 2024-03-18 13:51:24 +0800 | [diff] [blame] | 115 | else
|
| 116 | $(info BUILD_PROJECT=Unknown)
|
b.liu | 4f8e879 | 2023-11-01 23:25:22 +0800 | [diff] [blame] | 117 | endif
|
| 118 | endif
|
| 119 | endif
|
b.liu | 43da341 | 2023-11-08 15:58:39 +0800 | [diff] [blame] | 120 | endif
|
b.liu | 4f8e879 | 2023-11-01 23:25:22 +0800 | [diff] [blame] | 121 |
|
b.liu | 96f2515 | 2024-02-20 17:21:59 +0800 | [diff] [blame] | 122 | MBTK_AF_SUPPORT=$(shell cat $(ROOT)/config | grep CONFIG_AF_SUPPORT | cut -d '=' -f 2)
|
| 123 | $(info MBTK_AF_SUPPORT=$(MBTK_AF_SUPPORT))
|
| 124 | ifeq ($(MBTK_AF_SUPPORT), y)
|
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame] | 125 | DEFINE += -DMBTK_AF_SUPPORT
|
| 126 | endif
|
| 127 |
|
b.liu | c7ffd09 | 2024-01-03 15:23:07 +0800 | [diff] [blame] | 128 | MBTK_YX_SUPPORT=$(shell cat $(ROOT)/config | grep CONFIG_YX_SUPPORT | cut -d '=' -f 2)
|
| 129 | $(info MBTK_YX_SUPPORT=$(MBTK_YX_SUPPORT))
|
| 130 | ifeq ($(MBTK_YX_SUPPORT), y)
|
| 131 | DEFINE += -DMBTK_YX_SUPPORT
|
| 132 | endif
|
| 133 |
|
b.liu | f37bd33 | 2024-03-18 13:51:24 +0800 | [diff] [blame] | 134 | MBTK_SG_SUPPORT=$(shell cat $(ROOT)/config | grep CONFIG_SG_SUPPORT | cut -d '=' -f 2)
|
| 135 | $(info MBTK_SG_SUPPORT=$(MBTK_SG_SUPPORT))
|
| 136 | ifeq ($(MBTK_SG_SUPPORT), y)
|
| 137 | DEFINE += -DMBTK_SG_SUPPORT
|
| 138 | DEFINE += -DMBTK_ALL_CID_SUPPORT
|
| 139 | endif
|
| 140 |
|
| 141 | MBTK_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))
|
| 143 | ifeq ($(MBTK_ALL_CID_SUPPORT), y)
|
| 144 | DEFINE += -DMBTK_ALL_CID_SUPPORT
|
| 145 | endif
|
| 146 |
|
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame] | 147 | MBTK_GNSS_MODE=$(shell cat $(ROOT)/config | grep CONFIG_MBTK_GNSS_MODE | cut -d '=' -f 2)
|
| 148 | $(info MBTK_GNSS_MODE=$(MBTK_GNSS_MODE))
|
| 149 | ifeq ($(MBTK_GNSS_MODE), gnss_6228)
|
| 150 | DEFINE += -DMBTK_GNSS_6228
|
| 151 | else
|
| 152 | DEFINE += -DMBTK_GNSS_5311
|
| 153 | endif
|
wangyouqiang | ed88c72 | 2023-11-22 16:33:43 +0800 | [diff] [blame] | 154 |
|
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 155 | LIB_DIR = \
|
| 156 | -L$(OUT_DIR)/lib
|
| 157 |
|
| 158 | LIBS = -lpthread -lstdc++
|
| 159 |
|
| 160 | # Common temp files to delete from each directory.
|
| 161 | TEMPFILES=core core.* *.o temp.* *.out
|