blob: 1ad97125710e077ed32a4bcc68fe5a6bb5bd012b (
plain)
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
|
# Out-of-tree build for the patched hid-magicmouse.
KDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
KERNEL_CONFIG := $(firstword $(wildcard $(KDIR)/include/config/auto.conf $(KDIR)/.config))
CLANG_KERNEL := $(if $(KERNEL_CONFIG),$(shell grep -q '^CONFIG_CC_IS_CLANG=y' $(KERNEL_CONFIG) && echo y))
KMAKE_FLAGS :=
ifneq ($(origin CC),default)
KMAKE_FLAGS += CC=$(CC)
else ifeq ($(CLANG_KERNEL),y)
KMAKE_FLAGS += CC=clang
endif
ifneq ($(origin LLVM),undefined)
KMAKE_FLAGS += LLVM=$(LLVM)
else
ifeq ($(CLANG_KERNEL),y)
ifeq ($(origin CC),default)
KMAKE_FLAGS += LLVM=1
endif
endif
endif
ifneq ($(wildcard $(KDIR)/drivers/hid/hid-ids.h),)
ccflags-y += -I$(KDIR)/drivers/hid
else
ccflags-y += -I$(PWD)/compat
endif
ccflags-y += -include $(PWD)/compat/kernel-compat.h
obj-m += hid-magicmouse.o
KMAKE = $(MAKE) -C $(KDIR) M=$(PWD) $(KMAKE_FLAGS)
.PHONY: all clean install modules_install
all:
$(KMAKE) modules
clean:
$(KMAKE) clean
install: modules_install
modules_install:
$(KMAKE) modules_install
depmod -a
|