]> git.sur5r.net Git - groeck-nct6775/blob - Makefile
Add driver removal notice
[groeck-nct6775] / Makefile
1 # For building for the current running version of Linux
2 TARGET          := $(shell uname -r)
3 HOME=$(shell pwd)
4 # Or for a specific version
5 #TARGET         := 2.6.33.5
6 KERNEL_MODULES  := /lib/modules/$(TARGET)
7
8 ifneq ("","$(wildcard /usr/src/linux-headers-$(TARGET)/*)")
9 # Ubuntu
10 KERNEL_BUILD    := /usr/src/linux-headers-$(TARGET)
11 else
12 ifneq ("","$(wildcard /usr/src/kernels/$(TARGET)/*)")
13 # Fedora
14 KERNEL_BUILD    := /usr/src/kernels/$(TARGET)
15 else
16 KERNEL_BUILD    := $(KERNEL_MODULES)/build
17 endif
18 endif
19
20 #SYSTEM_MAP     := $(KERNEL_BUILD)/System.map
21 ifneq ("","$(wildcard /boot/System.map-$(TARGET))")
22 SYSTEM_MAP      := /boot/System.map-$(TARGET)
23 else
24 # Arch
25 SYSTEM_MAP      := /proc/kallsyms
26 endif
27
28 DRIVER := nct6775
29
30 # Directory below /lib/modules/$(TARGET)/kernel into which to install
31 # the module:
32 MOD_SUBDIR = drivers/hwmon
33
34 obj-m   := $(DRIVER).o
35
36 MAKEFLAGS += --no-print-directory
37
38 .PHONY: all install modules modules_install clean
39
40 all: modules
41
42 # Targets for running make directly in the external module directory:
43
44 modules clean:
45         @$(MAKE) -C $(KERNEL_BUILD) M=$(CURDIR) $@ EXTRA_CFLAGS=-g
46
47 install: modules_install
48
49 modules_install:
50         cp $(DRIVER).ko $(KERNEL_MODULES)/kernel/$(MOD_SUBDIR)
51         depmod -a -F $(SYSTEM_MAP) $(TARGET)