include $(DOOB_ROOT)/makefiles/path.mk

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

ifeq ($(TEST),y)
  DEBFLAGS = -DUNIT_TEST -DCLOCK_RESET
endif

ifeq ($(TOOL),y)
  DEBFLAGS = -DCONV_VECTOR
endif




# ifeq ($(CLOCK_RESET),y)
#   DEBFLAGS = -DCLOCK_RESET
# endif




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

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

# obj-m	:= gpio_irq.o test0.o test1.o

psoc_program-objs = psoc_fw.o psoc_prog.o
obj-m	= psoc_program.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
