FW_DRV_MAJOR = 3
FW_DRV_MINOR = 3
FW_DRV_PATCH = 0
FW_DRV_VERSION = ${FW_DRV_MAJOR}.${FW_DRV_MINOR}.${FW_DRV_PATCH}

LDDINC=$(PWD)

ccflags-y = -O2
ccflags-y += -I$(LDDINC)
ccflags-y += -DFW_DRV_MAJOR=$(FW_DRV_MAJOR)
ccflags-y += -DFW_DRV_MINOR=$(FW_DRV_MINOR)
ccflags-y += -DFW_DRV_PATCH=$(FW_DRV_PATCH)
ccflags-y += -DFW_DRV_VERSION="\"$(FW_DRV_VERSION)\""
ccflags-y += -DFW_DRV_BUILD_DAY=$(LOGPATH)$(shell date '+%-d')
ccflags-y += -DFW_DRV_BUILD_MONTH=$(LOGPATH)$(shell date '+%-m')
ccflags-y += -DFW_DRV_BUILD_YEAR=$(LOGPATH)$(shell date '+%-y')

TARGET = fipwatcher

ifneq ($(KERNELRELEASE),)

	$(TARGET)-objs := fw-pci.o fw-drv.o
	obj-m := $(TARGET).o

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

modules:
	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules

endif

clean:
	rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c *.mod *.symvers .tmp_versions .cache.mk *.order

depend .depend dep:
	$(CC) -M *.c > .depend

ifeq (.depend,$(wildcard .depend))
	include .depend
endif
