# Makefile for cbm kernel 2.6 module.              -*-makefile-*-
#
# Copyright (C) 2008 Mario Fetka <mario-fetka@gmx.at>
#
# Licensed under the GNU General Public License, v2.0 or later,
# at your option.  See the file COPYING for details, or the web
# page http://www.gnu.org/copyleft/gpl.html
#


MODULE_NAME = cbm
$(MODULE_NAME)-objs = cbm_module.o

# First pass, kernel Makefile reads module objects
ifneq ($(KERNELRELEASE),)
obj-m	:= $(MODULE_NAME).o

EXTRA_CFLAGS += -I$(PWD)/../include -I$(PWD)/../../include -I$(PWD)/../../include/LINUX

# Second pass, the actual build.
else
KVER    ?= $(shell uname -r)
KDIR	:= /lib/modules/$(KVER)/build
PWD	:= $(shell pwd)

all:
	$(MAKE) -C $(KDIR) M=$(PWD) modules

clean:
	$(MAKE) -C $(KDIR) M=$(PWD) clean

help:
	$(MAKE) -C $(KDIR) M=$(PWD) help


# Indents the kernel source the way linux/Documentation/CodingStyle.txt
# wants it to be.
indent:
	indent -kr -i8 $($(MODULE_NAME)-objs:.o=.c)

install:
	$(MAKE) -C $(KDIR) M=$(PWD) modules_install

endif