forked from killghost/nct6775
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
51 lines (39 loc) · 1.2 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# For building for the current running version of Linux
TARGET := $(shell uname -r)
HOME=$(shell pwd)
# Or for a specific version
#TARGET := 2.6.33.5
KERNEL_MODULES := /lib/modules/$(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
# Directory below /lib/modules/$(TARGET)/kernel into which to install
# the module:
MOD_SUBDIR = drivers/hwmon
obj-m := $(DRIVER).o
MAKEFLAGS += --no-print-directory
.PHONY: all install modules modules_install clean
all: modules
# Targets for running make directly in the external module directory:
modules clean:
@$(MAKE) -C $(KERNEL_BUILD) M=$(CURDIR) $@ EXTRA_CFLAGS=-g
install: modules_install
modules_install:
cp $(DRIVER).ko $(KERNEL_MODULES)/kernel/$(MOD_SUBDIR)
depmod -a -F $(SYSTEM_MAP) $(TARGET)