# Makefile for the plustek scanner driver (kernel-module)
#
###############################################################################

#
# retrieve the version numbers
#

# VERSIONSTR = $(shell grep "define BACKEND_VERSION" $(PWD)/plustek_pp.c | cut -b25-50 )
#
# extra flags
#
# EXTRA_CFLAGS += -D_PTDRV_VERSTR=\"$(VERSIONSTR)\"
VERSIONSTR = "0.43-5"
EXTRA_CFLAGS += -D_PTDRV_VERSTR=\"$(VERSIONSTR)\"

ifdef $(CONFIG_PT_DRV_DEBUG)
	EXTRA_CFLAGS += -DDEBUG
endif

#
# the module name
#
TARGET := pt_drv
MODULE := $(TARGET).ko

#
# our files...
#
NAMES := dac detect genericio image map misc models io procfs
NAMES := $(NAMES) motor p9636 ptdrv scale tpa p48xx p12 p12ccd
NAMES := $(addprefix plustek-pp_, $(NAMES))
OBJS  := $(addsuffix .o, $(NAMES))

#
# now the kernel magic
#
ifneq ($(KERNELRELEASE),)
obj-$(CONFIG_PT_DRV) += $(TARGET).o

$(TARGET)-objs := $(OBJS)

else
KDIR := /lib/modules/$(shell uname -r)/build
PWD  := $(shell pwd)

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

