帮我看看Makefile

内核编译和嵌入式产品的设计与开发
回复
头像
dtczhl
帖子: 70
注册时间: 2011-04-17 11:44

帮我看看Makefile

#1

帖子 dtczhl » 2011-11-05 20:43

书上抄的,却不能make,可能跟空格有关
因为书上看不清楚哪里有空格,哪里没有,现在我对Makefie也不太懂
哪个大侠能改改哪里有问题阿

代码: 全选

#DEBUG = y
ifeq($(DEBUG),y)
	DEBFLAGS = -O -g -DSCULL_DEBUG
else
	DEBFLAGS = -O2
endif

CFLAGS += $(DEBFLAGS)
CFLAGS += -I$(LDDINC)

ifneq($(KERNELRELEASE),)
obj-m := simple_chrdev.o
else
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)

modules:
	$(MAKE) -C $(KERNELDIR) M=$(PWD) LDDINC=$(PWD)/../include modules
endif

clean:
	rm -rf*.o *~core.depend .*.cmd *.ko *.mod.c .tmp_versions

depend .depend dep:
	$(CC) $(CFLAGS) -M *.c > .depend

ifeq(.depend.$(wildcard .depend))
include .depend
endif
头像
wind185
帖子: 109
注册时间: 2006-10-22 13:51

Re: 帮我看看Makefile

#2

帖子 wind185 » 2011-11-05 22:13

比如
depend .depend dep:
<空格>$(CC) $(CFLAGS) -M *.c > .depend

应该是
depend .depend dep:
<TAB>$(CC) $(CFLAGS) -M *.c > .depend

前面应该是TAB而不是用空格缩进

我记得是这样的!
头像
dtczhl
帖子: 70
注册时间: 2011-04-17 11:44

Re: 帮我看看Makefile

#3

帖子 dtczhl » 2011-11-06 10:01

wind185 写了:比如
depend .depend dep:
<空格>$(CC) $(CFLAGS) -M *.c > .depend

应该是
depend .depend dep:
<TAB>$(CC) $(CFLAGS) -M *.c > .depend

前面应该是TAB而不是用空格缩进

我记得是这样的!
你能帮我写份然后发给我吗?
头像
dtczhl
帖子: 70
注册时间: 2011-04-17 11:44

Re: 帮我看看Makefile

#4

帖子 dtczhl » 2011-11-06 10:37

已解决,对照网上的例子改了改
回复