xref: /btstack/port/arduino/Makefile (revision b149c1b9276b0e9d738e8038776af3dded42725e)
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=.
6*b149c1b9SMatthias 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
10*b149c1b9SMatthias RingwaldARCHIVE=$(BTSTACK_ROOT)/btstack-arduino-${VERSION}.zip
118caefee3SMatthias Ringwald
12*b149c1b9SMatthias RingwaldSRC_C_FILES  = btstack_memory.c btstack_linked_list.c btstack_memory_pool.c btstack_run_loop.c btstack_crypto.c
13*b149c1b9SMatthias 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
14*b149c1b9SMatthias RingwaldBLE_C_FILES  = att_db.c att_server.c att_dispatch.c att_db_util.c le_device_db_memory.c gatt_client.c
15*b149c1b9SMatthias RingwaldBLE_C_FILES += sm.c att_db_util.c
16*b149c1b9SMatthias RingwaldBLE_GATT_C_FILES = ancs_client.c
17*b149c1b9SMatthias RingwaldPORT_C_FILES = bsp_arduino_em9301.cpp BTstack.cpp
18*b149c1b9SMatthias RingwaldEMBEDDED_C_FILES = btstack_run_loop_embedded.c btstack_uart_block_embedded.c hci_dump_embedded_stdout.c
19*b149c1b9SMatthias RingwaldEM9301_C_FILES = btstack_chipset_em9301.c
208caefee3SMatthias Ringwald
21*b149c1b9SMatthias RingwaldPATHS  = $(addprefix ${BTSTACK_ROOT}/src/,     ${SRC_C_FILES})
22*b149c1b9SMatthias RingwaldPATHS += $(addprefix ${BTSTACK_ROOT}/src/ble/, ${BLE_C_FILES})
23*b149c1b9SMatthias RingwaldPATHS += $(addprefix ${BTSTACK_ROOT}/src/ble/gatt-service/, ${BLE_GATT_FILES})
24*b149c1b9SMatthias RingwaldPATHS += $(addprefix ${BTSTACK_ROOT}/platform/embedded/,    ${EMBEDDED_C_FILES})
25*b149c1b9SMatthias RingwaldPATHS += $(addprefix ${BTSTACK_ROOT}/chipset/em9301/,       ${EM9301_C_FILES})
268caefee3SMatthias RingwaldPATHS += $(addprefix ${DIR}/, ${PORT_FILES})
27*b149c1b9SMatthias 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}
42*b149c1b9SMatthias Ringwald	cd ${ARDUINO_LIBS} && unzip ${ARCHIVE}
438caefee3SMatthias Ringwald
448caefee3SMatthias Ringwaldrelease: update_version
458caefee3SMatthias Ringwald	rm -f ${ARCHIVE}
46*b149c1b9SMatthias Ringwald	cd ${BTSTACK_ROOT}/chipset/em9301    && zip    $(ARCHIVE) *.h
47*b149c1b9SMatthias Ringwald	cd ${BTSTACK_ROOT}/platform/embedded && zip    $(ARCHIVE) *.h
48*b149c1b9SMatthias Ringwald	cd ${BTSTACK_ROOT}/src 				 && zip    $(ARCHIVE) *.h ble/*.h ble/gatt-service/*.h
49*b149c1b9SMatthias Ringwald	# remove the duplicate BTstack.h
50*b149c1b9SMatthias Ringwald	zip -d ${ARCHIVE} btstack.h
51*b149c1b9SMatthias Ringwald	# port specific files
52*b149c1b9SMatthias Ringwald	zip ${ARCHIVE} *.h *.cpp
53*b149c1b9SMatthias Ringwald	cd ${BTSTACK_ROOT}/port/arduino      && zip -r $(ARCHIVE) examples
54*b149c1b9SMatthias Ringwald	# all c files
55*b149c1b9SMatthias Ringwald	zip --junk-paths ${ARCHIVE} ${PATHS}
568caefee3SMatthias Ringwald	cp ${ARCHIVE} btstack-arduino-latest.zip
57