#
# Makefile	WANPIPE WAN Router Installation/Removal Makefile
#
# Copyright	(c) 2007, Sangoma Technologies Inc.
#
#		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.
# ----------------------------------------------------------------------------   
# Author:  Nenad Corbic <ncorbic@sangoma.com> 
#

PWD=$(shell pwd)
KBUILD_VERBOSE=0

EXTRA_CFLAGS=
EXTRA_FLAGS=

#Kernel version and location
ifndef KVER
	KVER=$(shell uname -r)
endif
ifndef KMOD
	KMOD=/lib/modules/$(KVER)
endif
ifndef KDIR
	KDIR=$(KMOD)/build
endif
ifndef KINSTDIR
	KINSTDIR=$(KMOD)/kernel
endif

ifndef ARCH
	ARCH=$(shell uname -m)
endif

# First pass, kernel Makefile reads module objects
ifneq ($(KERNELRELEASE),)

# Second pass, the actual build.
else

#This will check for zaptel, kenrel source and build utilites and kernel modules
#within local directory structure
all: 
	$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C $(KDIR) SUBDIRS=$(PWD)/src modules  

clean: 
	$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C $(KDIR) SUBDIRS=$(PWD)/src clean  

install:
	cp -f src/ks8842_pci.ko $(KINSTDIR)/drivers/net
	depmod -a

endif
