]> git.sur5r.net Git - groeck-nct6775/commitdiff
Improve distro support 58/head
authorJon Richards <jon@jonrichards.net>
Sun, 1 Jul 2018 21:10:12 +0000 (14:10 -0700)
committerJon Richards <jon@jonrichards.net>
Sun, 1 Jul 2018 21:10:12 +0000 (14:10 -0700)
Taken from example here:
https://github.com/groeck/it87/blob/master/Makefile, specifically
https://github.com/groeck/it87/commit/74647ea3f4d461e062177f46ad85f71d0c4af811
and
https://github.com/groeck/it87/commit/3436b280785dbb05a73c5468d09d1e49e8ce09c9 commits.

Makefile

index f0f3bd5db9e4c31e4a11ffb0b853127a9ee2a949..391b04f570493219fd0d488e3d12916707fad85d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -4,11 +4,26 @@ HOME=$(shell pwd)
 # Or for a specific version
 #TARGET                := 2.6.33.5
 KERNEL_MODULES := /lib/modules/$(TARGET)
-# KERNEL_BUILD := $(KERNEL_MODULES)/build
-KERNEL_BUILD   := /usr/src/linux-headers-$(TARGET)
 
-#SYSTEM_MAP    := $(KERNEL_BUILD)/System.map
-SYSTEM_MAP     := /boot/System.map-$(TARGET)
+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
+ifneq ("","$(wildcard /boot/System.map-$(TARGET))")
+SYSTEM_MAP      := /boot/System.map-$(TARGET)
+else
+# Arch
+SYSTEM_MAP      := /proc/kallsyms
+endif
 
 DRIVER := nct6775