Hello,

On 04/28/2011 12:16 AM, John Zavgren wrote:
Thanks for getting back to me... I'm still confused. I selected the
trivial package with the<*>  option.



Makefile ---------------------------
#
# Copyright (C) 2008 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=helloWorld
PKG_VERSION:=1.0
PKG_RELEASE:=1
PKG_INSTAL:=1
Without this, the install will not be processed (as I found out myself).
include $(INCLUDE_DIR)/package.mk

define Package/helloWorld
   SECTION:=base
   CATEGORY:=Base system
   TITLE:=Trivial test application
   DEPENDS:=+uci
endef

define Package/helloWorld/description
   Trivial Test Application
endef

define Build/Prepare
         mkdir -p $(PKG_BUILD_DIR)
         $(CP) ./src/* $(PKG_BUILD_DIR)
endef


define Package/helloWorld/install
         $(INSTALL_DIR) $(1)/usr/bin
         $(INSTALL_BIN) $(PKG_BUILD_DIR)/helloWorld $(1)/usr/bin
endef

When your install rule is executed in your own makefile, it has access to the variable $(DESTDIR) which points to what will be known as $(PKG_INSTALL_DIR) in the package Makefile. Thus, it's far easier to make the full install in $(DESTDIR) and to simply put this line in the Package/helloworld/install:

    $(CP) $(PKG_INSTALL_DIR)/* $(1)/

It helps to reduce redundancy in these makefiles (now, you only have to modify your own makefile if you change the setup of your project). I suggest you to do something similar for InstallDev if you use it. You also need an InstallDev, although it can be empty:

define Build/InstallDev
endef

$(eval $(call BuildPackage,helloWorld))
~
<snip>

Best regards,

-- Emmanuel (who hopes that his email client is configured correctly)

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to