Subversion Repositories f9daq

Rev

Rev 9 | Rev 43 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 9 Rev 11
Line 69... Line 69...
69
 
69
 
70
 
70
 
71
#****************************************************************************
71
#****************************************************************************
72
# where the driver should be installed - change here for cross install - currently not functional
72
# where the driver should be installed - change here for cross install - currently not functional
73
#
73
#
-
 
74
 
74
INSTALL_LOCATION = /lib/modules/2.6.24-19-generic/ubuntu/misc/
75
INSTALL_LOCATION = /lib/modules/$(shell uname -r)/kernel/drivers/misc/
75
 
76
 
76
#****************************************************************************
77
#****************************************************************************
77
# get extracted kernel VERSION and PATCHLEVEL for comparison
78
# get extracted kernel VERSION and PATCHLEVEL for comparison
78
# decide to use KBUILD for kernels greater 2.6.0
79
# decide to use KBUILD for kernels greater 2.6.0
79
#
80
#
80
KVERSION    := $(shell echo $(VERSION) | sed -e 's;\([1-9]\)\..*;\1;g' )
81
KVERSION    := $(shell echo $(VERSION) | sed -e 's;\([1-9]\)\..*;\1;g' )
81
KPATCHLEVEL := $(shell echo $(VERSION) | sed -e 's;[1-9]\.\([0-9]\{0,3\}\)\..*;\1;g' )
82
KPATCHLEVEL := $(shell echo $(VERSION) | sed -e 's;[1-9]\.\([0-9]\{0,3\}\)\..*;\1;g' )
82
USEKBUILD   := $(shell if [ $(KVERSION) -gt 2 ] || [ $(KVERSION) -eq 2 ] && [ $(KPATCHLEVEL) -ge 6 ]  ; \
-
 
83
                 then echo "yes" ; else echo "no"  ; fi)
-
 
84
 
-
 
85
USEKBUILD   := yes
83
USEKBUILD   := yes
86
#****************************************************************************
84
#****************************************************************************
87
# some common switches and defines
85
# some common switches and defines
88
#
86
#
89
DBG     = __NO_DEBUG__  # or __DEBUG__ to debug the driver
87
DBG     = __NO_DEBUG__  # or __DEBUG__ to debug the driver
-
 
88
#DBG     = __DEBUG__ 
90
SRC     = .
89
SRC     = .
91
 
90
 
92
 
91
 
93
#****************************************************************************
92
#****************************************************************************
94
# preparation what to build or what to KBUILD
93
# preparation what to build or what to KBUILD
95
#
94
#
96
pcivme-objs :=  $(SRC)/main.o $(SRC)/askpci.o $(SRC)/plxbug.o $(SRC)/fops.o
95
pcivme-objs :=  $(SRC)/main.o $(SRC)/askpci.o $(SRC)/plxbug.o $(SRC)/fops.o
97
 
96
 
98
 
97
 
99
ifeq ($(USEKBUILD),yes) # <<<<< USEKBUILD >>>>>>
98
ifeq ($(USEKBUILD),yes) # <<<<< USEKBUILD >>>>>>
100
 
99
 
101
#****************************************************************************
100
#****************************************************************************
102
# what's the target
101
# what's the target
103
#
102
#
104
TARGET = pcivme.ko
103
TARGET = pcivme.ko
105
obj-m := pcivme.o
104
obj-m := pcivme.o
106
 
105
 
Line 110... Line 109...
110
CPPFLAGS += -I$(PWD) -D$(DBG)
109
CPPFLAGS += -I$(PWD) -D$(DBG)
111
 
110
 
112
#****************************************************************************
111
#****************************************************************************
113
# do it
112
# do it
114
#
113
#
-
 
114
KBUILD_CPPFLAGS +=  -D$(DBG)
-
 
115
 
115
all : message
116
all : message
116
	$(MAKE) -C $(KERNSRC) M=$(PWD) V=$(VERBOSE) $(filter-out all, $(MAKECMDGOLAS)) modules
117
	$(MAKE) -C $(KERNSRC) M=$(PWD) V=$(VERBOSE)  $(filter-out all, $(MAKECMDGOLAS)) modules
117
 
118
 
118
else # <<<<< USEKBUILD >>>>>>
119
else # <<<<< USEKBUILD >>>>>>
119
 
120
 
120
#****************************************************************************
121
#****************************************************************************
121
# additional common switches and defines
122
# additional common switches and defines
Line 175... Line 176...
175
	@ echo "***"
176
	@ echo "***"
176
	@ echo "*** Host machine kernel version=$(shell uname -r), Driver kernel version=$(VERSION), Path to kernel sources=$(KERNSRC), use KBUILD=$(USEKBUILD)"
177
	@ echo "*** Host machine kernel version=$(shell uname -r), Driver kernel version=$(VERSION), Path to kernel sources=$(KERNSRC), use KBUILD=$(USEKBUILD)"
177
	@ echo "***"
178
	@ echo "***"
178
 
179
 
179
#********** root installation only ******************************************
180
#********** root installation only ******************************************
180
install: 
181
install:
-
 
182
	-rmmod  pcivme
-
 
183
	-cp -r pcivme.ko $(INSTALL_LOCATION)
181
	./pcivme_load 1
184
	./pcivme_load 1
182
 
185
 
183
endif  # <<<<< HASVERSION_H >>>>>>
186
endif  # <<<<< HASVERSION_H >>>>>>
184
 
187
 
185
# DO NOT DELETE
188
# DO NOT DELETE