]> git.sur5r.net Git - groeck-it87/blobdiff - Makefile
README: Fix typo
[groeck-it87] / Makefile
index 33f43dfe14d5da6f9cd7c57b60f8ee1971201bd4..1b88e2a01ce096f7a5e697b9cc51f297ac5c0150 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -3,8 +3,18 @@ TARGET         := $(shell uname -r)
 # 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)
@@ -34,7 +44,16 @@ all: modules
 
 # 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