##########################################################################
#                                                                        #
#  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.                                   #
#                                                                        #
#  Changelog                                                             #
#    2005-02-01  <tengel@sonic.net>  Initial version                     #
#                                                                        #
##########################################################################

MODULE_NAME   := nokia_dku2
MODULE_ROOT   := /lib/modules/$(shell uname -r)/kernel/drivers/usb/serial

KERN_SOURCE   := /lib/modules/$(shell uname -r)/build
PWD           := $(shell pwd)
EXTRA_CFLAGS  := -I/lib/modules/$(shell uname -r)/source/drivers/usb/serial

obj-m         := $(MODULE_NAME).o
MODULE_OBJECT := $(MODULE_NAME).ko

all: module

module:
	@$(MAKE) -C $(KERN_SOURCE) SUBDIRS=$(PWD) modules

clean:
	@rm -f .*.{cmd,flags}
	@rm -f $(MODULE_NAME).{o,ko,mod.{o,c}} built-in.o $(VERSION_HEADER)
	@rm -fr .tmp_versions

install:
	if ! [ -f $(MODULE_OBJECT) ]; then \
	module; \
	fi
	install -m 744 -o 0 -g 0 $(MODULE_OBJECT) $(MODULE_ROOT)
	/sbin/depmod -a

