且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

不能在内核模块生成文件中使用通配符

更新时间:2023-09-25 21:32:52

这里有两个问题.第一个实际上只依赖于 KSRC 变量和递归调用.第二个 make 只需要 CFILESOBJSobj-mhello_world-y 变量,并且不需要不要使用 all: 目标.因此,您的调试显示,第一个 Make 的 CFILES 设置正确,没有使用它,并且没有在第二个 make 中显示它.

There are two makes happening here. The first really only relies on the KSRC variable and the recursive make call. The second make only needs the CFILES, OBJS, obj-m, and hello_world-y variables, and doesn't make use of the all: target. So your debug is showing that CFILES is set correctly for the first Make, where it's not being used, and is not showing it in the second make, where it is.

您正在从不同的目录扩展通配符,并且没有选择正确的文件.试试这个 CFILES:

You're wildcard expanding from a different directory, and not picking up the right files. Try this for CFILES:

CFILES := $(notdir $(wildcard $M/hello.c*))