# Makefile for the tiusb driver (Texas Instruments' BlackLink cable or 
# home-made serial link cable)
# (w) 6/2001, Romain Lievin <rlievin@mail.com>

PREFIX = /usr
INCLUDEDIR = $(PREFIX)/include
KDIR := /usr/src/linux
KVERS := $(shell uname -r)

TARGETS := Rules.make arch tiusb.o
.PHONY: tiusb.o

default: $(TARGETS)


Rules.make: $(KDIR)/Rules.make
	cp -pf $(KDIR)/Rules.make .

arch: $(KDIR)/arch
	rm -f arch
	ln -s $(KDIR)/arch .

clean:
	rm -f $(TARGETS)
	rm -f *.o core *~ \#*

tiusb.o:
	$(MAKE) -f Makefile.tiusb KDIR=$(KDIR)

install:
	$(MAKE) -f Makefile.tiusb KDIR=$(KDIR) KVERS=$(KVERS) install_mod

load:
	$(MAKE) -f Makefile.tiusb KDIR=$(KDIR) load_module

unload:
	rmmod tiusb

dist: clean
	mkdir /tmp/tiusblink-$(VERSION) ; cp -r ../* /tmp/tiusblink-$(VERSION)
	cd /tmp ; tar cvf - tiusblink-$(VERSION) | \
	gzip > tiusblink-$(VERSION).tar.gz

# Old Makefile, for backwards compatibility

insmod: tiusb.o
	insmod tiusb.o

rmmod:
	rmmod tiusb

reins: tiusb.o
	rmmod tiusb
	insmod tiusb.o

read:
	#cat /dev/usb/tigl0
	dd bs=1 count=4 < /dev/usb/tigl0

write:
	cat seq.txt > /dev/usb/tigl0

rw:
	cat seq.txt > /dev/usb/tigl0
	cat /dev/usb/tigl0 > res.txt

nodes:	
	rm -f /dev/tigl?
	mknod -m 666 /dev/tigl0 c 61 225
	mknod -m 666 /dev/tigl1 c 61 226
	mknod -m 666 /dev/tigl2 c 61 227
	mknod -m 666 /dev/tigl3 c 61 228
# Theoritically, we can connect up to 16 link cables 
# but 4 seems to be enough !
