]> rtime.felk.cvut.cz Git - lincan.git/blob - lincan/Makefile
75a118260631c8947e2703e60cb9d11d9a1d208d
[lincan.git] / lincan / Makefile
1 # Makefile for the Linux CAN-bus driver.
2 # Written by Arnaud Westenberg email:arnaud@wanadoo.nl
3 # This software is released under the GPL-License.
4 # Version 0.7  6 Aug 2001
5
6 ########## The following options can be changed ##########
7
8 # Include directory
9 INCLUDEDIR = /usr/src/linux/include
10 # Compiler
11 CC = gcc
12 # Enable debugging messages
13 DEBUG = y 
14 # Enable module version support
15 MODVERSIONS = y 
16
17 # You can comment out the hardware you don't need. This will result in a smaller
18 # driver. By default, all hardware is supported in the driver. See the README 
19 # file for a description of the supported hardware.
20 PIP = y
21 PCCAN = y       # Not to be confused with PCCCAN!!!
22 SMARTCAN = y
23 NSI = y
24 CC104 = y
25 AIM104 = y
26 PCI03 = y
27 PCM3680 = y
28 M437 = y
29 PCCCAN = y      # Not to be confused with PCCAN!!!
30 SSV = y
31 TEMPLATE = y
32
33 ########## Don't change anything under this line please ##########
34
35 KERNEL_VERSION := $(shell awk -F\" '/REL/ {print $$2}' \
36         $(INCLUDEDIR)/linux/version.h | awk -F\- '{print $$1}')
37
38 PROC_FS := $(shell awk -F\  '/PROC_FS/ {print $$3}' \
39         $(INCLUDEDIR)/linux/autoconf.h)
40
41 VPATH = ./src:./include:./utils
42
43 CFLAGS = -D__KERNEL__ -DMODULE -O2 -Wall -Wstrict-prototypes \
44         -Wpointer-arith -I $(INCLUDEDIR)
45         
46
47 ifdef DEBUG
48         CFLAGS += -DCAN_DEBUG
49 endif
50
51 ifndef MODVERSIONS
52         CFLAGS += -DNOVER
53 endif
54
55 ifdef PROC_FS
56         SRCS += proc.c
57         OBJS += proc.o
58 endif
59 ifdef PIP
60         SRCS += pip.c
61         OBJS += pip.o
62 endif
63 ifdef PCCAN
64         SRCS += pccan.c
65         OBJS += pccan.o
66 endif
67 ifdef SMARTCAN
68         SRCS += smartcan.c
69         OBJS += smartcan.o
70 endif
71 ifdef NSI
72         SRCS += nsi.c
73         OBJS += nsi.o
74 endif
75 ifdef CC104
76         SRCS += cc_can104.c
77         OBJS += cc_can104.o
78 endif
79 ifdef PCI03
80         SRCS += pc-i03.c
81         OBJS += pc-i03.o
82 endif
83 ifdef PCM3680
84         SRCS += pcm3680.c
85         OBJS += pcm3680.o
86 endif
87 ifdef AIM104
88         SRCS += aim104.c
89         OBJS += aim104.o
90 endif
91 ifdef M437
92         SRCS += m437.c
93         OBJS += m437.o
94 endif
95 ifdef PCCCAN
96         SRCS += pcccan.c
97         OBJS += pcccan.o
98 endif
99 ifdef SSV
100         SRCS += ssv.c
101         OBJS += ssv.o
102 endif
103 ifdef TEMPLATE
104         SRCS += template.c
105         OBJS += template.o
106 endif
107
108 SRCS += main.c modparms.c setup.c sja1000.c i82527.c close.c ioctl.c\
109         open.c write.c read.c sja1000p.c irq.c
110
111 OBJS += main.o modparms.o setup.o sja1000.o i82527.o close.o ioctl.o\
112         open.o write.o read.o sja1000p.o irq.o
113
114 all : mesg main.ver can.o utils
115
116 mesg :
117         @echo
118         @echo Compiling for kernel version: $(KERNEL_VERSION)
119 ifdef MODVERSIONS
120         @echo Compiling with module version support
121 else
122         @echo Compiling without module version support
123 endif
124 ifdef PROC_FS
125         @echo Compiling with proc filesystem support
126 else
127         @echo Compiling without proc filesystem support
128 endif
129         @echo
130
131 ifdef MODVERSIONS
132 main.ver : main.c
133         $(CC) -I $(INCLUDEDIR) -E -O2 -D__GENKSYMS__ $^ | \
134         /sbin/genksyms -k $(KERNEL_VERSION) > ./include/$@
135 else
136 main.ver:
137 endif
138
139 can.o : $(OBJS)
140         (cd ./src; ld -o ../can.o $(OBJS) -E -O2 -r)
141
142 main.o : main.c main.h proc.h
143         $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
144 proc.o : proc.c main.h
145         $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
146 modparms.o : modparms.c modparms.h
147         $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
148 setup.o : setup.c setup.h
149         $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
150 pip.o : pip.c pip.h
151         $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
152         @echo "#define PIP 1" >> .support
153 pccan.o : pccan.c pccan.h
154         $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
155         @echo "#define PCCAN 1" >> .support
156 smartcan.o : smartcan.c smartcan.h
157         $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
158         @echo "#define SMARTCAN 1" >> .support
159 nsi.o : nsi.c nsi.h
160         $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
161         @echo "#define NSI 1" >> .support
162 cc_can104.o : cc_can104.c cc_can104.h
163         $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
164         @echo "#define CC104 1" >> .support
165 aim104.o : aim104.c aim104.h
166         $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
167         @echo "#define AIM104 1" >> .support
168 pc-i03.o : pc-i03.c pc-i03.h
169         $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
170         @echo "#define PCI03 1" >> .support
171 pcm3680.o : pcm3680.c pcm3680.h
172         $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
173         @echo "#define PCM3680 1" >> .support
174 m437.o : m437.c m437.h
175         $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
176         @echo "#define M437 1" >> .support
177 pcccan.o : pcccan.c pcccan.h
178         $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
179         @echo "#define PCCCAN 1" >> .support
180 ssv.o : ssv.c ssv.h
181         $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
182         @echo "#define SSV 1" >> .support
183 template.o : template.c template.h
184         $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
185         @echo "#define TEMPLATE 1" >> .support
186 open.o : open.c open.h
187         $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
188 i82527.o : i82527.c i82527.h
189         $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
190 close.o : close.c close.h
191         $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
192 read.o : read.c read.h
193         $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
194 irq.o : irq.c irq.h
195         $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
196 ioctl.o : ioctl.c ioctl.h
197         $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
198 write.o : write.c write.h
199         $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
200 sja1000.o : sja1000.c sja1000.h
201         $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
202 sja1000p.o : sja1000p.c sja1000p.h
203         $(CC) -c -o $(<D)/$@ $< $(CFLAGS)
204
205 utils : rxtx sendburst readburst
206
207 rxtx : rxtx.c
208         $(CC) -o $(<D)/$@ $< -Wall
209 sendburst : sendburst.c
210         $(CC) -o $(<D)/$@ $< -Wall
211 readburst : readburst.c
212         $(CC) -o $(<D)/$@ $< -Wall
213
214
215 clean :
216         rm -f *.o
217         rm -f .support
218         (cd src; rm -f *.o)
219         (cd include; rm -f *.ver)
220         (cd utils; rm -f rxtx sendburst readburst)