Repository navigation
Expand file tree
/
Copy pathMakefile.linux
More file actions
executable file
·76 lines (60 loc) · 1.78 KB
/
Copy pathMakefile.linux
File metadata and controls
executable file
·76 lines (60 loc) · 1.78 KB
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
67
68
69
70
71
72
73
74
75
76
# Set to 1 for direct access IO register in bpwd_tst access program.
# This is suitable for DOS environment or evaluation purpose in Linux.
# Set to 0 to leave IO access to driver for noraml operation.
#
DIRECT_IO_ACCESS=1
# Set to 1 to use Lanner driver code.
# Set to 0 to use 2.6 kernel i2c-dec and i2c-i801 driver interface
#
#<<TODO>>
# Note: use LINUX_KERNEL_DRIVER arp function may not work.
# Test on 2.6.18(CentOS 5.4) block read not support
# Test on 2.6.25(FC9) block read ok but block write fail
#
LANNER_DRIVER=1
ifeq ($(DIRECT_IO_ACCESS), 1)
LANNER_DRIVER=0
LINUX_KERNEL_DRIVER=0
else
ifeq ($(LANNER_DRIVER),1)
LINUX_KERNEL_DRIVER=0
else
LINUX_KERNEL_DRIVER=1
KERV := $(shell uname -r | cut -c1-3 | sed 's/2\.[56]/2\.6/')
endif
endif
ifeq ($(LANNER_DRIVER), 1)
DIRS = driver src
else
DIRS = src
endif
all: config
for i in $(DIRS); do $(MAKE) -C $$i $@; done
config:
-rm -rf ./include/config.h
-echo "//Created by Makefile, do not edit it" >> ./include/config.h
ifeq ($(DIRECT_IO_ACCESS), 1)
-echo "#define DIRECT_IO_ACCESS" >> ./include/config.h
-echo "#undef LANNER_DRIVER" >> ./include/config.h
-echo "#undef LINUX_KERNEL_DRIVER" >> ./include/config.h
else
ifeq ($(LANNER_DRIVER), 1)
-echo "#undef DIRECT_IO_ACCESS" >> ./include/config.h
-echo "#define LANNER_DRIVER" >> ./include/config.h
-echo "#undef LINUX_KERNEL_DRIVER" >> ./include/config.h
else
-echo "#undef DIRECT_IO_ACCESS" >> ./include/config.h
-echo "#undef LANNER_DRIVER" >> ./include/config.h
-echo "#define LINUX_KERNEL_DRIVER" >> ./include/config.h
ifeq ($(KERV),2.4)
-echo "#define LINUX_24" >> ./include/config.h
endif
endif
endif
clean:
for i in $(DIRS); do $(MAKE) -C $$i $@; done
-rm -f include/config.h
-rm -rf bin/bpwd_tst
-rm -rf bin/bpwd_drv.ko
-rm -rf bin/bpwd_drv.o
.PHONY: all clean config