summaryrefslogtreecommitdiff
path: root/doc/plustek/Makefile.kernel26
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2014-10-06 14:00:40 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2014-10-06 14:00:40 +0200
commit6e9c41a892ed0e0da326e0278b3221ce3f5713b8 (patch)
tree2e301d871bbeeb44aa57ff9cc070fcf3be484487 /doc/plustek/Makefile.kernel26
Initial import of sane-backends version 1.0.24-1.2
Diffstat (limited to 'doc/plustek/Makefile.kernel26')
-rw-r--r--doc/plustek/Makefile.kernel26124
1 files changed, 124 insertions, 0 deletions
diff --git a/doc/plustek/Makefile.kernel26 b/doc/plustek/Makefile.kernel26
new file mode 100644
index 0000000..43a71ad
--- /dev/null
+++ b/doc/plustek/Makefile.kernel26
@@ -0,0 +1,124 @@
+# Makefile for the plustek scanner driver (kernel-module)
+#
+###############################################################################
+
+#
+# retrieve the version numbers
+#
+ifeq ($(LINUXVERSION),)
+ LINUXVERSION = $(shell uname -r)
+endif
+LINUXRELEASE = $(shell uname -r | cut -d'.' -f3)
+
+ifeq ($(VERSIONSTR),)
+ ifeq ($(SUBDIRS),)
+ VERSIONSTR = $(shell grep "define BACKEND_VERSION" $(M)/plustek_pp.c | cut -b25-50 )
+ else
+ VERSIONSTR = $(shell grep "define BACKEND_VERSION" $(SUBDIRS)/plustek_pp.c | cut -b25-50 )
+ endif
+endif
+
+#
+# extra flags
+#
+EXTRA_CFLAGS += -D_PTDRV_VERSTR=\"$(VERSIONSTR)\"
+
+ifeq ($(DEBUG),y)
+ EXTRA_CFLAGS += -DDEBUG
+endif
+
+#
+# the module name
+#
+TARGET := pt_drv
+MODULE := $(TARGET).ko
+
+#
+# our files...
+#
+NAMES := dac detect genericio image map misc models io procfs
+NAMES := $(NAMES) motor p9636 ptdrv scale tpa p48xx p12 p12ccd
+NAMES := $(addprefix plustek-pp_, $(NAMES))
+OBJS := $(addsuffix .o, $(NAMES))
+
+#
+# now the kernel magic
+#
+ifneq ($(KERNELRELEASE),)
+obj-m := $(TARGET).o
+
+$(TARGET)-objs := $(OBJS)
+
+else
+KDIR := /lib/modules/$(shell uname -r)/build
+PWD := $(shell pwd)
+
+default:
+ $(MAKE) -C $(KDIR) M=$(PWD) modules
+endif
+
+#
+# the installation stuff
+#
+group = "root"
+mode = "644"
+INST_DIR = /lib/modules/$(LINUXVERSION)/kernel/drivers/parport
+
+#
+# copy the driver to the modules directory
+#
+install:
+ mkdir -p $(INST_DIR)
+ install -c -m $(mode) $(MODULE) $(INST_DIR)
+ /sbin/depmod -a
+
+#
+#
+#
+uninstall:
+ rm -f $(INST_DIR)/$(MODULE)
+
+#
+# use modprobe to load the driver, remember to set the
+# parameter in /etc/conf.modules (see INSTALL for more details)
+#
+load: $(INST_DIR)/$(MODULE)
+# invoke modprobe with all arguments we got
+ /sbin/modprobe $(TARGET) || exit 1
+
+# Remove stale nodes and replace them, then give gid and perms
+ rm -f /dev/$(TARGET)*
+
+# when using the devfs support, we check the /dev/scanner entries
+# and only create links to the devfs nodes
+# at least we create one link
+ @if [ -e /dev/scanner/$(TARGET)* ]; then \
+ ln -s /dev/scanner/$(TARGET)0 /dev/$(TARGET); \
+ for name in `ls /dev/scanner | grep $(TARGET)`; do \
+ ln -s /dev/scanner/$$name /dev/$$name ; \
+ done \
+ else \
+ mknod /dev/$(TARGET) c `cat /proc/devices | sed -ne "s/\([0-9]*\) pt_drv/\1/p"` 0; \
+ mknod /dev/$(TARGET)0 c `cat /proc/devices | sed -ne "s/\([0-9]*\) pt_drv/\1/p"` 0; \
+ mknod /dev/$(TARGET)1 c `cat /proc/devices | sed -ne "s/\([0-9]*\) pt_drv/\1/p"` 1; \
+ mknod /dev/$(TARGET)2 c `cat /proc/devices | sed -ne "s/\([0-9]*\) pt_drv/\1/p"` 2; \
+ mknod /dev/$(TARGET)3 c `cat /proc/devices | sed -ne "s/\([0-9]*\) pt_drv/\1/p"` 3; \
+ \
+ chgrp $(group) /dev/$(TARGET)*; \
+ chmod $(mode) /dev/$(TARGET)*; \
+ fi
+
+#
+# unload the driver
+#
+unload:
+ /sbin/modprobe -r $(TARGET) || exit 1
+
+# Remove stale nodes
+ rm -f /dev/$(TARGET)*
+
+#
+# cleanup the show
+#
+clean:
+ @-rm -f *.o .depend depend dep $(MODULE) $(TARGET).o $(TARGET).mod.c .*.cmd