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