0

我正在尝试为内核模块编写一个 makefile,但无法让它工作。运行以下有这个输出

$ make
make: Nothing to be done for 'all'.

但是直接在终端上运行 make 命令会导致

$ make -C /lib/modules/$(uname -r)/build M=$(pwd) modules
make: Entering directory '/usr/src/linux-headers-3.5.0-17-generic'
   CC [M] <blah>
   Building modules, stage 2
   <blah>
make: Leaving directory...

我的 Makefile 的内容是(源文件是 main.c)

obj-m += main.o
all:
    make -C /lib/modules/$(shell uname -r)/build M=$(shell pwd) modules

在尝试使用 makefile 之前,我确实删除了 *.o 和 *.ko。更改alldefault也无济于事。

4

2 回答 2

3

The most likely issue is that you didn't use a real tab character to begin the line reading make -C ..., but instead used multiple spaces. make requires that commands all begin with a tab character.

于 2013-01-09T00:51:32.320 回答
0
于 2013-01-09T00:54:49.193 回答