include $(DOOB_ROOT)/makefiles/path.mk
# Comment/uncomment the following line to disable/enable debugging

# DEBUG = y


# Add your debugging flag (or not) to CFLAGS
ifeq ($(DEBUG),y)
#  DEBFLAGS = -O -g -DDEBUG # "-O" is needed to expand inlines
  DEBFLAGS = -O -g -DDBGPK -D_DBGPK_ -DDEBUG
else
  DEBFLAGS = -O2
endif

CFLAGS += $(DEBFLAGS)
CFLAGS += -I..

ifneq ($(KERNELRELEASE),)
# call from kernel build system

# obj-m	:= gpio_irq.o test0.o test1.o
ak4_reader-objs := gpio_reader.o card_reader.o card_buf.o reader_buf.o
obj-m	:= ak4_reader.o

else
KERNELDIR = $(path_kernel)
PWD       := $(shell pwd)

default:
	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules V=1 ARCH=arm CROSS_COMPILE="arm-none-linux-gnueabi-"

endif


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

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


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