1##
2 # Copyright (C) 2017 C-SKY Microsystems Co., All rights reserved.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #   http://www.apache.crg/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15##
16
17ifeq ($(CONFIG_BT), y)
18
19L_PATH := $(call cur-dir)
20
21include $(DEFINE_LOCAL)
22
23L_MODULE := libbt_host
24
25L_CFLAGS := -Wall
26
27include $(L_PATH)/../bt_defconfig
28
29#L_CFLAGS := -D__ORDER_LITTLE_ENDIAN__=1 -D__ORDER_BIG_ENDIAN__=2 -D__BYTE_ORDER__=__ORDER_LITTLE_ENDIAN__
30
31L_INCS += $(L_PATH)/../include $(L_PATH)/include $(L_PATH)/port/include $(L_PATH)/../crypto $(L_PATH) $(L_PATH)/include/drivers \
32			$(L_PATH)/host
33L_INCS += $(L_PATH)/../bt_crypto/include
34
35L_SRCS +=	port/core/buf.c \
36			port/core/atomic_c.c \
37			hci_driver/h4_driver.c
38
39ifeq ($(CONFIG_OS_CSI), y)
40L_SRCS +=	port/csi/csi_port.c \
41			port/csi/work.c
42L_INCS +=   $(L_PATH)/port/csi
43else
44L_SRCS +=	port/aos/aos_port.c \
45			port/aos/work.c  \
46			port/aos/poll.c
47L_INCS +=   $(L_PATH)/port/aos
48L_INCS +=   $(L_PATH)/port/aos/include $(L_PATH)/../../../../csi/csi_kernel/rhino/core/include  $(L_PATH)/../../../../csi/csi_kernel/rhino/arch/include
49endif
50
51#L_SRCS += common/dummy.c
52
53L_SRCS +=	common/log.c
54
55	L_SRCS +=	common/rpa.c
56
57ifeq ($(CONFIG_BT_HCI_RAW), y)
58	L_SRCS +=	host/hci_raw.c
59endif
60
61ifeq ($(CONFIG_BT_DEBUG_MONITOR), y)
62	L_SRCS +=	host/monitor.c
63endif
64
65ifeq ($(CONFIG_BT_TINYCRYPT_ECC), y)
66	L_INCS +=	$(L_PATH)/../bt_crypto/tinycrypt/include
67	L_SRCS +=	host/hci_ecc.c
68endif
69
70ifeq ($(CONFIG_BT_A2DP), y)
71		L_SRCS +=	host/a2dp.c
72endif
73
74ifeq ($(CONFIG_BT_AVDTP), y)
75		L_SRCS +=	host/avdtp.c
76endif
77
78ifeq ($(CONFIG_BT_RFCOMM), y)
79		L_SRCS +=	host/rfcomm.c
80endif
81
82ifeq ($(CONFIG_BT_TESTING), y)
83		L_SRCS +=	host/testing.c
84endif
85
86ifeq ($(CONFIG_BT_SETTINGS), y)
87		L_SRCS +=	host/settings.c
88endif
89
90ifeq ($(CONFIG_BT_BREDR), y)
91	L_SRCS +=	host/keys_br.c \
92				host/l2cap_br.c \
93				host/sdp.c
94endif
95
96ifeq ($(CONFIG_BT_HFP_HF), y)
97	L_SRCS +=	host/hfp_hf.c \
98				host/at.c
99endif
100
101ifeq ($(CONFIG_BT_HCI_HOST), y)
102	L_SRCS +=	host/uuid.c \
103				host/hci_api.c \
104				host/hci_core.c
105
106	L_SRCS +=	host/crypto.c
107
108	ifeq ($(CONFIG_BT_CONN), y)
109		L_SRCS +=	host/conn.c \
110					host/l2cap.c \
111					host/att.c \
112					host/gatt.c
113
114
115		ifeq ($(CONFIG_BT_SMP), y)
116			L_SRCS +=	host/smp.c \
117						host/keys.c
118		else
119			L_SRCS +=	host/smp_null.c
120		endif
121	endif
122endif
123
124ifeq ($(CONFIG_SETTINGS), y)
125L_INCS +=   $(L_PATH)/port/core/settings/src \
126			$(L_PATH)/port/core/settings/include
127
128L_SRCS +=	port/core/settings/src/settings_store.c \
129			port/core/settings/src/settings.c \
130			port/core/settings/src/settings_init.c \
131			port/core/settings/src/settings_line.c \
132			port/core/settings/src/settings_kv.c
133endif
134
135L_SRCS +=	aos/ble.c
136
137include $(BUILD_MODULE)
138
139gen_btconfig:
140	@make -C kernel/protocols/bluetooth/
141
142endif
143
144L_PATH := $(call cur-dir)
145
146L_POSIX_PATH := $(L_PATH)
147
148$(call include-all-subdir-makefiles,$(L_PATH))
149