obj-m := uio_netx.o

# kernel version to build against.
# DKMS passes KVERSION=<kernelver> on the command line (see dkms.conf), which
# overrides this; the fallback to the running kernel only applies to manual
# builds.
KVERSION ?= $(shell uname -r)
TMPKDIR := /lib/modules/$(KVERSION)/build
TMPINSTALLPATH := kernel/drivers/uio/

ifneq ($(strip $(KDIR)),)
    TMPKDIR = $(KDIR)
endif

ifneq ($(strip $(INSTALL_PATH)),)
    TMPINSTALLPATH = $(INSTALL_PATH)
endif

ifndef DMA_DISABLE
    ccflags-y += -DDMA_SUPPORT
endif

PWD := $(shell pwd)
default:
	$(MAKE) -C $(TMPKDIR) M=$(PWD) modules

clean:
	rm -f *.o *.ko *.order *.mod* Module.symvers

modules_install:
	$(MAKE) INSTALL_MOD_DIR=$(TMPINSTALLPATH) -C $(TMPKDIR) M=$(PWD) modules_install
