283 lines
9.5 KiB
Makefile
Executable File
283 lines
9.5 KiB
Makefile
Executable File
##############################################
|
|
# OpenWrt Makefile for helloworld program
|
|
#
|
|
#
|
|
# Most of the variables used here are defined in
|
|
# the include directives below. We just need to
|
|
# specify a basic description of the package,
|
|
# where to build our program, where to find
|
|
# the source files, and where to install the
|
|
# compiled program on the router.
|
|
#
|
|
# Be very careful of spacing in this file.
|
|
# Indents should be tabs, not spaces, and
|
|
# there should be no trailing whitespace in
|
|
# lines that are not commented.
|
|
#
|
|
##############################################
|
|
include $(TOPDIR)/rules.mk
|
|
include $(TINA_BUILD_TOP)/package/netease/Makefile.common
|
|
|
|
# Name and release number of this package
|
|
PKG_NAME:=bluetooth
|
|
PKG_VERSION:=0.0.1
|
|
PKG_RELEASE:=1
|
|
|
|
export ARMGCC=$(TARGET_CC)
|
|
|
|
# This specifies the directory where we're going to build the program.
|
|
# The root build directory, $(BUILD_DIR), is by default the build_mipsel
|
|
# directory in your OpenWrt SDK directory
|
|
|
|
include $(BUILD_DIR)/package.mk
|
|
|
|
# Specify package information for this program.
|
|
# The variables defined here should be self explanatory.
|
|
# If you are running Kamikaze, delete the DESCRIPTION
|
|
# variable below and uncomment the Kamikaze define
|
|
# directive for the description below
|
|
define Package/bluetooth/Default
|
|
SECTION:=utils
|
|
CATEGORY:=Allwinner
|
|
TITLE:=Bluetooth APP(bsa 01062)
|
|
DEPENDS:=+libuci +resample +librt +alsa-lib +libspeex-lite +libspeex +libstdcpp +liballwinner-base $(MAKE_COMMON_DEPEND)
|
|
local_LDFLAGS := -ldbus-1 -luv -lcrypto -lcjson -lsqlite3 -ls2json -lallwinner-base -lcurl
|
|
endef
|
|
|
|
define Package/bluetooth
|
|
$(call Package/bluetooth/Default)
|
|
MENU:=1
|
|
DEFAULT:=1
|
|
endef
|
|
|
|
define Package/bluetooth-demo
|
|
$(call Package/bluetooth/Default)
|
|
TITLE:=BT app demo
|
|
DEPENDS:=+bluetooth +libstdcpp +libstdcpp +liballwinner-base
|
|
local_demo_LDFLAGS := -ldbus-1 -luv -lcrypto -lcjson -lsqlite3 -ls2json -lallwinner-base -lcurl
|
|
endef
|
|
|
|
define Package/bluetooth-smartaudio
|
|
$(call Package/bluetooth/Default)
|
|
TITLE:=netease Bluetooth module
|
|
DEPENDS:=+bluetooth +libstdcpp +libstdcpp +liballwinner-base +rftest $(MAKE_COMMON_DEPEND)
|
|
local_demo_LDFLAGS := -ldbus-1 -luv -lcrypto -lcjson -lsqlite3 -ls2json -lallwinner-base -lcurl
|
|
endef
|
|
|
|
define Package/bluetooth/description
|
|
Bluetooth API
|
|
endef
|
|
|
|
define Package/bluetooth-demo/description
|
|
Bluetooth app demo
|
|
endef
|
|
|
|
define Package/bluetooth-smartaudio/description
|
|
netease smartaudio bluetooth
|
|
endef
|
|
|
|
|
|
define Build/Prepare
|
|
mkdir -p $(PKG_BUILD_DIR)
|
|
$(CP) ./3rdparty/ $(PKG_BUILD_DIR)/
|
|
endef
|
|
|
|
define Build/Configure
|
|
endef
|
|
|
|
define Build/Compile
|
|
#compile libbtapp
|
|
$(MAKE) -C $(PKG_BUILD_DIR)/3rdparty/embedded/bsa_examples/linux/libbtapp/build \
|
|
-f Makefile \
|
|
ENABLE_ALSA=TRUE \
|
|
CPU=arm \
|
|
CC="$(TARGET_CC)" \
|
|
CXX="$(TARGET_CXX)" \
|
|
CFLAGS="$(TARGET_CFLAGS)"\
|
|
LDFLAGS="$(TARGET_LDFLAGS)" \
|
|
$(local_demo_LDFLAGS) \
|
|
CONFIG_PREFIX="$(PKG_INSTALL_DIR)" \
|
|
STRIP="$(STRIP)" \
|
|
all
|
|
|
|
#compile bt_demo
|
|
$(MAKE) -C $(PKG_BUILD_DIR)/3rdparty/embedded/bsa_examples/linux/libbtapp/bt_test \
|
|
-f Makefile \
|
|
CC="$(TARGET_CC)" \
|
|
CXX="$(TARGET_CXX)" \
|
|
CFLAGS="$(TARGET_CFLAGS)"\
|
|
LDFLAGS="$(TARGET_LDFLAGS)" \
|
|
$(local_demo_LDFLAGS) \
|
|
CONFIG_PREFIX="$(PKG_INSTALL_DIR)" \
|
|
all
|
|
$(STRIP) $(PKG_BUILD_DIR)/3rdparty/embedded/bsa_examples/linux/libbtapp/bt_test/bt_test
|
|
$(STRIP) $(PKG_BUILD_DIR)/3rdparty/embedded/bsa_examples/linux/libbtapp/bt_test/bt_connect_disconnect_test
|
|
|
|
|
|
#compile appManager
|
|
|
|
$(MAKE) -C $(PKG_BUILD_DIR)/3rdparty/embedded/bsa_examples/linux/app_manager/build \
|
|
-f Makefile \
|
|
ENABLE_ALSA=TRUE \
|
|
CPU=arm \
|
|
CC="$(TARGET_CC)" \
|
|
CXX="$(TARGET_CXX)" \
|
|
CFLAGS="$(TARGET_CFLAGS)"\
|
|
LDFLAGS="$(TARGET_LDFLAGS)" \
|
|
$(local_LDFLAGS) \
|
|
CONFIG_PREFIX="$(PKG_INSTALL_DIR)" \
|
|
STRIP="$(STRIP)" \
|
|
all
|
|
|
|
|
|
|
|
#compile appManager
|
|
$(MAKE) -C $(PKG_BUILD_DIR)/3rdparty/embedded/bsa_examples/linux/app_ble_usr/build \
|
|
-f Makefile \
|
|
ENABLE_ALSA=TRUE \
|
|
CPU=arm \
|
|
CC="$(TARGET_CC)" \
|
|
CXX="$(TARGET_CXX)" \
|
|
CFLAGS="$(TARGET_CFLAGS)"\
|
|
LDFLAGS="$(TARGET_LDFLAGS)" \
|
|
CONFIG_PREFIX="$(PKG_INSTALL_DIR)" \
|
|
STRIP="$(STRIP)" \
|
|
all
|
|
|
|
#compile app_ble
|
|
$(MAKE) -C $(PKG_BUILD_DIR)/3rdparty/embedded/bsa_examples/linux/app_ble/build \
|
|
-f Makefile \
|
|
ENABLE_ALSA=TRUE \
|
|
CPU=arm \
|
|
CC="$(TARGET_CC)" \
|
|
CXX="$(TARGET_CXX)" \
|
|
CFLAGS="$(TARGET_CFLAGS)"\
|
|
LDFLAGS="$(TARGET_LDFLAGS)" \
|
|
CONFIG_PREFIX="$(PKG_INSTALL_DIR)" \
|
|
STRIP="$(STRIP)" \
|
|
all
|
|
|
|
|
|
|
|
|
|
#strip bsa_server
|
|
$(STRIP) $(PKG_BUILD_DIR)/3rdparty/embedded/bsa_examples/linux/server/build/arm/bsa_server
|
|
|
|
$(STRIP) $(PKG_BUILD_DIR)/3rdparty/embedded/bsa_examples/linux/libbtapp/bt_test/bt_discovery_test
|
|
|
|
#copy bsa_server and apps
|
|
$(CP) -r $(PKG_BUILD_DIR)/3rdparty/embedded/bsa_examples/linux/libbtapp/build/bsa_server $(PKG_BUILD_DIR)/
|
|
$(CP) -r $(PKG_BUILD_DIR)/3rdparty/embedded/bsa_examples/linux/libbtapp/bt_test/bt_test $(PKG_BUILD_DIR)/
|
|
$(CP) -r $(PKG_BUILD_DIR)/3rdparty/embedded/bsa_examples/linux/libbtapp/bt_test/bt_connect_disconnect_test $(PKG_BUILD_DIR)/
|
|
$(CP) -r $(PKG_BUILD_DIR)/3rdparty/embedded/bsa_examples/linux/libbtapp/bt_test/bt_change_phone_vol $(PKG_BUILD_DIR)/
|
|
$(CP) -r $(PKG_BUILD_DIR)/3rdparty/embedded/bsa_examples/linux/libbtapp/bt_test/bt_discovery_test $(PKG_BUILD_DIR)/
|
|
$(CP) -r $(PKG_BUILD_DIR)/3rdparty/embedded/bsa_examples/linux/libbtapp/bt_test/ble_test $(PKG_BUILD_DIR)/
|
|
$(CP) -r $(PKG_BUILD_DIR)/3rdparty/embedded/bsa_examples/linux/libbtapp/bt_test/bt_ble_test $(PKG_BUILD_DIR)/
|
|
|
|
|
|
#copy app_manager
|
|
$(CP) -r $(PKG_BUILD_DIR)/3rdparty/embedded/bsa_examples/linux/app_manager/build/arm/app_manager $(PKG_BUILD_DIR)/
|
|
|
|
#copy app_ble_usr
|
|
$(CP) -r $(PKG_BUILD_DIR)/3rdparty/embedded/bsa_examples/linux/app_ble_usr/build/arm/app_ble_usr $(PKG_BUILD_DIR)/
|
|
|
|
#copy app_ble
|
|
$(CP) -r $(PKG_BUILD_DIR)/3rdparty/embedded/bsa_examples/linux/app_ble/build/arm/app_ble $(PKG_BUILD_DIR)/
|
|
|
|
|
|
|
|
endef
|
|
|
|
# Specify where and how to install the program. Since we only have one file,
|
|
# the helloworld executable, install it by copying it to the /bin directory on
|
|
# the router. The $(1) variable represents the root directory on the router running
|
|
# OpenWrt. The $(INSTALL_DIR) variable contains a command to prepare the install
|
|
# directory if it does not already exist. Likewise $(INSTALL_BIN) contains the
|
|
# command to copy the binary file from its current location (in our case the build
|
|
# directory) to the install directory.
|
|
define Build/InstallDev
|
|
$(INSTALL_DIR) $(1)/usr/lib
|
|
$(INSTALL_DIR) $(1)/usr/include
|
|
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libbsa.so $(1)/usr/lib
|
|
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libbtapp.so $(1)/usr/lib
|
|
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include
|
|
endef
|
|
|
|
define Package/bluetooth/install
|
|
$(INSTALL_DIR) $(1)/etc/bluetooth
|
|
$(INSTALL_DIR) $(1)/usr/lib
|
|
$(INSTALL_DIR) $(1)/usr/bin
|
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bsa_server $(1)/usr/bin/
|
|
$(INSTALL_BIN) ./btenable.sh $(1)/etc/bluetooth/
|
|
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libbsa.so $(1)/usr/lib
|
|
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libbtapp.so $(1)/usr/lib
|
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/app_manager $(1)/usr/bin/
|
|
endef
|
|
|
|
define Package/bluetooth-demo/install
|
|
$(INSTALL_DIR) $(1)/usr/bin
|
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bt_test $(1)/usr/bin/
|
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bt_connect_disconnect_test $(1)/usr/bin/
|
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bt_change_phone_vol $(1)/usr/bin/
|
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bt_discovery_test $(1)/usr/bin/
|
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ble_test $(1)/usr/bin/
|
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bt_ble_test $(1)/usr/bin/
|
|
|
|
#install app_manager
|
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/app_manager $(1)/usr/bin/
|
|
#install app_ble
|
|
#$(INSTALL_BIN) $(PKG_BUILD_DIR)/app_ble $(1)/usr/bin/
|
|
endef
|
|
|
|
define Package/bluetooth-smartaudio/install
|
|
#compile app_nevsps
|
|
$(MAKE) -C $(PKG_BUILD_DIR)/3rdparty/embedded/bsa_examples/linux/app_nevsps/build \
|
|
-f Makefile \
|
|
ENABLE_ALSA=TRUE \
|
|
CPU=arm \
|
|
CC="$(TARGET_CC)" \
|
|
CXX="$(TARGET_CXX)" \
|
|
LDFLAGS="$(TARGET_LDFLAGS)" \
|
|
CFLAGS="$(TARGET_CFLAGS)"\
|
|
CONFIG_PREFIX="$(PKG_INSTALL_DIR)" \
|
|
STRIP="$(STRIP)" \
|
|
all
|
|
|
|
#compile bt_demo
|
|
$(MAKE) -C $(PKG_BUILD_DIR)/3rdparty/embedded/bsa_examples/linux/libbtapp/smartaudio \
|
|
-f Makefile \
|
|
CC="$(TARGET_CC)" \
|
|
CXX="$(TARGET_CXX)" \
|
|
CFLAGS="$(TARGET_CFLAGS)"\
|
|
LDFLAGS="$(TARGET_LDFLAGS)" \
|
|
$(local_demo_LDFLAGS) \
|
|
CONFIG_PREFIX="$(PKG_INSTALL_DIR)" \
|
|
all
|
|
|
|
#copy app_nevsps
|
|
$(CP) -r $(PKG_BUILD_DIR)/3rdparty/embedded/bsa_examples/linux/app_nevsps/build/arm/app_nevsps $(PKG_BUILD_DIR)/
|
|
$(CP) -r $(PKG_BUILD_DIR)/3rdparty/embedded/bsa_examples/linux/libbtapp/smartaudio/app_nevsps_bt $(PKG_BUILD_DIR)/
|
|
$(CP) -r $(PKG_BUILD_DIR)/3rdparty/embedded/bsa_examples/linux/libbtapp/smartaudio/app_nevsps_demo $(PKG_BUILD_DIR)/
|
|
#copy app_nevsps
|
|
$(CP) -r $(PKG_BUILD_DIR)/3rdparty/embedded/bsa_examples/linux/app_nevsps/build/arm/app_nevsps $(PKG_BUILD_DIR)/
|
|
|
|
$(INSTALL_DIR) $(1)/usr/bin
|
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/app_nevsps_bt $(1)/usr/bin/
|
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/app_nevsps_demo $(1)/usr/bin/
|
|
|
|
#install app_manager
|
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/app_manager $(1)/usr/bin/
|
|
|
|
#install app_nevsps
|
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/app_nevsps $(1)/usr/bin/
|
|
endef
|
|
|
|
# This line executes the necessary commands to compile our program.
|
|
# The above define directives specify all the information needed, but this
|
|
# line calls BuildPackage which in turn actually uses this information to
|
|
# build a package.
|
|
|
|
$(eval $(call BuildPackage,bluetooth))
|
|
$(eval $(call BuildPackage,bluetooth-demo))
|
|
$(eval $(call BuildPackage,bluetooth-smartaudio))
|