# Or specific version
#TARGET := 2.6.33.5
KERNEL_MODULES := /lib/modules/$(TARGET)
-# KERNEL_BUILD := $(KERNEL_MODULES)/build
+
+ifneq ("","$(wildcard /usr/src/linux-headers-$(TARGET)/*)")
+# Ubuntu
KERNEL_BUILD := /usr/src/linux-headers-$(TARGET)
+else
+ifneq ("","$(wildcard /usr/src/kernels/$(TARGET)/*)")
+# Fedora
+KERNEL_BUILD := /usr/src/kernels/$(TARGET)
+else
+KERNEL_BUILD := $(KERNEL_MODULES)/build
+endif
+endif
#SYSTEM_MAP := $(KERNEL_BUILD)/System.map
SYSTEM_MAP := /boot/System.map-$(TARGET)
# Targets for running make directly in the external module directory:
-modules clean:
+ifneq ("","$(wildcard .git/*)")
+IT87_CFLAGS=-DIT87_DRIVER_VERSION='\"$(shell git describe --long)\"'
+else
+IT87_CFLAGS=-DIT87_DRIVER_VERSION='\"<unknown>\"'
+endif
+
+modules:
+ @$(MAKE) EXTRA_CFLAGS="$(IT87_CFLAGS)" -C $(KERNEL_BUILD) M=$(CURDIR) $@
+
+clean:
@$(MAKE) -C $(KERNEL_BUILD) M=$(CURDIR) $@
install: modules_install