I have Makefile like this:
obj-m += some_kernel_module.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
It works when I run make
from build machine locally (when my current directory is /home/myaccount/src/some_kernel_module/
).
However when I'm trying to compile this remotely in Netbeans I'm getting this error:
/usr/src/linux-headers-3.16.0-6-common/scripts/Makefile.build:44: /home/myaccount/Makefile: No such file or directory
I guess that's because I have M=$(PWD)
in my Makefile, and Netbeans Build Host current directory is my home (/home/myaccount
) instead of project directory /home/myaccount/src/some_kernel_module/
).
How can I fix that?
I have entered path manually and it works locally and remotely:
obj-m += some_kernel_module.o
all:
make -C /lib/modules/$(shell uname -r)/build M=/home/myaccount/src/some_kernel_module/ modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=/home/myaccount/src/some_kernel_module/ clean
But this is not an answer. I don't want this absolute path in my Makefile.