POWERFIP_DRV_MAJOR = 1
POWERFIP_DRV_MINOR = 6
POWERFIP_DRV_PATCH = 0
POWERFIP_DRV_VERSION = ${POWERFIP_DRV_MAJOR}.${POWERFIP_DRV_MINOR}.${POWERFIP_DRV_PATCH}

LDDINC=$(PWD)
COMMON_INC_DIR := $(abspath ../../include/)

ccflags-y = -O2
ccflags-y += -I$(LDDINC)
ccflags-y += -I$(COMMON_INC_DIR)
ccflags-y += -DPOWERFIP_DRV_MAJOR=$(POWERFIP_DRV_MAJOR)
ccflags-y += -DPOWERFIP_DRV_MINOR=$(POWERFIP_DRV_MINOR)
ccflags-y += -DPOWERFIP_DRV_PATCH=$(POWERFIP_DRV_PATCH)
ccflags-y += -DPOWERFIP_DRV_VERSION="\"$(POWERFIP_DRV_VERSION)\""
ccflags-y += -DPOWERFIP_DRV_BUILD_DAY=$(LOGPATH)$(shell date '+%-d')
ccflags-y += -DPOWERFIP_DRV_BUILD_MONTH=$(LOGPATH)$(shell date '+%-m')
ccflags-y += -DPOWERFIP_DRV_BUILD_YEAR=$(LOGPATH)$(shell date '+%-y')

TARGET = powerfip

ifneq ($(KERNELRELEASE),)

	$(TARGET)-objs := powerfip-pci.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
