arduino: Makefile with release and install targets instead of packaging script

This commit is contained in:
Matthias Ringwald 2015-04-21 22:01:12 +02:00
parent ca1bb42005
commit 3c7c8efaca
2 changed files with 44 additions and 61 deletions

View File

@ -0,0 +1,44 @@
#
# Makefile to setup BTstack library in Arduino folder (OS X/Linux only) and create .zip archive
#
DIR=.
BTSTACK_ROOT=${DIR}/../..
DUMMY=$(shell )
VERSION=`sed -n -e 's/^.*BTSTACK_VERSION \"\(.*\)\"/\1/p' ${BTSTACK_ROOT}/include/btstack/version.h`
BTSTACK_PACKAGE=${DIR}/btstack
ARCHIVE=btstack-arduino-${VERSION}.zip
SRC_FILES =btstack_memory.c linked_list.c memory_pool.c run_loop.c run_loop_embedded.c
SRC_FILES +=hci_dump.c hci.c hci_cmds.c hci_transport_h4_dma.c sdp_util.c utils.c
BLE_FILES = ad_parser.c att.c att_server.c att_dispatch.c le_device_db_memory.c gatt_client.c
BLE_FILES += sm.c l2cap_le.c ancs_client_lib.h ancs_client_lib.c
PORT_FILES = btstack-config.h bsp_arduino_em9301.cpp BTstack.cpp BTstack.h
PATHS = $(addprefix ${BTSTACK_ROOT}/src/, ${SRC_FILES})
PATHS += $(wildcard ${BTSTACK_ROOT}/src/*.h)
PATHS += $(addprefix ${BTSTACK_ROOT}/ble/, ${BLE_FILES})
PATHS += $(wildcard ${BTSTACK_ROOT}/ble/*.h)
PATHS += $(wildcard ${BTSTACK_ROOT}/chipset-em9301/*)
PATHS += ${BTSTACK_ROOT}/include/btstack
PATHS += ${BTSTACK_ROOT}/platforms/arduino/examples
PATHS += $(addprefix ${DIR}/, ${PORT_FILES})
ARDUINO_LIBS=~/Documents/arduino/libraries/BTstack
all: release
update_version:
${BTSTACK_ROOT}/tools/get_version.sh
install:
rm -rf ${ARDUINO_LIBS}
mkdir ${ARDUINO_LIBS}
cp -r ${PATHS} ${ARDUINO_LIBS}
release: update_version
rm -rf ${BTSTACK_PACKAGE}
mkdir ${BTSTACK_PACKAGE}
cp -r ${PATHS} ${BTSTACK_PACKAGE}
rm -f ${ARCHIVE}
zip -r ${ARCHIVE} btstack

View File

@ -1,61 +0,0 @@
#!/bin/sh
DIR=`dirname $0`
BTSTACK_ROOT=$DIR/../..
BTSTACK_PACKAGE=$DIR/btstack
echo Update version.h file
$BTSTACK_ROOT/tools/get_version.sh
pushd .
cd $BTSTACK_ROOT
VERSION=`sed -n -e 's/^.*BTSTACK_VERSION \"\(.*\)\"/\1/p' include/btstack/version.h`
ARCHIVE=btstack-arduino-$VERSION.zip
popd
echo Prepare lib at $BTSTACK_PACKAGE
rm -rf $BTSTACK_PACKAGE
mkdir $BTSTACK_PACKAGE
# <btstack/...> headers
cp -r $BTSTACK_ROOT/include/btstack $BTSTACK_PACKAGE
# other headers
cp $BTSTACK_ROOT/ble/*.h $BTSTACK_PACKAGE
cp $BTSTACK_ROOT/src/*.h $BTSTACK_PACKAGE
# src files
SRC_FILES="btstack_memory.c linked_list.c memory_pool.c run_loop.c run_loop_embedded.c "
SRC_FILES+="hci_dump.c hci.c hci_cmds.c hci_transport_h4_dma.c sdp_util.c utils.c "
for i in $SRC_FILES
do
cp $BTSTACK_ROOT/src/$i $BTSTACK_PACKAGE
done
# ble files
BLE_FILES="ad_parser.c att.c att_server.c att_dispatch.c le_device_db_memory.c gatt_client.c "
BLE_FILES+="sm.c l2cap_le.c ancs_client_lib.h ancs_client_lib.c"
for i in $BLE_FILES
do
cp $BTSTACK_ROOT/ble/$i $BTSTACK_PACKAGE
done
# em9301 chipset support
cp $BTSTACK_ROOT/chipset-em9301/* $BTSTACK_PACKAGE
# Configuration
cp $DIR/btstack-config.h $BTSTACK_PACKAGE
# BSP Arduino
cp bsp_arduino_em9301.cpp $BTSTACK_PACKAGE
# Arduino c++ API
cp $DIR/BTstack.cpp $DIR/BTstack.h $BTSTACK_PACKAGE
# Arduino examples
cp -r $BTSTACK_ROOT/platforms/arduino/examples $BTSTACK_PACKAGE
echo "Create Archive $ARCHIVE"
rm -f $ARCHIVE btstack.zip
zip -r $ARCHIVE btstack