# 
# Copyright (C) 2006 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# $Id: Makefile,v 1.1.1.1 2006/07/18 09:55:10 silvano.dininno Exp $

include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk

PKG_NAME:=matisse
PKG_VERSION:=4.08.0
PKG_RELEASE:=1

PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_CAT:=zcat

PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install

include $(INCLUDE_DIR)/package.mk
#initialize SLIC FXO and SI3050 to no
SUPPORT_LEGERITY_FXO:=no
SUPPORT_SI3050:=no
SUPPORT_SLIC:=no
#If there is SLIC driver, activate feature on Matisse
ifeq ($(CONFIG_PACKAGE_kmod-legerity), y)
	SUPPORT_SLIC:=yes
ifeq ($(CONFIG_DEV_LEGERITY_FXO_ENABLE), y)
	SUPPORT_LEGERITY_FXO:=yes
endif
ifeq ($(CONFIG_PACKAGE_kmod-legerity-fxo), y)
	SUPPORT_LEGERITY_FXO:=yes
endif
else
ifeq ($(CONFIG_PACKAGE_kmod-si3215), y)
	SUPPORT_SLIC:=yes
else
ifeq ($(CONFIG_PACKAGE_kmod-proslic), y)
	SUPPORT_SLIC:=yes
endif
endif
endif
ifeq ($(CONFIG_PACKAGE_kmod-si3050), y)
	SUPPORT_SI3050:=yes
endif

ifeq ($(CONFIG_TARGET_comcerto1000),y)
	TARGET_NODE:=m83xxx0
else
	TARGET_NODE:=m821xx0
endif

define Package/matisse/Default
  CATEGORY:=Mindspeed Packages
  DESCRIPTION:=Matisse is a set of modules allowing telephony on Mindspeed boards.
  URL:=http://www.mindspeed.com/
  DEPENDS:=+msp-firmware +libargp
  PKG_BUILD_DEPENDS:=+libtool
endef

define Package/kmod-matisse
  $(call Package/matisse/Default)
  TITLE:=Matisse kernel modules
  MENU:=1
endef

define Package/kmod-matisse-pri
  $(call Package/matisse/Default)
  DEPENDS:=kmod-matisse kmod-matisse-gateway
  TITLE:=Matisse pri support
  DESCRIPTION+=\\\
  \\\
  This package is a driver allowing Matisse kernel modules to communicate with E1/T1 devices (BT8370).
endef

define Package/kmod-matisse-gateway
  $(call Package/matisse/Default)
  DEPENDS:=kmod-matisse
  TITLE:=Matisse gateway module
  DESCRIPTION+=\\\
  Module allowing Mindspeed Lerina Call Agent to communicate with Matisse kernel modules.
endef

#C_FLAGS=-DDEBUG_MSG
CPP_FLAGS=$(TARGET_CPPFLAGS) $(TARGET_LDFLAGS)

define Build/Compile
	@echo "Compiling..................."
	$(INSTALL_DIR) $(PKG_BUILD_DIR)/binary
	tar xzfO kmod-matisse_$(PKG_VERSION)-$(PKG_RELEASE)_arm.ipk ./data.tar.gz | tar -C $(PKG_BUILD_DIR)/binary -xzf -
endef


define Build/InstallDev
endef

define Build/UninstallDev
endef

define Package/kmod-matisse/install
	@echo "Install.................."
	$(CP) $(PKG_BUILD_DIR)/binary/* $(1)
endef

define Package/kmod-matisse-pri/install
endef

define Package/kmod-matisse-gateway/install
endef


$(eval $(call BuildPackage,kmod-matisse))
$(eval $(call BuildPackage,kmod-matisse-pri))
$(eval $(call BuildPackage,kmod-matisse-gateway))
