

ifneq ($(KERNELRELEASE),)
KERNELDIR ?= /lib/modules/$(KERNELRELEASE)/build
else
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
endif
obj-m := ljmgp.o
ljmgp-objs := ljmcore.o

PWD := $(shell pwd)

.PHONY: all
all: clean modules #install

.PHONY: modules
modules:
	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules

.PHONY: clean
clean:
	$(MAKE) -C $(KERNELDIR) M=$(PWD) clean

#.PHONY: install
#install:
#	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install
%.o: %.o.dkms
	@cp $< $@
	@touch $(addsuffix .cmd, $(addprefix $(dir $@), $(addprefix ., $(notdir $@))))
