From c23e850325b3d0237b09d4f3b48dffa41c3b2121 Mon Sep 17 00:00:00 2001 From: Jon Richards Date: Sun, 1 Jul 2018 14:10:12 -0700 Subject: [PATCH] Improve distro support 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 | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index f0f3bd5..391b04f 100644 --- 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 -- 2.39.5