make 报错 *** recipe commences before first target. Stop.

背景

学习linux设备驱动,写第一个hello world程序,make报错:

eden@ubuntu:~/Documents/Project/scull/hello_world$ make
Makefile:17: *** recipe commences before first target.  Stop.

原因

最后查明原因是我的target多了tab

Makefile的rule基本是这样的

targets: prerequisites

        command

        command

        command

targets前不能有tab键

command要使用tab键开始

我错误的写法是:

        ifneq ($(KERNELRELEASE),)hello-objs := hello.oobj-m := hello.oelseKERNELDIR ?= /lib/modules/$(shell uname -r)/buildPWD := $(shell pwd)modules:$(MAKE) -C $(KERNELDIR) M=$(PWD) modulesendif

  改为:

ifneq ($(KERNELRELEASE),)hello-objs := hello.oobj-m := hello.oelseKERNELDIR ?= /lib/modules/$(shell uname -r)/buildPWD := $(shell pwd)modules:$(MAKE) -C $(KERNELDIR) M=$(PWD) modulesendif

问题解决


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部