谁能帮我解析一下这个MAKEFILE是怎么写的

betterzy 2006-03-20 11:26:14

# To build modules outside of the kernel tree, we run "make"
# in the kernel source tree; the Makefile these then includes this
# Makefile once again.
# This conditional selects whether we are being included from the
# kernel Makefile or not.
ifeq ($(KERNELRELEASE),)

# Assume the source tree is where the running kernel was built
# You should set KERNELDIR in the environment if it's elsewhere
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
# The current directory is passed to sub-makes as argument
PWD := $(shell pwd)

modules:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules

modules_install:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install

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

.PHONY: modules modules_install clean

else
# called from kernel build system: just declare what our modules are
obj-m := hello.o hellop.o seq.o jit.o jiq.o sleepy.o complete.o \
silly.o faulty.o kdatasize.o kdataalign.o
endif

////////////////////////////////////
ifeq ($(KERNELRELEASE),)是什么意思啊?最好谁能帮我讲讲整个MAKLE是怎么写的?

谢谢了


...全文
447 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
积木 2006-03-23
  • 打赏
  • 举报
回复
这有啥看不懂的??确实没什么好说的。。。
这个make文件里面有几个目标

#编译一个module目标
modules:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
#安装module
modules_install:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install

#清理掉已经编译好的文件
clean:

$(MAKE) 是取MAKE变量的值,剩下的字迹翻译翻译就好了,特别简单。

----------------------------------------
http://blog.csdn.net/goodboy1881
morpheus1977 2006-03-23
  • 打赏
  • 举报
回复
找个简单的makefile看看,然后遇到不懂就看看gnu make文档。

这年头,主要工作是修改makefile. 能看懂就好
arden1019 2006-03-21
  • 打赏
  • 举报
回复
100分哪,我给你个中文的地方看看:)

http://www.china-askpro.com/msg22/qa83.shtml
fierygnu 2006-03-20
  • 打赏
  • 举报
回复
ifeq ($(KERNELRELEASE),)是判断变量KERNELRELEASE是否为空。
标准的gnu makefile文件。看gnu make文档:
http://www.gnu.org/software/make/manual/html_mono/make.html

23,110

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 应用程序开发区
社区管理员
  • 应用程序开发区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧