2015-02-06 09:40:12 +00:00
|
|
|
# Toolchain config
|
2015-05-11 13:41:35 +00:00
|
|
|
NDK = /Projects/Android/android-ndk-r10d
|
2015-02-06 09:40:12 +00:00
|
|
|
ADB = adb
|
2015-05-11 13:41:35 +00:00
|
|
|
TOOLCHAIN = /usr/local/android-ndk
|
2015-02-06 09:40:12 +00:00
|
|
|
SYSROOT = $(TOOLCHAIN)/sysroot
|
|
|
|
GCC = $(TOOLCHAIN)/bin/arm-linux-androideabi-gcc
|
|
|
|
STRIP = $(TOOLCHAIN)/bin/arm-linux-androideabi-strip
|
2016-11-16 10:03:16 +00:00
|
|
|
CFLAGS = -march=armv7-a -mfloat-abi=softfp -I$(SYSROOT)/usr/include -fpie -fpic -fPIE -pie#
|
|
|
|
LDFLAGS = -Wl,--fix-cortex-a8 -L$(SYSROOT)/usr/lib -fpie -fpic -fPIE -pie
|
2015-02-06 09:40:12 +00:00
|
|
|
|
|
|
|
BTSTACK_ROOT = ../..
|
|
|
|
|
|
|
|
CFLAGS += -I$(BTSTACK_ROOT)/include
|
|
|
|
CFLAGS += -I$(BTSTACK_ROOT)/src/
|
|
|
|
CFLAGS += -I$(BTSTACK_ROOT)/ble
|
2016-02-19 09:33:52 +00:00
|
|
|
CFLAGS += -I$(BTSTACK_ROOT)/platform/daemon/src
|
2016-01-20 13:20:47 +00:00
|
|
|
CFLAGS += -I$(BTSTACK_ROOT)/platform/posix
|
2015-02-06 09:40:12 +00:00
|
|
|
CFLAGS += -I.
|
|
|
|
|
|
|
|
VPATH += $(BTSTACK_ROOT)/src
|
2015-11-13 14:04:41 +00:00
|
|
|
VPATH += $(BTSTACK_ROOT)/src/ble
|
|
|
|
VPATH += $(BTSTACK_ROOT)/src/classic
|
2016-01-20 13:20:47 +00:00
|
|
|
VPATH += $(BTSTACK_ROOT)/platform/posix
|
2016-02-19 09:33:52 +00:00
|
|
|
VPATH += $(BTSTACK_ROOT)/platform/daemon/src
|
|
|
|
VPATH += $(BTSTACK_ROOT)/platform/daemon/example
|
|
|
|
|
|
|
|
libBTstack_OBJS = \
|
|
|
|
btstack.o \
|
|
|
|
btstack_linked_list.o \
|
|
|
|
btstack_run_loop.o \
|
|
|
|
btstack_run_loop_posix.o \
|
|
|
|
btstack_util.o \
|
|
|
|
hci_cmd.o \
|
|
|
|
daemon_cmds.o \
|
|
|
|
hci_dump.o \
|
|
|
|
sdp_util.o \
|
2016-03-28 09:56:32 +00:00
|
|
|
spp_server.o \
|
2016-02-19 09:33:52 +00:00
|
|
|
socket_connection.o \
|
|
|
|
|
|
|
|
BTdaemon_OBJS = $(libBTstack_OBJS) \
|
2017-05-17 21:22:05 +00:00
|
|
|
ad_parser.o \
|
2016-02-19 09:33:52 +00:00
|
|
|
att_dispatch.o \
|
|
|
|
btstack_link_key_db_memory.o \
|
|
|
|
btstack_memory.o \
|
|
|
|
btstack_memory_pool.o \
|
|
|
|
daemon.o \
|
|
|
|
gatt_client.o \
|
|
|
|
hci.o \
|
|
|
|
hci_transport_h4_mtk.o \
|
2016-04-20 21:27:58 +00:00
|
|
|
btstack_uart_block_posix.o \
|
2016-02-19 09:33:52 +00:00
|
|
|
l2cap.o \
|
|
|
|
l2cap_signaling.o \
|
|
|
|
le_device_db_memory.o \
|
|
|
|
rfcomm.o \
|
|
|
|
rfcomm_service_db_hash.o \
|
|
|
|
sdp_server.o \
|
|
|
|
sm.o \
|
|
|
|
att_db.o \
|
|
|
|
att_server.o \
|
|
|
|
sdp_client.o \
|
2016-04-20 21:27:58 +00:00
|
|
|
sdp_client_rfcomm.o \
|
2015-02-06 09:40:12 +00:00
|
|
|
|
2016-01-21 20:20:22 +00:00
|
|
|
all: $(TOOLCHAIN) version BTstackDaemon libBTstack.so BTstackDaemonRespawn inquiry le_scan rfcomm_echo dist
|
2015-02-06 09:40:12 +00:00
|
|
|
|
|
|
|
dist:
|
|
|
|
rm -f *.o
|
|
|
|
|
|
|
|
clean:
|
2016-01-21 20:20:22 +00:00
|
|
|
rm -f BTstackDaemon BTstackDaemonRespawn le_scan inquiry rfcomm_echo *.so *.o
|
2015-02-06 09:40:12 +00:00
|
|
|
|
|
|
|
$(TOOLCHAIN):
|
|
|
|
$(NDK)/build/tools/make-standalone-toolchain.sh --install-dir=$@
|
|
|
|
|
2016-01-21 14:47:16 +00:00
|
|
|
libbluetoothdrv.so: bluetoothdrv_stub.o
|
|
|
|
$(GCC) $(LDFLAGS) -shared -o libbluetoothdrv.so bluetoothdrv_stub.o
|
2015-02-06 09:40:12 +00:00
|
|
|
|
|
|
|
.c.o:
|
|
|
|
$(GCC) $(CFLAGS) -o $@ -c $<
|
|
|
|
|
|
|
|
install:
|
|
|
|
./installer.sh
|
|
|
|
|
|
|
|
run:
|
|
|
|
$(ADB) shell le_scan
|
|
|
|
|
|
|
|
shell:
|
|
|
|
$(ADB) shell
|
|
|
|
|
2015-04-10 07:44:07 +00:00
|
|
|
version:
|
2015-11-13 14:04:41 +00:00
|
|
|
$(BTSTACK_ROOT)/tool/get_version.sh
|
2016-02-19 09:33:52 +00:00
|
|
|
grep BTSTACK_DATE $(BTSTACK_ROOT)/platform/daemon/src/btstack_version.h
|
2015-04-10 07:44:07 +00:00
|
|
|
|
|
|
|
BTstackDaemon: $(BTdaemon_OBJS) libbluetoothdrv.so
|
2015-02-06 09:40:12 +00:00
|
|
|
$(GCC) $(LDFLAGS) -o $@ libbluetoothdrv.so $^
|
|
|
|
|
|
|
|
BTstackDaemonRespawn: BTstackDaemonRespawn.o
|
|
|
|
$(GCC) $(LDFLAGS) -o $@ BTstackDaemonRespawn.o
|
|
|
|
|
|
|
|
|
|
|
|
libBTstack.so: $(libBTstack_OBJS)
|
|
|
|
$(GCC) $(LDFLAGS) -shared -Wl,-soname,/system/lib/libBTstack.so -o $@ $^
|
|
|
|
|
|
|
|
inquiry: inquiry.o
|
2015-04-03 20:20:11 +00:00
|
|
|
$(GCC) $(LDFLAGS) -Wl,-rpath,/system/lib libBTstack.so -o $@ inquiry.o
|
2015-02-06 09:40:12 +00:00
|
|
|
|
2016-01-21 20:20:22 +00:00
|
|
|
rfcomm_echo: rfcomm_echo.o
|
|
|
|
$(GCC) $(LDFLAGS) -Wl,-rpath,/system/lib libBTstack.so -o $@ rfcomm_echo.o
|
2015-02-06 09:40:12 +00:00
|
|
|
|
|
|
|
le_scan: le_scan.o
|
2015-04-03 20:20:11 +00:00
|
|
|
$(GCC) $(LDFLAGS) -Wl,-rpath,/system/lib libBTstack.so -o $@ le_scan.o
|
2015-02-06 09:40:12 +00:00
|
|
|
|
|
|
|
# minimal_peripheral: minimal_peripheral.o
|
|
|
|
# $(GCC) $(LDFLAGS) libs/libbluetoothdrv.so -o $@ minimal_peripheral.o
|
|
|
|
|
|
|
|
hci_dump:
|
2015-04-10 07:44:07 +00:00
|
|
|
killall PacketLogger
|
2015-02-06 09:40:12 +00:00
|
|
|
$(ADB) shell su root chmod 666 /data/btstack/hci_dump.pklg
|
|
|
|
$(ADB) pull /data/btstack/hci_dump.pklg 2> /dev/null
|
|
|
|
open hci_dump.pklg
|
|
|
|
|
2015-04-10 07:44:07 +00:00
|
|
|
log: hci_dump
|