###############################################################################
#
# Siano Mobile Silicon, Inc. 
# MDTV receiver kernel modules. 
# Copyright (C) 2006-2010, Erez Cohen
# 
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# 
#  This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
# 
###############################################################################
#
#	File:		Makefile
#                                                                      
#	Brief:		Makefile for the Siano kernel objects (local only)
#
###############################################################################

#.PHONY:  all clean install

#KERNEL_DIR := /lib/modules/$(shell uname -r)/build
#KERNEL_DIR := /usr/src/linux-headers-3.2.0-4-686-pae
#KERNEL_SOURCES := /usr/src/linux-source-3.2


###############################################################################
# Siano driver modules configuration
###############################################################################

SMSOBJ := smscoreapi.o sms-cards.o smsendian.o smsir.o smschar.o smsdvb.o smsusb.o

EXTRA_CFLAGS := -DSMS_DVB3_SUBSYS -I$(KERNEL_DIR) -D__DVB_CORE__ -DSMS_USB_DRV

#ifeq ($(CONFIG_SMS_HOST_NET_SUBSYS),1)
#EXTRA_CFLAGS += -DSMS_NET_SUBSYS
#SMSOBJ += smsnet.o
#endif

#ifeq ($(CONFIG_SMS_HOST_USB_DRV),1)
#EXTRA_CFLAGS += -DSMS_USB_DRV
#SMSOBJ += smsusb.o
#endif

#ifeq ($(CONFIG_SMS_HOST_SDIO_DRV),1)
#EXTRA_CFLAGS += -DSMS_SDIO_DRV
#SMSOBJ += smssdio.o
#endif

#ifeq ($(CONFIG_SMS_HOST_SPI_PXA_DRV),1)
#EXTRA_CFLAGS += -DSMS_SPI_PXA310_DRV
#SMSOBJ += smsspidrv.o smsspicommon.o smsspiphy_pxa.o
#endif

#ifeq ($(CONFIG_SMS_HOST_I2C_DRV),1)
#EXTRA_CFLAGS += -DSMS_I2C_DRV
#SMSOBJ += smsi2c.o
#endif


# All selected in one module named smsmdtv
smsmdtv-objs := $(SMSOBJ)

obj-m := smsmdtv.o

#else

#include MakeEnv


###############################################################################
# Targets
###############################################################################

default: build

build:
	@echo "################################################"
	@echo "# Enviroment"
	@echo "################################################"
	@echo SOURCE_DIR = $(SOURCE_DIR)
	@echo KERNEL_DIR = $(KERNEL_DIR)
	@echo MODULES_DIR = $(MODULES_DIR)
	@echo UDEV_RULES_DIR = $(UDEV_RULES_DIR)
	@echo ARCH = $(ARCH) 
	@echo CROSS_COMPILE = $(CROSS_COMPILE)
	@echo "################################################"
	@echo "# Building Siano driver smsmdtv.ko"
	@echo "################################################"
	$(MAKE) -C $(KERNEL_DIR) M=$(PWD) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) modules

clean_pre clean:
	@echo "################################################"
	@echo "# Cleaning temporary files and symbolic links"
	@echo "################################################"
	rm -rf .sms* *.cmd smsmdtv.mod.* *.o module* Module* .tmp_versions *.ko

#install:
#	@echo "################################################"
#	@echo "# Installing driver to modules direcotry and"
#	@echo "# updating modules.dep"
#	@echo "################################################"
#	@cp -v 90-siano-ms.rules $(UDEV_RULES_DIR)
#	@mkdir -p $(MODULES_DIR)
#	@cp -v smsmdtv.ko $(MODULES_DIR)
#	depmod -a $(shell uname -r)
all: clean_pre build clean


#endif

