xref: /btstack/port/arduino/Makefile (revision 690999b0e56bbf6361211ab420f80bc01aa9aa03)
18caefee3SMatthias Ringwald#
28caefee3SMatthias Ringwald# Makefile to setup BTstack library in Arduino folder (OS X/Linux only) and create .zip archive
38caefee3SMatthias Ringwald#
48caefee3SMatthias Ringwald
58caefee3SMatthias RingwaldDIR=.
6b149c1b9SMatthias RingwaldBTSTACK_ROOT=${realpath ../..}
78caefee3SMatthias RingwaldDUMMY=$(shell )
82531c97eSMatthias RingwaldVERSION=`sed -n -e 's/^.*BTSTACK_VERSION \"\(.*\)\"/\1/p' ${BTSTACK_ROOT}/platform/daemon/src/btstack_version.h`
98caefee3SMatthias RingwaldBTSTACK_PACKAGE=/tmp/btstack
10b149c1b9SMatthias RingwaldARCHIVE=$(BTSTACK_ROOT)/btstack-arduino-${VERSION}.zip
118caefee3SMatthias Ringwald
12b149c1b9SMatthias RingwaldSRC_C_FILES  = btstack_memory.c btstack_linked_list.c btstack_memory_pool.c btstack_run_loop.c btstack_crypto.c
13b149c1b9SMatthias RingwaldSRC_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
14b149c1b9SMatthias RingwaldBLE_C_FILES  = att_db.c att_server.c att_dispatch.c att_db_util.c le_device_db_memory.c gatt_client.c
15b149c1b9SMatthias RingwaldBLE_C_FILES += sm.c att_db_util.c
16b149c1b9SMatthias RingwaldBLE_GATT_C_FILES = ancs_client.c
17b149c1b9SMatthias RingwaldPORT_C_FILES = bsp_arduino_em9301.cpp BTstack.cpp
18b149c1b9SMatthias RingwaldEMBEDDED_C_FILES = btstack_run_loop_embedded.c btstack_uart_block_embedded.c hci_dump_embedded_stdout.c
19b149c1b9SMatthias RingwaldEM9301_C_FILES = btstack_chipset_em9301.c
208caefee3SMatthias Ringwald
21b149c1b9SMatthias RingwaldPATHS  = $(addprefix ${BTSTACK_ROOT}/src/,     ${SRC_C_FILES})
22b149c1b9SMatthias RingwaldPATHS += $(addprefix ${BTSTACK_ROOT}/src/ble/, ${BLE_C_FILES})
23*690999b0SMatthias RingwaldPATHS += $(addprefix ${BTSTACK_ROOT}/src/ble/gatt-service/, ${BLE_GATT_C_FILES})
24b149c1b9SMatthias RingwaldPATHS += $(addprefix ${BTSTACK_ROOT}/platform/embedded/,    ${EMBEDDED_C_FILES})
25b149c1b9SMatthias RingwaldPATHS += $(addprefix ${BTSTACK_ROOT}/chipset/em9301/,       ${EM9301_C_FILES})
268caefee3SMatthias RingwaldPATHS += $(addprefix ${DIR}/, ${PORT_FILES})
27b149c1b9SMatthias RingwaldPATHS += ${BTSTACK_ROOT}/port/arduino/examples
288caefee3SMatthias Ringwald
298caefee3SMatthias RingwaldARDUINO_LIBS=~/Documents/arduino/libraries/BTstack
308caefee3SMatthias Ringwald
318caefee3SMatthias Ringwaldall: release
328caefee3SMatthias Ringwald
338caefee3SMatthias Ringwaldclean:
348caefee3SMatthias Ringwald	rm -rf ${BTSTACK_PACKAGE}
358caefee3SMatthias Ringwald
368caefee3SMatthias Ringwaldupdate_version:
373edc84c5SMatthias Ringwald	${BTSTACK_ROOT}/tool/get_version.sh
388caefee3SMatthias Ringwald
398caefee3SMatthias Ringwaldinstall: update_version
408caefee3SMatthias Ringwald	rm -rf ${ARDUINO_LIBS}
418caefee3SMatthias Ringwald	mkdir ${ARDUINO_LIBS}
42b149c1b9SMatthias Ringwald	cd ${ARDUINO_LIBS} && unzip ${ARCHIVE}
438caefee3SMatthias Ringwald
448caefee3SMatthias Ringwaldrelease: update_version
458caefee3SMatthias Ringwald	rm -f ${ARCHIVE}
46b149c1b9SMatthias Ringwald	cd ${BTSTACK_ROOT}/chipset/em9301    && zip    $(ARCHIVE) *.h
47b149c1b9SMatthias Ringwald	cd ${BTSTACK_ROOT}/platform/embedded && zip    $(ARCHIVE) *.h
48b149c1b9SMatthias Ringwald	cd ${BTSTACK_ROOT}/src 				 && zip    $(ARCHIVE) *.h ble/*.h ble/gatt-service/*.h
49b149c1b9SMatthias Ringwald	# remove the duplicate BTstack.h
50b149c1b9SMatthias Ringwald	zip -d ${ARCHIVE} btstack.h
51b149c1b9SMatthias Ringwald	# port specific files
52b149c1b9SMatthias Ringwald	zip ${ARCHIVE} *.h *.cpp
53b149c1b9SMatthias Ringwald	cd ${BTSTACK_ROOT}/port/arduino      && zip -r $(ARCHIVE) examples
54b149c1b9SMatthias Ringwald	# all c files
55b149c1b9SMatthias Ringwald	zip --junk-paths ${ARCHIVE} ${PATHS}
568caefee3SMatthias Ringwald	cp ${ARCHIVE} btstack-arduino-latest.zip
57