Hi All,
I'm creating my own testing library, but the openwrt build system did not help me to create the libhello.provides. Any wrong with my Makefile? Please correct me. Thanks.
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:=libhello
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')
# If you use C++, need to add DEPENDS+=libstdcpp
define Package/$(PKG_NAME)
SECTION:=libs
SUBMENU:=Library
CATEGORY:=Liteon
TITLE:=Hello, Library!
DEPENDS:=+libstdcpp
endef
# Package description; a more verbose description on what our package does
define Package/$(PKG_NAME)/description
A simple "Hello, world!" library.
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)
rsync -a $(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
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) \
CC="$(TARGET_CC)" \
CXX="$(TARGET_CXX)" \
CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(FPIC)" \
LDFLAGS="$(TARGET_LDFLAGS)"
endef
# Package install instructions; create a directory inside the package to hold headers and library
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include
$(CP) $(PKG_BUILD_DIR)/hello.h $(1)/usr/include/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/libhello.so $(1)/usr/lib/
$(LN) libhello.so $(1)/usr/lib/libhello.so.$(PKG_VERSION)
$(LN) libhello.so $(1)/usr/lib/libhello.so.$(PKG_RELEASE)
endef
# This command is always the last, it uses the definitions and variables we give above in order to get the job done
$(eval $(call BuildPackage,$(PKG_NAME)))