Help me figure out how to write a makefile to build a kernel module for Linux. I have such a Makefile :
obj-m += hello.o all: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules clean: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean - What is obj-m for?
- make -C goes to the directory. What is the build directory at the end of the path for?
- M = $ (PWD) What does M relate to? Is this a command variable or key? Where is $ (PWD) defined and what is the value of this variable?
- What are modules and clean at the end of the first and second command?