Rev 11 | Go to most recent revision | Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 9 | f9daq | 1 | #**************************************************************************** |
| 2 | # Copyright (C) 2000-2004 ARW Elektronik Germany |
||
| 3 | # |
||
| 4 | # |
||
| 5 | # This program is free software; you can redistribute it and/or modify |
||
| 6 | # it under the terms of the GNU General Public License as published by |
||
| 7 | # the Free Software Foundation; either version 2 of the License, or |
||
| 8 | # (at your option) any later version. |
||
| 9 | # |
||
| 10 | # This program is distributed in the hope that it will be useful, |
||
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
| 13 | # GNU General Public License for more details. |
||
| 14 | # |
||
| 15 | # You should have received a copy of the GNU General Public License |
||
| 16 | # along with this program; if not, write to the Free Software |
||
| 17 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
||
| 18 | # |
||
| 19 | # Maintainer(s): Klaus Hitschler (klaus.hitschler@gmx.de) |
||
| 20 | #**************************************************************************** |
||
| 21 | |||
| 22 | #**************************************************************************** |
||
| 23 | # |
||
| 24 | # Makefile - makefile for ARW Elektronik PCI to VME interfaces driver |
||
| 25 | # |
||
| 26 | # $Log: Makefile,v $ |
||
| 27 | # Revision 1.2 2004/08/13 19:23:26 klaus |
||
| 28 | # conversion to kernel-version 2.6, released version 3.0 |
||
| 29 | # |
||
| 30 | # Revision 1.1.1.2 2002/10/18 22:14:29 klaus |
||
| 31 | # *** empty log message *** |
||
| 32 | # |
||
| 33 | # Revision 1.1.1.1 2002/10/09 19:36:30 klaus |
||
| 34 | # initial import |
||
| 35 | # |
||
| 36 | # |
||
| 37 | #**************************************************************************** |
||
| 38 | |||
| 39 | #**************************************************************************** |
||
| 40 | # please modify only here if your kernel path is elsewhere located |
||
| 41 | # |
||
| 42 | KERNEL_LOCATION =/usr/src/linux-headers-$(shell uname -r) |
||
| 43 | |||
| 44 | EXTRA_CFLAGS := -I. |
||
| 45 | #**************************************************************************** |
||
| 46 | # removed old kernel source path retrival for support of kernels < 2.2.18! |
||
| 47 | # old KERNSRC = /lib/modules/$(VERSION)/build |
||
| 48 | # |
||
| 49 | KERNSRC := $(KERNEL_LOCATION) |
||
| 50 | |||
| 51 | #**************************************************************************** |
||
| 52 | # whole makefile is based on availability of version.h file |
||
| 53 | # do a forced stop if it is not available |
||
| 54 | # |
||
| 55 | HASVERSION_H := $(shell if test -f /usr/include/linux/version.h ; then echo yes ; else echo no; fi ) |
||
| 56 | |||
| 57 | ifeq ($(HASVERSION_H),no) |
||
| 58 | $(error "Can't find $(KERNEL_LOCATION)/include/linux/version.h !") |
||
| 59 | else |
||
| 60 | |||
| 61 | #**************************************************************************** |
||
| 62 | # removed old version retrival for better cross compile support |
||
| 63 | # old VERSION := $(shell uname -r) |
||
| 64 | # |
||
| 65 | |||
| 66 | |||
| 67 | VERSION := $(shell cpp -dM -I$(KERNEL_LOCATION)/include $(KERNEL_LOCATION)/include/generated/utsrelease.h \ |
||
| 68 | | grep UTS_RELEASE | sed -e 's;[^"]*"\(.*\)";\1;g') |
||
| 69 | |||
| 70 | |||
| 71 | #**************************************************************************** |
||
| 72 | # where the driver should be installed - change here for cross install - currently not functional |
||
| 73 | # |
||
| 74 | INSTALL_LOCATION = /lib/modules/2.6.24-19-generic/ubuntu/misc/ |
||
| 75 | |||
| 76 | #**************************************************************************** |
||
| 77 | # get extracted kernel VERSION and PATCHLEVEL for comparison |
||
| 78 | # decide to use KBUILD for kernels greater 2.6.0 |
||
| 79 | # |
||
| 80 | 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 | USEKBUILD := $(shell if [ $(KVERSION) -gt 2 ] || [ $(KVERSION) -eq 2 ] && [ $(KPATCHLEVEL) -ge 6 ] ; \ |
||
| 83 | then echo "yes" ; else echo "no" ; fi) |
||
| 84 | |||
| 85 | USEKBUILD := yes |
||
| 86 | #**************************************************************************** |
||
| 87 | # some common switches and defines |
||
| 88 | # |
||
| 89 | DBG = __NO_DEBUG__ # or __DEBUG__ to debug the driver |
||
| 90 | SRC = . |
||
| 91 | |||
| 92 | |||
| 93 | #**************************************************************************** |
||
| 94 | # preparation what to build or what to KBUILD |
||
| 95 | # |
||
| 96 | pcivme-objs := $(SRC)/main.o $(SRC)/askpci.o $(SRC)/plxbug.o $(SRC)/fops.o |
||
| 97 | |||
| 98 | |||
| 99 | ifeq ($(USEKBUILD),yes) # <<<<< USEKBUILD >>>>>> |
||
| 100 | |||
| 101 | #**************************************************************************** |
||
| 102 | # what's the target |
||
| 103 | # |
||
| 104 | TARGET = pcivme.ko |
||
| 105 | obj-m := pcivme.o |
||
| 106 | |||
| 107 | #**************************************************************************** |
||
| 108 | # add flags to standard flags |
||
| 109 | # |
||
| 110 | CPPFLAGS += -I$(PWD) -D$(DBG) |
||
| 111 | |||
| 112 | #**************************************************************************** |
||
| 113 | # do it |
||
| 114 | # |
||
| 115 | all : message |
||
| 116 | $(MAKE) -C $(KERNSRC) M=$(PWD) V=$(VERBOSE) $(filter-out all, $(MAKECMDGOLAS)) modules |
||
| 117 | |||
| 118 | else # <<<<< USEKBUILD >>>>>> |
||
| 119 | |||
| 120 | #**************************************************************************** |
||
| 121 | # additional common switches and defines |
||
| 122 | # |
||
| 123 | CC = gcc |
||
| 124 | LD = ld |
||
| 125 | INC = $(KERNSRC)/include |
||
| 126 | DEP = .depend |
||
| 127 | |||
| 128 | #**************************************************************************** |
||
| 129 | # what's the target |
||
| 130 | # |
||
| 131 | TARGET = pcivme.o |
||
| 132 | |||
| 133 | #**************************************************************************** |
||
| 134 | # compile flags |
||
| 135 | # |
||
| 136 | CFLAGS = -O2 -D__KERNEL__ -DMODULE -Wall $(INCLUDE) -D$(DBG) |
||
| 137 | |||
| 138 | #**************************************************************************** |
||
| 139 | # do it |
||
| 140 | # |
||
| 141 | all: message $(TARGET) |
||
| 142 | |||
| 143 | $(TARGET) : $(pcivme-objs) |
||
| 144 | $(LD) -r $^ -o $@ |
||
| 145 | |||
| 146 | #********** catch include file depencies ************************************ |
||
| 147 | ifeq ($(DEP),$(wildcard $(DEP))) |
||
| 148 | |||
| 149 | depend: |
||
| 150 | makedepend -f$(DEP) -- $(CFLAGS) -- $(addsuffix .c, $(basename $(pcivme-objs))) -I$(INC) |
||
| 151 | |||
| 152 | include $(DEP) |
||
| 153 | |||
| 154 | else |
||
| 155 | |||
| 156 | depend: |
||
| 157 | touch $(DEP) |
||
| 158 | makedepend -f$(DEP) -- $(CFLAGS) -- $(addsuffix .c, $(basename $(pcivme-objs))) -I$(INC) |
||
| 159 | endif |
||
| 160 | |||
| 161 | endif # <<<<< USEKBUILD >>>>>> |
||
| 162 | |||
| 163 | #********** clean all for a rebuild ***************************************** |
||
| 164 | clean: |
||
| 165 | rm -f *~ $(TARGET) $(pcivme-objs) |
||
| 166 | |||
| 167 | #********** clean all for a rebuild ***************************************** |
||
| 168 | fresh: |
||
| 169 | touch *.c |
||
| 170 | make all |
||
| 171 | |||
| 172 | #********** informations during build of driver ***************************** |
||
| 173 | .PHONY : message |
||
| 174 | message: |
||
| 175 | @ echo "***" |
||
| 176 | @ echo "*** Host machine kernel version=$(shell uname -r), Driver kernel version=$(VERSION), Path to kernel sources=$(KERNSRC), use KBUILD=$(USEKBUILD)" |
||
| 177 | @ echo "***" |
||
| 178 | |||
| 179 | #********** root installation only ****************************************** |
||
| 180 | install: |
||
| 181 | ./pcivme_load 1 |
||
| 182 | |||
| 183 | endif # <<<<< HASVERSION_H >>>>>> |
||
| 184 | |||
| 185 | # DO NOT DELETE |
||
| 186 |