Skip to content
Digital Rhyme
Embedded Linux board with oscilloscope probe and driver architecture flow blocks

Makefile Source

Platform driver, probe/remove, modprobe, misc devices, ioctl ABI, and user-space testing.

1ifneq ($(KERNELRELEASE),)
2obj-m += drhyme_sensor.o
3else
4KDIR ?= /lib/modules/$(shell uname -r)/build
5PWD := $(shell pwd)
6USER_CFLAGS ?= -Wall -Wextra -O2
7
8.PHONY: all modules user clean load unload reinstall
9
10all: modules user
11
12modules:
13 $(MAKE) -C $(KDIR) M=$(PWD) modules
14
15user: drhyme_ioctl_test
16
17drhyme_ioctl_test: drhyme_ioctl_test.c drhyme_sensor_uapi.h
18 $(CC) $(USER_CFLAGS) -o $@ drhyme_ioctl_test.c
19
20load: modules
21 sudo modprobe miscdevice || true
22 sudo insmod drhyme_sensor.ko
23
24unload:
25 -sudo rmmod drhyme_sensor
26
27reinstall: unload load
28
29clean:
30 $(MAKE) -C $(KDIR) M=$(PWD) clean
31 $(RM) drhyme_ioctl_test
32endif