#################################################################################
# VlinkOS Makefile for blue-apply 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 device. #
# #
# 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
#################################################################################
# Name, version and release number #
# The name and version of your package are used to define the variable to point #
# to the build directory of your package: $(PKG_BUILD_DIR) #
#################################################################################
PKG_NAME:=libCodec
PKG_VERSION:=1.0
PKG_RELEASE:=1
#################################################################################
# Source settings (i.e. where to find the source codes) #
# This is a custom variable, used below #
#################################################################################
SOURCE_DIR:=./src
include $(INCLUDE_DIR)/package.mk
#################################################################################
# Package definition; instructs on how and where our package will appear #
# in the overall configuration menu ('make menuconfig') #
#################################################################################
define Package/libCodec
SECTION:=utils
CATEGORY:=Utilities
TITLE:=libCodec -- The libCodec for the code to encode or decode
endef
#################################################################################
# Package description; a more verbose description on what our package does. #
#################################################################################
define Package/libCodec/description
The libCodec for the code to encode or decode.
endef
#################################################################################
# Package preparation instructions; create the build directory #
# and copy the source code. #
# The last command is necessary to ensure our preparation instructions #
# remain compatible with the patching system. #
#################################################################################
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) $(SOURCE_DIR)/* $(PKG_BUILD_DIR)
$(Build/Patch)
endef
#################################################################################
# Package build instructions; invoke the target-specific compiler to first #
# compile the source file, and then to link the file into the final executable #
# We do not need to define Build/Configure or Build/Compile directives #
# The defaults are appropriate for compiling a simple program such as this one #
#################################################################################
#define Build/Compile
# $(TARGET_CC) $(TARGET_CFLAGS) -o $(PKG_BUILD_DIR)/helloworld.o -c $(PKG_BUILD_DIR)/helloworld.c
# $(TARGET_CC) $(TARGET_LDFLAGS) -o $(PKG_BUILD_DIR)/$1 $(PKG_BUILD_DIR)/helloworld.o
#endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/lib $(1)/usr/include
$(CP) $(PKG_BUILD_DIR)/*.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/libCodec.so $(1)/usr/lib/
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 device. The $(1) variable represents the root directory on the device #
# running VlinkOS. 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 Package/libCodec/install
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_BIN) $(PKG_BUILD_DIR)/libCodec.so $(1)/usr/lib/
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,libCodec))
阅读(4468) | 评论(0) | 转发(0) |