NAME = vub300

KERNELDIR := /lib/modules/`uname -r`/build
MODULEDIR := /lib/modules/`uname -r`/extra

OFFLOADS =
OFFLOADS += vub_00893200_00891402_00891403_00891404_00891405_00891406.bin
OFFLOADS += vub_02DF9103_02DF9103.bin
OFFLOADS += vub_02DF9103_02DF9104_02DF9105.bin
OFFLOADS += vub_03030100_03030100.bin
OFFLOADS += vub_default.bin


FIRMWARE = $(OFFLOADS:%=/lib/firmware/%)

all:        module install firmware

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

install::
	@if lsmod | grep $(NAME) ; then rmmod $(NAME) ; fi
	$(MAKE) -C $(KERNELDIR) M=`pwd` modules_install

firmware:	    $(FIRMWARE)

/lib/firmware/vub_00893200_00891402_00891403_00891404_00891405_00891406.bin:	vub_00893200_00891402_00891403_00891404_00891405_00891406.bin
				cp -v $? $@
	
/lib/firmware/vub_02DF9103_02DF9103.bin:	vub_02DF9103_02DF9103.bin
				cp -v $? $@
	
/lib/firmware/vub_02DF9103_02DF9104_02DF9105.bin:	vub_02DF9103_02DF9104_02DF9105.bin
				cp -v $? $@
	
/lib/firmware/vub_03030100_03030100.bin:	vub_03030100_03030100.bin
				cp -v $? $@
	
/lib/firmware/vub_default.bin:	vub_default.bin
				cp -v $? $@
	

%:	%.c
	gcc $? -o $@

clean:
	rm -f *~ .tmp_versions/*.mod .*.cmd Module.markers Module.symvers *.o modules.order *.ko *.mod.c
	@if [ -d .tmp_versions ]; then rmdir .tmp_versions ; fi
	@rm -f $(MODULEDIR)/$(NAME).ko



