1cur_dir := $(dir $(lastword $(MAKEFILE_LIST)))
2
3src_obj := $(patsubst $(cur_dir)%,%,$(wildcard $(cur_dir)*.c $(cur_dir)*.cpp $(cur_dir)*.S))
4src_obj += $(patsubst $(cur_dir)%,%,$(wildcard $(cur_dir)a2dp/*.c))
5src_obj += $(patsubst $(cur_dir)%,%,$(wildcard $(cur_dir)a2dp/*.cpp))
6src_obj += $(patsubst $(cur_dir)%,%,$(wildcard $(cur_dir)avrcp/*.c))
7src_obj += $(patsubst $(cur_dir)%,%,$(wildcard $(cur_dir)avrcp/*.cpp))
8src_obj += $(patsubst $(cur_dir)%,%,$(wildcard $(cur_dir)conmgr/*.c))
9src_obj += $(patsubst $(cur_dir)%,%,$(wildcard $(cur_dir)conmgr/*.cpp))
10src_obj += $(patsubst $(cur_dir)%,%,$(wildcard $(cur_dir)hci/*.c))
11src_obj += $(patsubst $(cur_dir)%,%,$(wildcard $(cur_dir)hci/*.cpp))
12src_obj += $(patsubst $(cur_dir)%,%,$(wildcard $(cur_dir)l2cap/*.c))
13src_obj += $(patsubst $(cur_dir)%,%,$(wildcard $(cur_dir)l2cap/*.cpp))
14src_obj += $(patsubst $(cur_dir)%,%,$(wildcard $(cur_dir)me/*.c))
15src_obj += $(patsubst $(cur_dir)%,%,$(wildcard $(cur_dir)me/*.cpp))
16src_obj += $(patsubst $(cur_dir)%,%,$(wildcard $(cur_dir)sdp/*.c))
17src_obj += $(patsubst $(cur_dir)%,%,$(wildcard $(cur_dir)sdp/*.cpp))
18src_obj += $(patsubst $(cur_dir)%,%,$(wildcard $(cur_dir)spp/*.c))
19src_obj += $(patsubst $(cur_dir)%,%,$(wildcard $(cur_dir)spp/*.cpp))
20src_obj += $(patsubst $(cur_dir)%,%,$(wildcard $(cur_dir)hfp/*.c))
21src_obj += $(patsubst $(cur_dir)%,%,$(wildcard $(cur_dir)hfp/*.cpp))
22src_obj += $(patsubst $(cur_dir)%,%,$(wildcard $(cur_dir)os/*.c))
23src_obj += $(patsubst $(cur_dir)%,%,$(wildcard $(cur_dir)os/*.cpp))
24src_obj += $(patsubst $(cur_dir)%,%,$(wildcard $(cur_dir)rfcomm/*.c))
25src_obj += $(patsubst $(cur_dir)%,%,$(wildcard $(cur_dir)rfcomm/*.cpp))
26src_obj += $(patsubst $(cur_dir)%,%,$(wildcard $(cur_dir)sync/*.c))
27src_obj += $(patsubst $(cur_dir)%,%,$(wildcard $(cur_dir)sync/*.cpp))
28src_obj += $(patsubst $(cur_dir)%,%,$(wildcard $(cur_dir)besaud/*.c))
29src_obj += $(patsubst $(cur_dir)%,%,$(wildcard $(cur_dir)besaud/*.cpp))
30src_obj += $(patsubst $(cur_dir)%,%,$(wildcard $(cur_dir)dip/*.c))
31src_obj += $(patsubst $(cur_dir)%,%,$(wildcard $(cur_dir)dip/*.cpp))
32src_obj += $(patsubst $(cur_dir)%,%,$(wildcard $(cur_dir)map/*.c))
33src_obj += $(patsubst $(cur_dir)%,%,$(wildcard $(cur_dir)map/*.cpp))
34
35ifeq ($(A2DP_LHDC_ON),1)
36src_obj += $(patsubst $(cur_dir)%,%,$(wildcard $(cur_dir)lhdc_license/*.c))
37src_obj += $(patsubst $(cur_dir)%,%,$(wildcard $(cur_dir)lhdc_license/*.cpp))
38endif
39
40src_obj := $(src_obj:.c=.o)
41src_obj := $(src_obj:.cpp=.o)
42src_obj := $(src_obj:.S=.o)
43
44ifeq ($(IBRT), 1)
45BTAPI_LIB_NAME := ibrt_libbt_api
46else
47BTAPI_LIB_NAME := $(CHIP)_libbt_api
48endif
49
50ifeq ($(HFP_1_6_ENABLE), 1)
51BTAPI_LIB_NAME := $(BTAPI_LIB_NAME)_sbc_enc
52endif
53
54ifeq ($(SBC_FUNC_IN_ROM), 1)
55BTAPI_LIB_NAME := $(BTAPI_LIB_NAME)_sbc_in_rom
56endif
57
58ifeq ($(A2DP_LHDC_ON),1)
59BTAPI_LIB_NAME := $(BTAPI_LIB_NAME)_lhdc
60endif
61
62ifeq ($(BT_RF_PREFER), 2M)
63BTAPI_LIB_NAME := $(BTAPI_LIB_NAME)_2m
64endif
65
66ifeq ($(BT_RF_PREFER), 3M)
67BTAPI_LIB_NAME := $(BTAPI_LIB_NAME)_3m
68endif
69
70ifeq ($(BT_ONE_BRING_TWO), 1)
71BTAPI_LIB_NAME := $(BTAPI_LIB_NAME)_1b2
72endif
73
74ifeq ($(BLE), 1)
75BTAPI_LIB_NAME := $(BTAPI_LIB_NAME)_ble
76endif
77$(BTAPI_LIB_NAME)-y := $(src_obj)
78
79obj-y += $(BTAPI_LIB_NAME).a
80
81ccflags-y += \
82    $(BT_IF_INCLUDES) \
83    -Iservices/bt_if_enhanced/conmgr \
84    $(BT_PROFILES_INCLUDES) \
85    -Iservices/audio_process \
86    -Iservices/overlay \
87    -Iservices/nvrecord \
88    -Iutils/cqueue \
89    -Iutils/heap \
90    -Iservices/audioflinger \
91    -Iutils/lockcqueue \
92    -Iservices/ble_app \
93    -Iservices/ble_stack/common/api/ \
94    -Iservices/bt_app \
95    -Iservices/resources/ \
96    -Iservices/osif \
97    -Iservices/auto_test/ \
98    -Iapps/audioplayers \
99    -Iapps/main/ \
100    -Iapps/key/ \
101    -Iplatform/drivers/ana/ \
102    -Iplatform/drivers/bt/ \
103    -Iutils/intersyshci \
104    -Iservices/ibrt/inc \
105	-Iservices/multimedia/audio/codec/sbc/inc \
106	-Iservices/multimedia/audio/codec/sbc/src/inc \
107    -Iservices/bt_app/a2dp_codecs/include
108
109CFLAGS_bt_if.o += -DBESLIB_INFO=$(BESLIB_INFO)
110
111ifeq ($(A2DP_LDAC_ON),1)
112ccflags-y += -Ithirdparty/audio_codec_lib/ldac/inc
113endif
114
115ifeq ($(ANC_APP),1)
116CFLAGS_besaud_api.o += -DANC_APP
117endif
118
119