#!/bin/bash # Notice : # for dkms, make cmd was defined in dkms.conf as MAKE[0]. generally we define it as # MAKE[0] = "make ..." # however, when dkms build this target, it was invoked by "make KERNELRELEASE=xxx ..." instead # that cause the plain make file below can not work again : # # ifneq ($(KERNELRELEASE),) # obj-m := lirc_wb667.o # lirc_wb667-objs := lirc_wb667.o # else # KERNEL_SRC_TREE ?= /lib/modules/$(shell uname -r)/build # PWD := $(shell pwd) # modules modules_install clean: # make -C $(KERNEL_SRC_TREE) M=$(PWD) $@ # endif # # it can not work because KERNELRELEASE was defined in dkms's case. so we should merge the two # cases together : # on Linux 2.6 kernel # If KERNELRELEASE is defined, we've been invoked from the # kernel build system and can use its language. LIRC_DIR := /usr/src/lirc-0.8.6 obj-m += lirc_wb677.o lirc_wb677-objs := lirc_wb677_main.o lirc_wb677_mouse_kbd.o KSRC ?= /lib/modules/$(shell uname -r)/build PWD := $(shell pwd) modules: echo KERNELDIR=$(KSRC) $(MAKE) -C $(KSRC) -I $(LIRC_DIR) M=$(PWD) modules # Following "install", "uninstall" and "clean" are not for dkms. install: /etc/init.d/lirc stop rmmod lirc_wb677 || echo "lirc_wb677.ko is not executing" file="lirc_wb677.ko"; \ dir="/lib/modules/$(shell uname -r)/kernel/ubuntu/lirc/lirc_wb677"; \ if test -d "$$dir"; then echo ""; else mkdir -p $$dir; fi; \ cp -vf *.ko $$dir depmod -a patch -p0 /usr/share/lirc/lirc.hwdb < /usr/share/lirc/lirc_nct667x-src-1.0.0-ubuntu9.10.patch @echo "" @echo "Hint: You can execute \"dpkg-reconfigure lirc\" to configure lirc." @echo " And start lirc by executing \"/etc/init.d/lirc start\"" uninstall: /etc/init.d/lirc stop ( rmmod lirc_wb677 ) || echo "lirc_wb677.ko is not executing" dir="/lib/modules/$(shell uname -r)/kernel/ubuntu/lirc/lirc_wb677"; \ if test -d "$$dir"; then rm -R $$dir; fi; depmod -a patch -R -p0 /usr/share/lirc/lirc.hwdb < /usr/share/lirc/lirc_nct667x-src-1.0.0-ubuntu9.10.patch clean: rm -rf *.o *.ko *.mod.c Module.symvers .tmp_versions .*.cmd