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=.
|
b.liu | a6a2bd1 | 2025-08-14 12:14:58 +0800 | [diff] [blame] | 10 | HOME_DIR := $(shell echo ~)
|
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 11 |
|
Mtek0512 | cc2ee50 | 2025-09-06 14:59:18 +0800 | [diff] [blame] | 12 | ifneq ($(OPENWRT_SDK_BUILD),y)
|
b.liu | a6a2bd1 | 2025-08-14 12:14:58 +0800 | [diff] [blame] | 13 | #BUILD_TOOLCHAIN_DIR = $(ROOT)/toolchain/gcc-$(BUILD_GCC_VERSION)-$(BUILD_STD_LIBC)
|
| 14 | BUILD_TOOLCHAIN_DIR = $(HOME_DIR)/openwrt_toolchains/gcc-$(BUILD_GCC_VERSION)-$(BUILD_STD_LIBC)
|
b.liu | deb8e42 | 2024-12-14 17:36:56 +0800 | [diff] [blame] | 15 |
|
b.liu | b3b923a | 2024-06-06 15:15:49 +0800 | [diff] [blame] | 16 | ifeq ($(BUILD_STD_LIBC), glibc)
|
b.liu | b3b923a | 2024-06-06 15:15:49 +0800 | [diff] [blame] | 17 | CC=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-gnueabi-gcc
|
| 18 | AR=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-gnueabi-ar
|
| 19 | else
|
b.liu | 17d7f8b | 2023-10-08 16:57:59 +0800 | [diff] [blame] | 20 | CC=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-muslgnueabi-gcc
|
| 21 | AR=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-muslgnueabi-ar
|
b.liu | b3b923a | 2024-06-06 15:15:49 +0800 | [diff] [blame] | 22 | endif
|
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 23 |
|
Mtek0512 | cc2ee50 | 2025-09-06 14:59:18 +0800 | [diff] [blame] | 24 | MAKE=make
|
| 25 |
|
| 26 | else
|
| 27 | BUILD_TOOLCHAIN_DIR := $(SYSROOT_DIR)
|
| 28 |
|
| 29 | AS := $(CROSS_COMPILE)as
|
| 30 | CC := $(CROSS_COMPILE)gcc
|
| 31 | CPP := $(CROSS_COMPILE)c++
|
| 32 | AR := $(CROSS_COMPILE)ar rv
|
| 33 | LD := $(CROSS_COMPILE)ld
|
| 34 | STRIP := $(CROSS_COMPILE)strip
|
| 35 | RANLIB := $(CROSS_COMPILE)ranlib
|
| 36 |
|
| 37 | OUT_DIR := $(OBJ_DIR)/..
|
| 38 |
|
| 39 | MAKE=make -j1 OPENWRT_SDK_BUILD="$(OPENWRT_SDK_BUILD)" \
|
| 40 | MBTK_SOURCE_VERSION="$(MBTK_SOURCE_VERSION)" \
|
| 41 | BUILD_LIB_TYPE="$(BUILD_LIB_TYPE)" \
|
| 42 | CROSS_COMPILE="$(CROSS_COMPILE)" \
|
| 43 | EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \
|
| 44 | LD_FLAGS="$(LD_FLAGS)" \
|
| 45 | INSTALL_DIR="$(INSTALL_DIR)" \
|
| 46 | SYSROOT_DIR="$(SYSROOT_DIR)" \
|
| 47 | OBJ_DIR="$(OBJ_DIR)"
|
| 48 |
|
| 49 | MRVL_INC = \
|
| 50 | -isystem $(MRVLDIR)/services/ril/include \
|
| 51 | -isystem $(MRVLDIR)/services/audio/include \
|
| 52 | -isystem $(MRVLDIR)/services/audio_if/include \
|
| 53 | -isystem $(MRVLDIR)/services/audio/include/stub \
|
| 54 | -isystem $(MRVLDIR)/services/audio/tinyalsa/include \
|
| 55 | -isystem $(MRVLDIR)/services/audio/libaudio-apu \
|
| 56 | -isystem $(MRVLDIR)/lte-telephony/apps/aud_sw/vcm_ipc
|
| 57 |
|
| 58 | endif
|
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 59 |
|
| 60 | $(info BUILD_LIB_TYPE=$(BUILD_LIB_TYPE))
|
| 61 | $(info BUILD_PLATFORM=$(BUILD_PLATFORM))
|
b.liu | 5d5b8ba | 2024-02-20 14:00:33 +0800 | [diff] [blame] | 62 | $(info BUILD_BRANCH=$(BUILD_BRANCH))
|
b.liu | f37bd33 | 2024-03-18 13:51:24 +0800 | [diff] [blame] | 63 | $(info BUILD_PROJECT=$(BUILD_PROJECT))
|
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 64 | $(info ROOT=$(ROOT))
|
| 65 | $(info CC=$(CC))
|
| 66 | $(info AR=$(AR))
|
| 67 |
|
b.liu | 1c1c721 | 2023-12-22 16:35:27 +0800 | [diff] [blame] | 68 | # -Werror=non-virtual-dtor
|
b.liu | 08f38c6 | 2024-11-06 20:03:46 +0800 | [diff] [blame] | 69 | #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.liu | deb8e42 | 2024-12-14 17:36:56 +0800 | [diff] [blame] | 70 | CFLAGS = --sysroot=$(BUILD_TOOLCHAIN_DIR) -Os -pipe -rdynamic -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -Wall -Werror -g -Wno-error=format
|
b.liu | 08f38c6 | 2024-11-06 20:03:46 +0800 | [diff] [blame] | 71 |
|
b.liu | 355b184 | 2024-11-21 16:23:53 +0800 | [diff] [blame] | 72 | CFLAGS_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
|
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 73 |
|
| 74 | AWK=awk
|
| 75 |
|
| 76 | #CFLAGS += -Wno-error=format-truncation -Wno-error=format-overflow= -Wno-error=stringop-overread -Wno-error=deprecated-declarations
|
| 77 |
|
| 78 | INC_DIR = \
|
b.liu | 9a30686 | 2024-03-06 16:49:40 +0800 | [diff] [blame] | 79 | -I$(LOCAL_PATH)/ \
|
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 80 | -I$(LOCAL_PATH)/inc \
|
| 81 | -I$(BUILD_ROOT)/include \
|
| 82 | -I$(BUILD_ROOT)/include/mbtk \
|
| 83 | -I$(BUILD_ROOT)/include/lynq \
|
| 84 | -I$(BUILD_ROOT)/include/mqtt \
|
| 85 | -I$(BUILD_ROOT)/include/ql
|
| 86 |
|
| 87 | # -DCONFIG_AB_SYSTEM
|
b.liu | b171c9a | 2024-11-12 19:23:29 +0800 | [diff] [blame] | 88 | # -DMBTK_DUMP_SUPPORT
|
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 89 | DEFINE = \
|
Mtek0512 | cc2ee50 | 2025-09-06 14:59:18 +0800 | [diff] [blame] | 90 | $(MRVL_INC) \
|
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 91 | -DMBTK_SUPPORT \
|
| 92 | -DMARVELL_EXTENDED \
|
| 93 | -DPXA1826_AUDIO \
|
| 94 | -D__USE_GNU \
|
| 95 | -DNOT_DROPPED_FLAGS_TEST \
|
| 96 | -DNDEBUG \
|
| 97 | -UDEBUG \
|
b.liu | 8883171 | 2023-10-10 15:26:32 +0800 | [diff] [blame] | 98 | -D_FORTIFY_SOURCE=2 \
|
b.liu | bcf86c9 | 2024-08-19 19:48:28 +0800 | [diff] [blame] | 99 | -D_GNU_SOURCE \
|
| 100 | -DMBTK_BUILD_TIME=\""$(shell date +%Y/%m/%d\ %H:%M:%S)\"" \
|
| 101 | -DMBTK_BUILD_GIT=\""$(shell git log | grep commit | head -1 | cut -d ' ' -f 2)\""
|
| 102 |
|
| 103 | #MBTK_BUILD_GIT="$(shell git log | grep commit | head -1 | cut -d ' ' -f 2)"
|
| 104 | #$(info MBTK_BUILD_GIT=$(MBTK_BUILD_GIT))
|
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 105 |
|
b.liu | 4f8e879 | 2023-11-01 23:25:22 +0800 | [diff] [blame] | 106 | #$(info TOPDIR=$(TOPDIR))
|
b.liu | f37bd33 | 2024-03-18 13:51:24 +0800 | [diff] [blame] | 107 | # BUILD_PROJECT=$(shell cat $(ROOT)/../build_version | grep PROJECT | cut -d '=' -f 2)
|
| 108 | #$(info BUILD_PROJECT=$(BUILD_PROJECT))
|
b.liu | 4f8e879 | 2023-11-01 23:25:22 +0800 | [diff] [blame] | 109 | #BUILD_PROJECT_X=$(shell ${BUILD_PROJECT:0:4})
|
| 110 | #BUILD_PROJECT_X=$(shell echo $(BUILD_PROJECT) | cut -c 1-4)
|
| 111 | #$(info BUILD_PROJECT_X=$(BUILD_PROJECT_X))
|
| 112 |
|
yq.wang | f75381b | 2024-10-09 23:00:23 -0700 | [diff] [blame] | 113 | DEFINE += -DMBTK_ALL_CID_SUPPORT
|
| 114 |
|
b.liu | 8837014 | 2024-12-23 14:11:57 +0800 | [diff] [blame] | 115 | ifeq ($(MBTK_SOURCE_VERSION), 2)
|
b.liu | bcf86c9 | 2024-08-19 19:48:28 +0800 | [diff] [blame] | 116 | DEFINE += -DMBTK_SOURCE_VERSION_2
|
| 117 | endif
|
| 118 |
|
b.liu | 9f91db3 | 2025-02-13 11:24:18 +0800 | [diff] [blame] | 119 | #ifeq ($(MBTK_DEV_INFO_VERSION), 2)
|
| 120 | #DEFINE += -DMBTK_DEV_INFO_VERSION_2
|
| 121 | #endif
|
b.liu | 472cfaf | 2024-12-19 19:08:19 +0800 | [diff] [blame] | 122 |
|
b.liu | 61ad917 | 2025-01-09 14:33:55 +0800 | [diff] [blame] | 123 | ifeq ($(CONFIG_MBTK_5G_SUPPORT), Y)
|
| 124 | DEFINE += -DMBTK_5G_SUPPORT
|
| 125 | endif
|
| 126 |
|
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 127 | LIB_DIR = \
|
| 128 | -L$(OUT_DIR)/lib
|
| 129 |
|
| 130 | LIBS = -lpthread -lstdc++
|
| 131 |
|
| 132 | # Common temp files to delete from each directory.
|
| 133 | TEMPFILES=core core.* *.o temp.* *.out
|