fix 2.4 build error introduced by changeset:2606
[openwrt.git] / openwrt / target / linux / package / spca5xx / patches / 01-kmod-build.patch
1 diff -ruN spca5xx-20051105-old/Makefile spca5xx-20051105-new/Makefile
2 --- spca5xx-20051105-old/Makefile       2005-11-05 19:18:26.000000000 +0100
3 +++ spca5xx-20051105-new/Makefile       2005-12-09 10:34:47.000000000 +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,158 +70,19 @@
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 +EXTRA_CFLAGS += $(DEFINES) 
30  
31 -KERNEL_VERSION = `uname -r`
32 +spca5xx-objs := drivers/usb/spca5xx.o drivers/usb/spcadecoder.o 
33  
34 -###
35 -# Location of the header files (most importantly the config files)
36 -# for the kernel you want to build the module against.
37 -# This should be correct for the currently installed kernel on your machine.
38 -KINCLUDE   = /lib/modules/$(KERNEL_VERSION)/build/include
39 -KERNEL_ACFILE = $(KINCLUDE)/linux/autoconf.h
40 -KERNEL_MODVERSIONSFILE = $(KINCLUDE)/linux/modversions.h
41 -MODULE_INSTALLDIR = /lib/modules/$(KERNEL_VERSION)/kernel/drivers/usb/
42 -
43 -# Detect module versioning support
44 -ifneq ($(strip $(shell grep 'define CONFIG_MODVERSIONS 1' $(KERNEL_ACFILE))),)
45 -       DEFINES += -DMODVERSIONS -include $(KERNEL_MODVERSIONSFILE)
46 -endif
47 +obj-m += spca5xx.o
48 +obj-y := $(spca5xx-objs)
49  
50 -# Detect SMP support
51 -ifneq ($(strip $(shell grep 'define CONFIG_SMP 1' $(KERNEL_ACFILE))),)
52 -       DEFINES += -D__SMP__ -DSMP
53 -endif
54 +O_TARGET := $(obj-m)
55  
56 -# Setup the tools
57 -CC         = gcc
58 -LD         = ld
59 -
60 -# Setup compiler warnings
61 -WARNINGS   = -Wall -Wpointer-arith
62 -WARNINGS  += -Wcast-align -Wwrite-strings -Wstrict-prototypes
63 -WARNINGS  += -Wuninitialized -Wreturn-type -Wunused -Wparentheses
64 -
65 -# Setup compiler flags
66 -CFLAGS     = -O2 -fomit-frame-pointer -fno-strict-aliasing -pipe
67 -CFLAGS    += -mpreferred-stack-boundary=2 
68 -CFLAGS    += -I$(KINCLUDE) -Idrivers/usb
69 -
70 -# Setup link flags
71 -LDFLAGS    = --strip-debug -r
72 -
73 -# Setup the list of files to be included in a distribution
74 -DIST_FILES = CHANGELOG \
75 -             README \
76 -             Makefile \
77 -             drivers/usb/Config.in \
78 -             drivers/usb/spcadecoder.c \
79 -             drivers/usb/spcadecoder.h \
80 -             drivers/usb/jpeg_header.h \
81 -            drivers/usb/jpeg_qtables.h \
82 -            drivers/usb/spcagamma.h \
83 -            drivers/usb/spcaCompat.h \
84 -            drivers/usb/spcausb.h \
85 -             drivers/usb/spca500_init.h \
86 -             drivers/usb/spca501_init.h \
87 -            drivers/usb/sp5xxfw2.dat \
88 -             drivers/usb/sp5xxfw2.h \
89 -             drivers/usb/spca505_init.h \
90 -             drivers/usb/spca506.h \
91 -             drivers/usb/spca508_init.h \
92 -            drivers/usb/spca561.h \
93 -            drivers/usb/sonix.h \
94 -             drivers/usb/cs2102.h \
95 -             drivers/usb/hv7131b.h \
96 -            drivers/usb/icm105a.h \
97 -             drivers/usb/hv7131c.h \
98 -            drivers/usb/hdcs2020.h \
99 -             drivers/usb/pb0330.h \
100 -            drivers/usb/tas5130c.h \
101 -            drivers/usb/zc3xx.h\
102 -            drivers/usb/tv8532.h\
103 -            drivers/usb/cxlib.h\
104 -            drivers/usb/sn9cxxx.h\
105 -            drivers/usb/cx11646.h\
106 -            drivers/usb/pac207.h\
107 -            drivers/usb/spca5xx.c \
108 -             drivers/usb/spca5xx.h 
109 -
110 -OBJS       = drivers/usb/spcadecoder.o \
111 -             drivers/usb/spca5xx.o
112 -
113 -BINARY     = spca5xx.o
114 -
115 -###
116 -# Targets follow here
117 -
118 -binary:        $(OBJS)
119 -       @echo Linking $(BINARY)
120 -       @$(LD) $(LDFLAGS) -o $(BINARY) $(OBJS)
121 -
122 -install: binary
123 -       @echo Installing.. Your root password may be required.
124 -       su -c "make install-root"
125 -
126 -install-root:
127 -       @echo Installing..
128 -       @mkdir -p /lib/modules/`uname -r`/kernel/drivers/usb
129 -       @rm -f /lib/modules/`uname -r`/kernel/drivers/usb/spca50x.o
130 -       @rm -f /lib/modules/`uname -r`/kernel/drivers/usb/et61x.o
131 -       @cp spca5xx.o /lib/modules/`uname -r`/kernel/drivers/usb/spca5xx.o
132 -       @/sbin/depmod
133 -
134 -dist:  clean binary
135 -       @echo Making distributable archives
136 -       @rm -f spca5xx-src-$(VERSION).tar.gz
137 -       @tar zcf spca5xx-src-$(VERSION).tar.gz $(DIST_FILES)
138 -       @rm -f spca5xx-module-$(VERSION).tar.gz
139 -       @cp $(BINARY) spca5xx-$(VERSION).o
140 -       @tar zcf spca5xx-module-$(VERSION).tar.gz spca5xx-$(VERSION).o README
141 -       @rm spca5xx-$(VERSION).o
142 -
143 -.c.o:  Makefile $*.c
144 -       @echo Compiling $*.c
145 -       @$(CC) $(CFLAGS) $(WARNINGS) $(DEFINES) -c $*.c -o $*.o
146 -
147 -###
148 -# Dependencies follow here
149 -
150 -drivers/usb/spca5xx.o: drivers/usb/spca5xx.h \
151 -                      drivers/usb/spcaCompat.h \
152 -                      drivers/usb/spcausb.h \
153 -                      drivers/usb/sonix.h \
154 -                       drivers/usb/spca500_init.h \
155 -                       drivers/usb/spca501_init.h \
156 -                      drivers/usb/sp5xxfw2.h \
157 -                       drivers/usb/spca505_init.h \
158 -                      drivers/usb/spca506.h \
159 -                       drivers/usb/spca508_init.h \
160 -                      drivers/usb/spca561.h \
161 -                      drivers/usb/zc3xx.h\
162 -                      drivers/usb/tv8532.h\
163 -                      drivers/usb/cx11646.h\
164 -                      drivers/usb/mr97311.h\
165 -                      drivers/usb/sn9cxxx.h\
166 -                      drivers/usb/pac207.h\
167 -                       
168 -
169 -drivers/usb/spcadecoder.o: drivers/usb/spcadecoder.h \
170 -                          drivers/usb/spcagamma.h \
171 -                           drivers/usb/jpeg_header.h
172 +-include $(TOPDIR)/Rules.make
173  
174  endif  # End kernel version test
175  
176 -
177  ############################################################################## 
178  # OTHER TARGETS 
179  ##############################################################################