1
0
out-of-tree/examples/kernel-module/Makefile

18 lines
536 B
Makefile
Raw Normal View History

2018-10-07 10:48:25 +00:00
# out-of-tree called make with two arguments -- kernel headers path and name
# of target binary that MUST be produced by makefile
2018-10-07 17:53:07 +00:00
# - $(TARGET).ko_test: name of test binary that MUST be produced by makefile
2018-10-07 10:48:25 +00:00
# e.g.:
# make KERNEL=/lib/modules/4.8.0-58-generic/build TARGET=hello-world.ko
KERNEL := /lib/modules/$(shell uname -r)/build
TARGET := out-of-tree-module-example
obj-m += $(TARGET).o
$(TARGET)-objs = module.o
all:
make -C $(KERNEL) M=$(PWD) modules
2018-10-07 17:53:07 +00:00
cp test.sh $(TARGET).ko_test
2018-10-07 10:48:25 +00:00
clean:
make -C $(KERNEL) M=$(PWD) clean