xref: /btstack/port/arduino/Makefile (revision eb4dccece89f38c3fa8fb13197f36188f58d954a)
1#
2# Makefile to setup BTstack library in Arduino folder (OS X/Linux only) and create .zip archive
3#
4
5DIR=.
6BTSTACK_ROOT=${realpath ../..}
7DUMMY=$(shell )
8VERSION=`sed -n -e 's/^.*BTSTACK_VERSION \"\(.*\)\"/\1/p' ${BTSTACK_ROOT}/platform/daemon/src/btstack_version.h`
9BTSTACK_PACKAGE=/tmp/btstack
10ARCHIVE=$(BTSTACK_ROOT)/btstack-arduino-${VERSION}.zip
11
12SRC_C_FILES  = btstack_memory.c btstack_linked_list.c btstack_memory_pool.c btstack_run_loop.c btstack_crypto.c
13SRC_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
14BLE_C_FILES  = att_db.c att_server.c att_dispatch.c att_db_util.c le_device_db_memory.c gatt_client.c
15BLE_C_FILES += sm.c att_db_util.c
16BLE_GATT_C_FILES = ancs_client.c
17PORT_C_FILES = bsp_arduino_em9301.cpp BTstack.cpp
18EMBEDDED_C_FILES = btstack_run_loop_embedded.c btstack_uart_block_embedded.c hci_dump_embedded_stdout.c
19EM9301_C_FILES = btstack_chipset_em9301.c
20
21PATHS  = $(addprefix ${BTSTACK_ROOT}/src/,     ${SRC_C_FILES})
22PATHS += $(addprefix ${BTSTACK_ROOT}/src/ble/, ${BLE_C_FILES})
23PATHS += $(addprefix ${BTSTACK_ROOT}/src/ble/gatt-service/, ${BLE_GATT_FILES})
24PATHS += $(addprefix ${BTSTACK_ROOT}/platform/embedded/,    ${EMBEDDED_C_FILES})
25PATHS += $(addprefix ${BTSTACK_ROOT}/chipset/em9301/,       ${EM9301_C_FILES})
26PATHS += $(addprefix ${DIR}/, ${PORT_FILES})
27PATHS += ${BTSTACK_ROOT}/port/arduino/examples
28
29ARDUINO_LIBS=~/Documents/arduino/libraries/BTstack
30
31all: release
32
33clean:
34	rm -rf ${BTSTACK_PACKAGE}
35
36update_version:
37	${BTSTACK_ROOT}/tool/get_version.sh
38
39install: update_version
40	rm -rf ${ARDUINO_LIBS}
41	mkdir ${ARDUINO_LIBS}
42	cd ${ARDUINO_LIBS} && unzip ${ARCHIVE}
43
44release: update_version
45	rm -f ${ARCHIVE}
46	cd ${BTSTACK_ROOT}/chipset/em9301    && zip    $(ARCHIVE) *.h
47	cd ${BTSTACK_ROOT}/platform/embedded && zip    $(ARCHIVE) *.h
48	cd ${BTSTACK_ROOT}/src 				 && zip    $(ARCHIVE) *.h ble/*.h ble/gatt-service/*.h
49	# remove the duplicate BTstack.h
50	zip -d ${ARCHIVE} btstack.h
51	# port specific files
52	zip ${ARCHIVE} *.h *.cpp
53	cd ${BTSTACK_ROOT}/port/arduino      && zip -r $(ARCHIVE) examples
54	# all c files
55	zip --junk-paths ${ARCHIVE} ${PATHS}
56	cp ${ARCHIVE} btstack-arduino-latest.zip
57