···1-# Out of the box, the build with this Makefile only works in FHS environments,
2-# such as on Ubuntu or Debian. On NixOS, you either need to open an FHS
3-# environment using a Nix shell or build this from a specially crafted Nix
4-# derivation.
5-#
6-# This file follows the conventions written down here:
7-# https://docs.kernel.org/kbuild/modules.html
8-# Make it possible to override the kernel src tree location from Nix derivation.
9-KERNEL ?= $(shell uname -r)
10-KERNELDIR ?= /lib/modules/$(KERNEL)/build/
11-ccflags-y := -std=gnu11 -Wno-declaration-after-statement
12-.PHONY: default
13-default: modules
14-# -m: Build as module.
15-obj-m = msi-ec.o
16-.PHONY: modules
17-modules:
18- @#"M=": Module source. Special variable of the kernel's main Makefile.
19- $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
20-.PHONY: modules_install
21-modules_install:
22- $(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install
23-6.11-kernel-patch:
24- git apply 6.11-kernel.patch
25-26-older-kernel-patch:
27- git apply older-kernel.patch