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 | 3403c93 | 2023-10-10 16:26:35 +0800 | [diff] [blame] | 6 | |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 7 | OUT_DIR = $(ROOT)/out
|
| 8 | BUILD_ROOT = $(ROOT)/mbtk
|
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))
|
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 35 | $(info ROOT=$(ROOT))
|
| 36 | $(info CC=$(CC))
|
| 37 | $(info AR=$(AR))
|
| 38 |
|
b.liu | 1c1c721 | 2023-12-22 16:35:27 +0800 | [diff] [blame] | 39 | # -Werror=non-virtual-dtor
|
| 40 | 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] | 41 |
|
| 42 | AWK=awk
|
| 43 |
|
| 44 | #CFLAGS += -Wno-error=format-truncation -Wno-error=format-overflow= -Wno-error=stringop-overread -Wno-error=deprecated-declarations
|
| 45 |
|
| 46 | INC_DIR = \
|
b.liu | 9a30686 | 2024-03-06 16:49:40 +0800 | [diff] [blame^] | 47 | -I$(LOCAL_PATH)/ \
|
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 48 | -I$(LOCAL_PATH)/inc \
|
| 49 | -I$(BUILD_ROOT)/include \
|
| 50 | -I$(BUILD_ROOT)/include/mbtk \
|
| 51 | -I$(BUILD_ROOT)/include/lynq \
|
| 52 | -I$(BUILD_ROOT)/include/mqtt \
|
| 53 | -I$(BUILD_ROOT)/include/ql
|
| 54 |
|
| 55 | # -DCONFIG_AB_SYSTEM
|
| 56 | DEFINE = \
|
| 57 | -DMBTK_SUPPORT \
|
| 58 | -DMARVELL_EXTENDED \
|
| 59 | -DPXA1826_AUDIO \
|
| 60 | -D__USE_GNU \
|
| 61 | -DNOT_DROPPED_FLAGS_TEST \
|
| 62 | -DNDEBUG \
|
| 63 | -UDEBUG \
|
b.liu | 8883171 | 2023-10-10 15:26:32 +0800 | [diff] [blame] | 64 | -D_FORTIFY_SOURCE=2 \
|
| 65 | -D_GNU_SOURCE
|
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 66 |
|
b.liu | 4f8e879 | 2023-11-01 23:25:22 +0800 | [diff] [blame] | 67 | #$(info TOPDIR=$(TOPDIR))
|
| 68 | BUILD_PROJECT=$(shell cat $(ROOT)/../build_version | grep PROJECT | cut -d '=' -f 2)
|
| 69 | $(info BUILD_PROJECT=$(BUILD_PROJECT))
|
| 70 | #BUILD_PROJECT_X=$(shell ${BUILD_PROJECT:0:4})
|
| 71 | #BUILD_PROJECT_X=$(shell echo $(BUILD_PROJECT) | cut -c 1-4)
|
| 72 | #$(info BUILD_PROJECT_X=$(BUILD_PROJECT_X))
|
| 73 |
|
b.liu | 03c7466 | 2023-11-17 16:09:48 +0800 | [diff] [blame] | 74 | ifeq ($(BUILD_PLATFORM), asr1806)
|
| 75 | DEFINE += -DMBTK_PLATFORM_ASR1806
|
| 76 |
|
b.liu | 43da341 | 2023-11-08 15:58:39 +0800 | [diff] [blame] | 77 | ifeq ($(shell echo $(BUILD_PROJECT) | cut -c 1-7), L508_X6)
|
| 78 | $(info BUILD_PROJECT=L508_X6)
|
| 79 | DEFINE += -DMBTK_PROJECT_L508_X6
|
| 80 | else
|
| 81 | ifeq ($(shell echo $(BUILD_PROJECT) | cut -c 1-4), T108)
|
| 82 | $(info BUILD_PROJECT=T108)
|
| 83 | DEFINE += -DMBTK_PROJECT_T108
|
| 84 | else
|
b.liu | 03c7466 | 2023-11-17 16:09:48 +0800 | [diff] [blame] | 85 | $(info BUILD_PROJECT=Unknown)
|
| 86 | endif
|
| 87 | endif
|
| 88 | else
|
| 89 | DEFINE += -DMBTK_POLARSSL_SUPPORT
|
b.liu | 5d5b8ba | 2024-02-20 14:00:33 +0800 | [diff] [blame] | 90 |
|
| 91 | ifeq ($(BUILD_BRANCH), rls3671)
|
b.liu | 03c7466 | 2023-11-17 16:09:48 +0800 | [diff] [blame] | 92 | DEFINE += -DMBTK_MP3_SUPPORT
|
b.liu | 5d5b8ba | 2024-02-20 14:00:33 +0800 | [diff] [blame] | 93 | endif
|
| 94 |
|
b.liu | 03c7466 | 2023-11-17 16:09:48 +0800 | [diff] [blame] | 95 | DEFINE += -DMBTK_PLATFORM_ASR1803
|
| 96 |
|
b.liu | 4f8e879 | 2023-11-01 23:25:22 +0800 | [diff] [blame] | 97 | ifeq ($(shell echo $(BUILD_PROJECT) | cut -c 1-4), L508)
|
| 98 | $(info BUILD_PROJECT=L508)
|
| 99 | DEFINE += -DMBTK_PROJECT_L508
|
| 100 | else
|
| 101 | ifeq ($(shell echo $(BUILD_PROJECT) | cut -c 1-4), L509)
|
| 102 | $(info BUILD_PROJECT=L509)
|
| 103 | DEFINE += -DMBTK_PROJECT_L509
|
| 104 | else
|
| 105 | ifeq ($(shell echo $(BUILD_PROJECT) | cut -c 1-6), PN1803)
|
| 106 | $(info BUILD_PROJECT=PN1803)
|
| 107 | DEFINE += -DMBTK_PROJECT_PN1803
|
| 108 | endif
|
| 109 | endif
|
| 110 | endif
|
b.liu | 43da341 | 2023-11-08 15:58:39 +0800 | [diff] [blame] | 111 | endif
|
b.liu | 4f8e879 | 2023-11-01 23:25:22 +0800 | [diff] [blame] | 112 |
|
b.liu | 96f2515 | 2024-02-20 17:21:59 +0800 | [diff] [blame] | 113 | MBTK_AF_SUPPORT=$(shell cat $(ROOT)/config | grep CONFIG_AF_SUPPORT | cut -d '=' -f 2)
|
| 114 | $(info MBTK_AF_SUPPORT=$(MBTK_AF_SUPPORT))
|
| 115 | ifeq ($(MBTK_AF_SUPPORT), y)
|
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame] | 116 | DEFINE += -DMBTK_AF_SUPPORT
|
| 117 | endif
|
| 118 |
|
b.liu | c7ffd09 | 2024-01-03 15:23:07 +0800 | [diff] [blame] | 119 | MBTK_YX_SUPPORT=$(shell cat $(ROOT)/config | grep CONFIG_YX_SUPPORT | cut -d '=' -f 2)
|
| 120 | $(info MBTK_YX_SUPPORT=$(MBTK_YX_SUPPORT))
|
| 121 | ifeq ($(MBTK_YX_SUPPORT), y)
|
| 122 | DEFINE += -DMBTK_YX_SUPPORT
|
| 123 | endif
|
| 124 |
|
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame] | 125 | MBTK_GNSS_MODE=$(shell cat $(ROOT)/config | grep CONFIG_MBTK_GNSS_MODE | cut -d '=' -f 2)
|
| 126 | $(info MBTK_GNSS_MODE=$(MBTK_GNSS_MODE))
|
| 127 | ifeq ($(MBTK_GNSS_MODE), gnss_6228)
|
| 128 | DEFINE += -DMBTK_GNSS_6228
|
| 129 | else
|
| 130 | DEFINE += -DMBTK_GNSS_5311
|
| 131 | endif
|
wangyouqiang | ed88c72 | 2023-11-22 16:33:43 +0800 | [diff] [blame] | 132 |
|
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 133 | LIB_DIR = \
|
| 134 | -L$(OUT_DIR)/lib
|
| 135 |
|
| 136 | LIBS = -lpthread -lstdc++
|
| 137 |
|
| 138 | # Common temp files to delete from each directory.
|
| 139 | TEMPFILES=core core.* *.o temp.* *.out
|