1 # For building for the current running version of Linux
2 TARGET := $(shell uname -r)
5 KERNEL_MODULES := /lib/modules/$(TARGET)
6 # KERNEL_BUILD := $(KERNEL_MODULES)/build
7 KERNEL_BUILD := /usr/src/linux-headers-$(TARGET)
9 #SYSTEM_MAP := $(KERNEL_BUILD)/System.map
10 SYSTEM_MAP := /boot/System.map-$(TARGET)
14 # Directory below /lib/modules/$(TARGET)/kernel into which to install
16 MOD_SUBDIR = drivers/hwmon
18 obj-m := $(patsubst %,%.o,$(DRIVER))
19 obj-ko := $(patsubst %,%.ko,$(DRIVER))
21 MAKEFLAGS += --no-print-directory
23 .PHONY: all install modules modules_install clean
27 # Targets for running make directly in the external module directory:
30 @$(MAKE) -C $(KERNEL_BUILD) M=$(CURDIR) $@
32 install: modules_install
35 cp $(DRIVER).ko $(KERNEL_MODULES)/kernel/$(MOD_SUBDIR)
36 depmod -a -F $(SYSTEM_MAP) $(TARGET)