obsolete file
[openwrt.git] / target / linux / package / spca5xx / patches / 01-kmod-build.patch
1 diff -Nur spca5xx-20051212/Makefile spca5xx-20051212.patched/Makefile
2 --- spca5xx-20051212/Makefile   2005-12-10 17:05:51.000000000 +0100
3 +++ spca5xx-20051212.patched/Makefile   2005-12-25 02:41:29.910720750 +0100
4 @@ -33,7 +33,9 @@
5  DEFINES   += -DCONFIG_USB_SPCA5XX_MODULE=1 -DMODULE -D__KERNEL__
6  DEFINES   += -DVID_HARDWARE_SPCA5XX=0xFF -DSPCA5XX_VERSION=\"$(VERSION)\"
7  
8 -ifneq ($(shell uname -r | cut -d. -f1,2), 2.4)
9 +KERNELVERSION=$(shell uname -r | cut -d. -f1,2)
10 +
11 +ifneq ($(KERNELVERSION), 2.4)
12  
13  ifneq ($(KERNELRELEASE),)   # We were called by kbuild
14  CFLAGS += $(DEFINES) 
15 @@ -68,152 +70,16 @@
16  
17  else   # kernel version test
18  
19 -#############################################################################
20 -# For Linux 2.4 users.
21 -# Change the following lines according to your system configuration.
22 -# It is important to configure your particular source tree ("make dep") before
23 -# compiling this module!
24 -#############################################################################
25 -###
26 -# This makefile will build the spca50x driver module external to the kernel
27 -# source tree. It makes it easier to swap kernels.
28 -
29 -
30 -KERNEL_VERSION = `uname -r`
31 -
32 -###
33 -# Location of the header files (most importantly the config files)
34 -# for the kernel you want to build the module against.
35 -# This should be correct for the currently installed kernel on your machine.
36 -KINCLUDE   = /lib/modules/$(KERNEL_VERSION)/build/include
37 -KERNEL_ACFILE = $(KINCLUDE)/linux/autoconf.h
38 -KERNEL_MODVERSIONSFILE = $(KINCLUDE)/linux/modversions.h
39 -MODULE_INSTALLDIR = /lib/modules/$(KERNEL_VERSION)/kernel/drivers/usb/
40 -
41 -# Detect module versioning support
42 -ifneq ($(strip $(shell grep 'define CONFIG_MODVERSIONS 1' $(KERNEL_ACFILE))),)
43 -       DEFINES += -DMODVERSIONS -include $(KERNEL_MODVERSIONSFILE)
44 -endif
45 -
46 -# Detect SMP support
47 -ifneq ($(strip $(shell grep 'define CONFIG_SMP 1' $(KERNEL_ACFILE))),)
48 -       DEFINES += -D__SMP__ -DSMP
49 -endif
50 -
51 -# Setup the tools
52 -CC         = gcc
53 -LD         = ld
54 -
55 -# Setup compiler warnings
56 -WARNINGS   = -Wall -Wpointer-arith
57 -WARNINGS  += -Wcast-align -Wwrite-strings -Wstrict-prototypes
58 -WARNINGS  += -Wuninitialized -Wreturn-type -Wunused -Wparentheses
59 -
60 -# Setup compiler flags
61 -CFLAGS     = -O2 -fomit-frame-pointer -fno-strict-aliasing -pipe
62 -CFLAGS    += -mpreferred-stack-boundary=2 
63 -CFLAGS    += -I$(KINCLUDE) -Idrivers/usb
64 -
65 -# Setup link flags
66 -LDFLAGS    = --strip-debug -r
67 -
68 -# Setup the list of files to be included in a distribution
69 -DIST_FILES = CHANGELOG \
70 -             README \
71 -             Makefile \
72 -             drivers/usb/Config.in \
73 -             drivers/usb/spcadecoder.c \
74 -             drivers/usb/spcadecoder.h \
75 -            drivers/usb/spcagamma.h \
76 -            drivers/usb/spcaCompat.h \
77 -            drivers/usb/spcausb.h \
78 -             drivers/usb/spca500_init.h \
79 -             drivers/usb/spca501_init.h \
80 -            drivers/usb/sp5xxfw2.dat \
81 -             drivers/usb/sp5xxfw2.h \
82 -             drivers/usb/spca505_init.h \
83 -             drivers/usb/spca506.h \
84 -             drivers/usb/spca508_init.h \
85 -            drivers/usb/spca561.h \
86 -            drivers/usb/sonix.h \
87 -             drivers/usb/cs2102.h \
88 -             drivers/usb/hv7131b.h \
89 -            drivers/usb/icm105a.h \
90 -             drivers/usb/hv7131c.h \
91 -            drivers/usb/hdcs2020.h \
92 -             drivers/usb/pb0330.h \
93 -            drivers/usb/tas5130c.h \
94 -            drivers/usb/zc3xx.h\
95 -            drivers/usb/tv8532.h\
96 -            drivers/usb/cxlib.h\
97 -            drivers/usb/sn9cxxx.h\
98 -            drivers/usb/cx11646.h\
99 -            drivers/usb/pac207.h\
100 -            drivers/usb/spca5xx.c \
101 -             drivers/usb/spca5xx.h 
102 -
103 -OBJS       = drivers/usb/spcadecoder.o \
104 -             drivers/usb/spca5xx.o
105 -
106 -BINARY     = spca5xx.o
107 -
108 -###
109 -# Targets follow here
110 -
111 -binary:        $(OBJS)
112 -       @echo Linking $(BINARY)
113 -       @$(LD) $(LDFLAGS) -o $(BINARY) $(OBJS)
114 -
115 -install: binary
116 -       @echo Installing.. Your root password may be required.
117 -       su -c "make install-root"
118 -
119 -install-root:
120 -       @echo Installing..
121 -       @mkdir -p /lib/modules/`uname -r`/kernel/drivers/usb
122 -       @rm -f /lib/modules/`uname -r`/kernel/drivers/usb/spca50x.o
123 -       @rm -f /lib/modules/`uname -r`/kernel/drivers/usb/et61x.o
124 -       @cp spca5xx.o /lib/modules/`uname -r`/kernel/drivers/usb/spca5xx.o
125 -       @/sbin/depmod
126 -
127 -dist:  clean binary
128 -       @echo Making distributable archives
129 -       @rm -f spca5xx-src-$(VERSION).tar.gz
130 -       @tar zcf spca5xx-src-$(VERSION).tar.gz $(DIST_FILES)
131 -       @rm -f spca5xx-module-$(VERSION).tar.gz
132 -       @cp $(BINARY) spca5xx-$(VERSION).o
133 -       @tar zcf spca5xx-module-$(VERSION).tar.gz spca5xx-$(VERSION).o README
134 -       @rm spca5xx-$(VERSION).o
135 -
136 -.c.o:  Makefile $*.c
137 -       @echo Compiling $*.c
138 -       @$(CC) $(CFLAGS) $(WARNINGS) $(DEFINES) -c $*.c -o $*.o
139 -
140 -###
141 -# Dependencies follow here
142 -
143 -drivers/usb/spca5xx.o: drivers/usb/spca5xx.h \
144 -                      drivers/usb/spcaCompat.h \
145 -                      drivers/usb/spcausb.h \
146 -                      drivers/usb/sonix.h \
147 -                       drivers/usb/spca500_init.h \
148 -                       drivers/usb/spca501_init.h \
149 -                      drivers/usb/sp5xxfw2.h \
150 -                       drivers/usb/spca505_init.h \
151 -                      drivers/usb/spca506.h \
152 -                       drivers/usb/spca508_init.h \
153 -                      drivers/usb/spca561.h \
154 -                      drivers/usb/zc3xx.h\
155 -                      drivers/usb/tv8532.h\
156 -                      drivers/usb/cx11646.h\
157 -                      drivers/usb/mr97311.h\
158 -                      drivers/usb/sn9cxxx.h\
159 -                      drivers/usb/pac207.h\
160 -                       
161 -
162 -drivers/usb/spcadecoder.o: drivers/usb/spcadecoder.h \
163 -                          drivers/usb/spcagamma.h \
164 -                          
165 +EXTRA_CFLAGS += $(DEFINES) 
166 +  
167 +spca5xx-objs := drivers/usb/spca5xx.o drivers/usb/spcadecoder.o 
168 +  
169 +obj-m += spca5xx.o
170 +obj-y := $(spca5xx-objs)
171 +  
172 +O_TARGET := $(obj-m)
173 +  
174 +-include $(TOPDIR)/Rules.make
175  
176  endif  # End kernel version test
177