]> git.sur5r.net Git - groeck-it87/blobdiff - Makefile
Fix FAN_TAC5 detection for IT8665E
[groeck-it87] / Makefile
index 33f43dfe14d5da6f9cd7c57b60f8ee1971201bd4..e702b2c6e61c2e452abb982a82c56af049b30e4c 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,8 +44,17 @@ all: modules
 
 # Targets for running make directly in the external module directory:
 
-modules clean:
+DRIVER_VERSION = $(shell git describe --long)
+
+version.h: it87.c
+       @echo "#define IT87_DRIVER_VERSION      \"$(DRIVER_VERSION)\"" > version.h
+
+modules: version.h
+       @$(MAKE) -C $(KERNEL_BUILD) M=$(CURDIR) $@
+
+clean:
        @$(MAKE) -C $(KERNEL_BUILD) M=$(CURDIR) $@
+       rm -f version.h
 
 install: modules_install