# Comment/uncomment the following line to disable/enable debugging
#DEBUG = y
#LDDINC=

# Add your debugging flag (or not) to CFLAGS
ifeq ($(DEBUG),y)
  DEBFLAGS = -O -g -DSKYPOPEN_DEBUG -Wunused-but-set-variable  # "-O" is needed to expand inlines
else
  DEBFLAGS = -O2 -Wall -Wunused-but-set-variable
endif

EXTRA_CFLAGS += $(DEBFLAGS)
EXTRA_CFLAGS += -I$(LDDINC)

skypopen-objs := main.o

obj-m   := skypopen.o


PWD     ?= `pwd`
KERNELRELEASE ?= `uname -r`
KERNELDIR ?= /lib/modules/$(KERNELRELEASE)/build
KMAKE := $(MAKE) -C $(KERNELDIR) M=$(PWD)

all: modules

modules:
	$(KMAKE)  LDDINC=$(PWD)/../include modules

module_install:
	$(KMAKE)  modules_install

install: module_install


clean:
	$(MAKE) -C $(KERNELDIR) M=$(PWD) clean
#	rm -fr $(PACKAGE)

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


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


