#definition of system level variables BUILD_DIR, BIN_DIR, DL_DIR, PACKAGE_DIR......
     
include $(TOPDIR)/rules.mk

#definition of:
#   KernelPackage
#   AutoLoad
#   DownLoad
#   .....
include $(INCLUDE_DIR)/kernel.mk

#-------------------------------------------------------------------------------
#define your package name & version
#will create a folder in /build_dir/linux-vsc75xx/PKG_NAME-PKG_VERSION folder
#and copy source codes in /package/name/src to the folder for building the module
#the output will be a ipkg folder in the folder, package manager use the information
#in ipkg folder to create installation stuffs.
#PKG_NAME & PKG_VERSION must be defined before including pacakge.mk which references 
#them
#
PKG_NAME:=draysyslog
PKG_VERSION:=0.1
PKG_RELEASE:=1
#-------------------------------------------------------------------------------

include $(INCLUDE_DIR)/package.mk


# definition shared by all modules
define KernelPackage/draysyslog/Default
  SUBMENU:=Other modules
  TITLE:=dray syslog
  DEPENDS:=@LINUX_2_6 
endef

#definition of draysyslog.ko
define KernelPackage/draysyslog
$(call KernelPackage/draysyslog/Default)
  FILES:=$(PKG_BUILD_DIR)/binary/lib/modules/$(LINUX_VERSION)/draysyslog.$(LINUX_KMOD_SUFFIX)
  AUTOLOAD:=$(call AutoLoad,25,draysyslog)
endef





#
# variables to pass to make program, can be used by src/Makefile
# NOTE: do not have white space before and after "="
#
MY_EXTRA_KCONFIG:= 

#
#extra compile flags (-Ipath -Dflag ...) to be appended to $(CFLAGS)
#
MY_EXTRA_CFLAGS:= 


#
# canned command sequence for build preparation
#
define Build/Prepare
	#$(call Build/Prepare/Default)
	#$(CP) src/* $(PKG_BUILD_DIR)/
	@echo "Preparing...................."
endef

#
# canned command sequence for build configuration 
#
define Build/Configure
	@echo "Configuring..................."
endef

#
# canned command sequence for building
#
define Build/Compile
	@echo "Compiling..................."
	$(INSTALL_DIR) $(PKG_BUILD_DIR)/binary
	tar xzfO kmod-$(PKG_NAME)_$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE)_arm.ipk ./data.tar.gz | tar -C $(PKG_BUILD_DIR)/binary -xzf -
endef

#
#evaluate all variables we defined 
#
$(eval $(call KernelPackage,draysyslog))

