
#
# Makefile for Lava EtherSerial link driver (kernel 2.6.x)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Author: Eduard G. Kromskoy <ed1k@lavalink.com>
# Company: Lava Computer Mfg Inc. 
#
# This Makefile seems to reflect the directory tree (the kernel
# source and modules location) for all Red Hat distributions.
# Please correct pathes if it doesn't work for your installation.
#
# Alternatively you may want to compile this module by adding
# the source to the linux kernel source tree.
# 

IDIR	:=/lib/modules/$(shell uname -r)/kernel/drivers/char
KDIR	:=/lib/modules/$(shell uname -r)/build
PWD	:=$(shell pwd)


ifneq ($(KERNELRELEASE),)
obj-m	:= esl.o
else
default: 
	$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules 2>error.log
endif

clean:
	rm -f *.cmd .*.cmd *.o *.ko *.mod.c *.log
	
	
install:
	cp esl.ko $(IDIR)
	rm -f /dev/ttyES*
	mknod /dev/ttyES0 c 247 0
	mknod /dev/ttyES1 c 247 1	
	mknod /dev/ttyES2 c 247 2	
	mknod /dev/ttyES3 c 247 3	
	mknod /dev/ttyES4 c 247 4	
	mknod /dev/ttyES5 c 247 5	
	mknod /dev/ttyES6 c 247 6
	mknod /dev/ttyES7 c 247 7
	chmod 666 /dev/ttyES*
	depmod -a
	
			