#################################################
# config
VERS=0.5.7

# My Trust card has the i2c lines SDA and SCL exchanged.
# undefine the following line if your card doesn't. This
# values can also be set at modprobe-time by the `swapi2c'
# variable.
SWAPI2C=1

# My Trust card delivers a vertical-sync interrupts on
# GIRQ1. If your card delivers vertical-sync interrupts
# on GIRQ0, replace the 1 by a 0. These values can also
# be set at modprobe-time by `usegirq' variable.
USEGIRQ=1

# currently running kernel
CURRENT=$(shell uname -r)

# where the kernel sources are located
#KERNEL_LOCATION=/usr/src/kernel/2.0.35
#KERNEL_LOCATION=/usr/src/kernel/$(CURRENT)
#KERNEL_LOCATION=/usr/src/kernel/vger
KERNEL_LOCATION=/usr/src/linux

#################################################
# some magic for using linux kernel settings
# when compiling module(s)

O_TARGET     = zoran.o
O_OBJS       = zr36120.o zr36120_i2c.o common.o
M_OBJS       = zoran.o saa7110.o saa7111.o saa7185.o
MX_OBJS      = 
EXTRA_CFLAGS = -DSWAPI2C=$(SWAPI2C) -DUSEGIRQ=$(USEGIRQ)

here:
		DIR=`pwd`; (cd $(KERNEL_LOCATION); make SUBDIRS=$$DIR modules)

dep:
		DIR=`pwd`; (cd $(KERNEL_LOCATION); make SUBDIRS=$$DIR dep)

dist:		clean
		-mkdir zoran-$(VERS)
		cp -a COPYING ChangeLog README TODO INFO Makefile linux *.h *.c zoran-$(VERS)
		tar cvfhz zoran-$(VERS).tar.gz zoran-$(VERS)
		rm -rf zoran-$(VERS)
install:
		su -c "cp -v $(M_OBJS) $(MX_OBJS) /lib/modules/$(CURRENT)/misc"

clean:
		-rm -f $(O_OBJS) $(M_OBJS) $(MX_OBJS) .*.o.flags *~

include $(KERNEL_LOCATION)/Rules.make
