Rev 43 | Blame | Compare with Previous | Last modification | View Log | RSS feed
#****************************************************************************# Copyright (C) 2000-2004 ARW Elektronik Germany### This program is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 2 of the License, or# (at your option) any later version.## This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.## Maintainer(s): Klaus Hitschler (klaus.hitschler@gmx.de)#****************************************************************************#****************************************************************************## Makefile - makefile for ARW Elektronik PCI to VME interfaces driver## $Log: Makefile,v $# Revision 1.2 2004/08/13 19:23:26 klaus# conversion to kernel-version 2.6, released version 3.0## Revision 1.1.1.2 2002/10/18 22:14:29 klaus# *** empty log message ***## Revision 1.1.1.1 2002/10/09 19:36:30 klaus# initial import###****************************************************************************#****************************************************************************# please modify only here if your kernel path is elsewhere located#KERNEL_LOCATION =/usr/src/linux-headers-$(shell uname -r)EXTRA_CFLAGS := -I.#****************************************************************************# removed old kernel source path retrival for support of kernels < 2.2.18!# old KERNSRC = /lib/modules/$(VERSION)/build#KERNSRC := $(KERNEL_LOCATION)#****************************************************************************# whole makefile is based on availability of version.h file# do a forced stop if it is not available#HASVERSION_H := $(shell if test -f /usr/include/linux/version.h ; then echo yes ; else echo no; fi )ifeq ($(HASVERSION_H),no)$(error "Can't find $(KERNEL_LOCATION)/include/linux/version.h !")else#****************************************************************************# removed old version retrival for better cross compile support# old VERSION := $(shell uname -r)#VERSION := $(shell cpp -dM -I$(KERNEL_LOCATION)/include $(KERNEL_LOCATION)/include/generated/utsrelease.h \| grep UTS_RELEASE | sed -e 's;[^"]*"\(.*\)";\1;g')#****************************************************************************# where the driver should be installed - change here for cross install - currently not functional#INSTALL_LOCATION = /lib/modules/$(shell uname -r)/kernel/drivers/misc/#****************************************************************************# get extracted kernel VERSION and PATCHLEVEL for comparison# decide to use KBUILD for kernels greater 2.6.0#KVERSION := $(shell echo $(VERSION) | sed -e 's;\([1-9]\)\..*;\1;g' )KPATCHLEVEL := $(shell echo $(VERSION) | sed -e 's;[1-9]\.\([0-9]\{0,3\}\)\..*;\1;g' )USEKBUILD := yes#****************************************************************************# some common switches and defines##DBG = __NO_DEBUG__ # or __DEBUG__ to debug the driverDBG = __DEBUG__SRC = .#****************************************************************************# preparation what to build or what to KBUILD#pcivme-objs := $(SRC)/main.o $(SRC)/askpci.o $(SRC)/plxbug.o $(SRC)/fops.oifeq ($(USEKBUILD),yes) # <<<<< USEKBUILD >>>>>>#****************************************************************************# what's the target#TARGET = pcivme.koobj-m := pcivme.o#****************************************************************************# add flags to standard flags#CPPFLAGS += -I$(PWD) -D$(DBG)#****************************************************************************# do it#KBUILD_CPPFLAGS += -D$(DBG)KBUILD_CPPFLAGS += -Wno-int-to-pointer-cast -Wno-pointer-to-int-castall : message$(MAKE) -C $(KERNSRC) M=$(PWD) V=$(VERBOSE) $(filter-out all, $(MAKECMDGOLAS)) moduleselse # <<<<< USEKBUILD >>>>>>#****************************************************************************# additional common switches and defines#CC = gccLD = ldINC = $(KERNSRC)/includeDEP = .depend#****************************************************************************# what's the target#TARGET = pcivme.o#****************************************************************************# compile flags#CFLAGS = -O2 -D__KERNEL__ -DMODULE -Wall $(INCLUDE) -D$(DBG)#****************************************************************************# do it#all: message $(TARGET)$(TARGET) : $(pcivme-objs)$(LD) -r $^ -o $@#********** catch include file depencies ************************************ifeq ($(DEP),$(wildcard $(DEP)))depend:makedepend -f$(DEP) -- $(CFLAGS) -- $(addsuffix .c, $(basename $(pcivme-objs))) -I$(INC)include $(DEP)elsedepend:touch $(DEP)makedepend -f$(DEP) -- $(CFLAGS) -- $(addsuffix .c, $(basename $(pcivme-objs))) -I$(INC)endifendif # <<<<< USEKBUILD >>>>>>#********** clean all for a rebuild *****************************************clean:rm -f *~ $(TARGET) $(pcivme-objs)#********** clean all for a rebuild *****************************************fresh:touch *.cmake all#********** informations during build of driver *****************************.PHONY : messagemessage:@ echo "***"@ echo "*** Host machine kernel version=$(shell uname -r), Driver kernel version=$(VERSION), Path to kernel sources=$(KERNSRC), use KBUILD=$(USEKBUILD)"@ echo "***"#********** root installation only ******************************************install:@echo "** Removing existing module pcivme from kernel"-rmmod pcivme@echo "** Installing new module into the module directory"-cp -r pcivme.ko $(INSTALL_LOCATION)@echo "** Loading new module with ./pcivme_load 1"./pcivme_load 1endif # <<<<< HASVERSION_H >>>>>># DO NOT DELETE