# point this at your kernel tree, or kernel headers package
KERNELDIR := /usr/src/kernel-headers

ifndef KERNELDIR
$(error KERNELDIR not defined. Modify the Makefile to point to the location of your kernel headers or source, or build with 'make KERNELDIR=<directory>' the try again)
endif

obj-m := et8ek8.o 

omap34xxcam-mod-objs := omap34xxcam-daemon.o omap34xxcam-daemon-req.o omap34xxcam.o
obj-m += omap34xxcam-mod.o 

isp/isp-mod-objs := isp/isp.o isp/ispstat.o isp/isppreview.o isp/ispresizer.o isp/isp_af.o isp/ispccdc.o isp/ispcsi2.o isp/isph3a.o isp/isphist.o 
obj-m += isp/isp-mod.o 

obj-m += isp/omap_previewer_hack.o 

obj-m += board-rx51-camera.o

all: modules

modules:
	$(MAKE) -C $(KERNELDIR) M=`pwd` modules

clean:
	$(RM) *.o .depend .*.cmd *.ko *.mod.c Module.symvers modules.order
	$(RM) -R .tmp_versions
	$(RM) isp/*.o isp/.depend isp/.*.cmd isp/*.ko isp/*.mod.c isp/Module.symvers isp/modules.order 
	$(RM) -R isp/.tmp_versions
	$(RM) -rf debian/fcam-drivers

deb:
	dpkg-buildpackage -rfakeroot -b -uc

deb-src:
	dpkg-buildpackage -rfakeroot -sa -S

install: 
	mkdir -p $(DESTDIR)/usr/share/fcam
	strip --strip-unneeded *.ko isp/*.ko
	cp *.ko isp/*.ko fcam.conf fcam-warning.txt $(DESTDIR)/usr/share/fcam/
