Merge pull request #19 from discover02/patch-1

kernel version based target creation
This commit is contained in:
Frederic BOLTZ 2022-02-12 23:42:09 +01:00 committed by GitHub
commit 922804f6b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,12 +1,19 @@
obj-m += nct6687.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(shell pwd) modules
curpwd := $(shell pwd)
kver := $(shell uname -r)
install: all
sudo cp nct6687.ko /lib/modules/$(shell uname -r)/kernel/drivers/hwmon/
build:
[ -d "${curpwd}/${kver}" ] && rm -rf ${curpwd}/${kver}
mkdir ${curpwd}/${kver}
cp ${curpwd}/Makefile ${curpwd}/nct6687.c ${curpwd}/${kver}
cd ${curpwd}/${kver}
make -C /lib/modules/${kver}/build M=${curpwd}/${kver} modules
install: build
sudo cp ${curpwd}/${kver}/nct6687.ko /lib/modules/${kver}/kernel/drivers/hwmon/
sudo depmod
sudo modprobe nct6687
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(shell pwd) clean
make -C /lib/modules/${kver}/build M=${curpwd}/${kver} clean