#***************************************************************************
# Makefile to build Driver executable
#***************************************************************************

PWD	:= $(shell pwd)
INCLUDES = -I$(KERNEL_SOURCE_PATH)/include -isystem $(PWD)/../inc
 #if no kernel source path was specified, correct INCLUDES to reflect that
ifeq ($(KERNEL_SOURCE_PATH),)
     INCLUDES = -I/lib/modules/`uname -r`/build/include -isystem ../inc
endif
EXTRA_CFLAGS = $(PSTN_DEF) -Wall -O3 $(INCLUDES) -fno-common -DCONFIG_MODULES -DMODULE -DINTEL_MODEM_TYPE=\"$(INTEL_MODEM)\"
ifeq ($(537),537)
EXTRA_CFLAGS += -DTARGET_CATAWBA
else
EXTRA_CFLAGS += -DTARGET_SELAH
endif

DRIVER_OBJS = coredrv.o clmmain.o rts.o task.o uart.o wwh_dflt.o locks.o \
		softserial_io.o softserial_ioctl.o softserial.o

ifeq ($(537),537)
537_OBJS = $(DRIVER_OBJS) afedsp_int.o
endif

clean:
	rm -f *.ko .*.o.cmd *.mod.c .*.ko.cmd *.o *~ core Module.* modules.*
	rm -rf .tmp_versions

ifeq ($(537),537)
537core_26:
	$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

537core:  $(537_OBJS)
#	strip --strip-debug 537core.lib
	$(LD) -r $(537_OBJS) 537core.lib -o Intel537.o
else
536core_26:
	$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

536core: $(DRIVER_OBJS)
	strip --strip-debug 536core.lib
	$(LD) -r $(DRIVER_OBJS) 536core.lib -o Intel536.o
endif

ifeq ($(KERNEL_SOURCE_PATH),)
KDIR	:= /lib/modules/$(shell uname -r)/build
else
KDIR=$(KERNEL_SOURCE_PATH)
endif

ifeq ($(537),537)
obj-m := Intel537.o

Intel537-objs := $(537_OBJS) 537core.lib

else
obj-m := Intel536.o

Intel536-objs := $(DRIVER_OBJS) 536core.lib

endif
# DO NOT DELETE
