xref: /btstack/port/arduino/Makefile (revision c7747faaecd536055fd01520084f110826db2bc0)
1#
2# Makefile to setup BTstack library in Arduino folder (OS X/Linux only) and create .zip archive
3#
4
5DIR=.
6BTSTACK_ROOT=${realpath ../..}
7VERSION=$(shell ${BTSTACK_ROOT}/tool/get_git_version.sh)
8ARCHIVE=$(BTSTACK_ROOT)/btstack-arduino-${VERSION}.zip
9
10SRC_C_FILES  = btstack_memory.c btstack_linked_list.c btstack_memory_pool.c btstack_run_loop.c btstack_crypto.c
11SRC_C_FILES += hci_dump.c hci.c hci_cmd.c  btstack_util.c l2cap.c l2cap_signaling.c ad_parser.c hci_transport_h4.c btstack_tlv.c
12BLE_C_FILES  = att_db.c att_server.c att_dispatch.c att_db_util.c le_device_db_memory.c gatt_client.c
13BLE_C_FILES += sm.c att_db_util.c
14BLE_GATT_C_FILES = ancs_client.c
15PORT_C_FILES = bsp_arduino_em9301.cpp BTstack.cpp
16EMBEDDED_C_FILES = btstack_run_loop_embedded.c btstack_uart_block_embedded.c hci_dump_embedded_stdout.c
17EM9301_C_FILES = btstack_chipset_em9301.c
18
19PATHS  = $(addprefix ${BTSTACK_ROOT}/src/,     ${SRC_C_FILES})
20PATHS += $(addprefix ${BTSTACK_ROOT}/src/ble/, ${BLE_C_FILES})
21PATHS += $(addprefix ${BTSTACK_ROOT}/src/ble/gatt-service/, ${BLE_GATT_C_FILES})
22PATHS += $(addprefix ${BTSTACK_ROOT}/platform/embedded/,    ${EMBEDDED_C_FILES})
23PATHS += $(addprefix ${BTSTACK_ROOT}/chipset/em9301/,       ${EM9301_C_FILES})
24PATHS += $(addprefix ${DIR}/, ${PORT_FILES})
25PATHS += ${BTSTACK_ROOT}/port/arduino/examples
26
27ARDUINO_LIBS=~/Documents/arduino/libraries/BTstack
28
29all: release
30
31update_version:
32	${BTSTACK_ROOT}/tool/get_version.sh
33
34install: update_version
35	rm -rf ${ARDUINO_LIBS}
36	mkdir ${ARDUINO_LIBS}
37	cd ${ARDUINO_LIBS} && unzip ${ARCHIVE}
38
39release: update_version
40	rm -f ${ARCHIVE}
41	cd ${BTSTACK_ROOT}/chipset/em9301    && zip    $(ARCHIVE) *.h
42	cd ${BTSTACK_ROOT}/platform/embedded && zip    $(ARCHIVE) *.h
43	cd ${BTSTACK_ROOT}/src 				 && zip    $(ARCHIVE) *.h ble/*.h ble/gatt-service/*.h
44	# remove the duplicate BTstack.h
45	zip -d ${ARCHIVE} btstack.h
46	# port specific files
47	zip ${ARCHIVE} *.h *.cpp
48	cd ${BTSTACK_ROOT}/port/arduino      && zip -r $(ARCHIVE) examples
49	# all c files
50	zip --junk-paths ${ARCHIVE} ${PATHS}
51	cp ${ARCHIVE} btstack-arduino-latest.zip
52