linux_char_driver/Makefile

23 lines
482 B
Makefile
Raw Normal View History

2021-01-08 15:18:01 +03:00
BINARY := kl_char_driver
KERNEL := /lib/modules/$(shell uname -r)/build
KMOD_DIR := $(shell pwd)
ccflags-y += -Wall
obj-m += $(BINARY).o
$(BINARY)-y := main.o
$(BINARY).ko: main.c
make -C $(KERNEL) M=$(KMOD_DIR) modules
showlog:
tail -n10 /var/log/messages
enable: $(BINARY).ko
-insmod $(BINARY).ko
disable:
-rmmod $(BINARY)
check: disable enable
echo wolf228 > /dev/kl_char_dev-0 && head -1 /dev/kl_char_dev-0 && make showlog
clean:
make -C $(KERNEL) M=$(KMOD_DIR) clean