summaryrefslogtreecommitdiff
blob: eb8d99567b2a98cb9c9b7e2d3ee9e6284ae92818 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/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