当前位置: 技术问答>linux和unix
谁能帮我解析一下这个MAKEFILE是怎么写的
来源: 互联网 发布时间:2015-11-15
本文导语: # 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 ($(KERNEL...
# 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是怎么写的?
谢谢了
|
ifeq ($(KERNELRELEASE),)是判断变量KERNELRELEASE是否为空。
标准的gnu makefile文件。看gnu make文档:
http://www.gnu.org/software/make/manual/html_mono/make.html
标准的gnu makefile文件。看gnu make文档:
http://www.gnu.org/software/make/manual/html_mono/make.html
|
100分哪,我给你个中文的地方看看:)
http://www.china-askpro.com/msg22/qa83.shtml
http://www.china-askpro.com/msg22/qa83.shtml
|
找个简单的makefile看看,然后遇到不懂就看看gnu make文档。
这年头,主要工作是修改makefile. 能看懂就好
这年头,主要工作是修改makefile. 能看懂就好
|
这有啥看不懂的??确实没什么好说的。。。
这个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
这个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