#
# Makefile for the kernel serial device drivers.
#
# Advantech eAutomation Division
#

ADVMOD := adv950

SERIAL_NAME= ttyAP
MAX_TTY= 16
ADV_TTY_MAJOR= 30
SERIAL_FLAGS= -DSERIAL_NAME=\"$(SERIAL_NAME)\" \
              -DADV_TTY_MAJOR=$(ADV_TTY_MAJOR) \
              -DADV_TTY_CUMAJOR=$(ADV_TTY_CUMAJOR)


install:
	$(shell if grep $(ADVMOD) /proc/modules > /dev/null ; then \
	 rmmod $(ADVMOD) ; fi)
	@insmod $(ADVMOD).ko

node: 
	@echo "Creating serial device nodes $(SERIAL_NAME) ..."
	@chmod 777 ./advmknod
	@./advmknod $(SERIAL_NAME) \
	 $$(awk '$$2=="$(SERIAL_NAME)" {print $$1}' /proc/devices) $(MAX_TTY)
	@echo "Done"

uninstall:
	$(shell if grep $(ADVMOD) /proc/modules > /dev/null ; then \
	rmmod $(ADVMOD)>/dev/null ; fi)

test:
	@cd ./getconfig; make;./getconfig $(SERIAL_NAME) $(MAX_TTY) 
