编译cubieboard android 源码过程详解之(五):make
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了编译cubieboard android 源码过程详解之(五):make,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3809字,纯文字阅读大概需要6分钟。
内容图文
前期准备终于做完了,设置好了环境变量,提供了所需的函数,相关文件也已经到位,所有这一且都是为了最终的make。
首先是Makefile的包含关系:
Makefile
build/core/main.mk
build/core/help.mk
build/core/config.mk
build/core/pathmap.mk
buildspec.mk
device/softwinner/apollo-cubieboard/BoardConfig.mk
device/softwinner/crane-common/BoardConfigCommon.mk
build/core/combo/select.mk
build/core/combo/HOST_linux-x86.mk
build/core/combo/TARGET_linux-arm.mk
build/core/combo/javac.mk
build/core/dumpvar.mk
build/core/cleanbuild.mk
很多和 clean 相关的 Makefile,这里不再列出
out/versions_checked.mk
发现我错了,这简直是个无底洞啊,后面分析的时候有些Makefile就不展开了或是只局部分析。想到用脚本来打印这个列表的,但是发现include Makefile时,有些路径包含变量,不得不放弃了。 其实我更关心的是和硬件相关的Makefile。
make命令是在 “android” 目录下执行的,依照make的用法,在该目录下找到 Makefile 文件:
Makefile
只有一行有效语句,就是包含了 “build/core/main.mk” 文件,顺藤摸瓜:
build/core/main.mk
1 # Only use ANDROID_BUILD_SHELL to wrap around bash. 2 # DO NOT use other shells such as zsh. 3 ifdef ANDROID_BUILD_SHELL 4 SHELL := $(ANDROID_BUILD_SHELL) 5else 6 # Use bash, not whatever shell somebody has installed as /bin/sh 7 # This is repeated in config.mk, since envsetup.sh runs that file 8# directly. 9 SHELL := /bin/bash 10 endif
对shell类型有严格的限制,只能用 “$(ANDROID_BUILD_SHELL)” 或 “bash”,这样可以避免一些兼容性问题。
build/core/main.mk
1 # this turns off the suffix rules built into make2.SUFFIXES: 34 # this turns off the RCS / SCCS implicit rules of GNU Make 5 % : RCS/%,v 6 % : RCS/% 7 % : %,v 8 % : s.% 9 % : SCCS/s.%
见注释,关闭一些规则,但现在还没弄懂(TODO)。
build/core/main.mk
如果规则的命令执行错误,将删除已经被修改的目标文件。
build/core/main.mk
1 # check for broken versions of make 2 ifeq (0,$(shell expr $$(echo $(MAKE_VERSION) | sed"s/[^0-9\.].*//") = 3.81)) #只能使用make 3.81 3 $(warning ********************************************************************************) 4 $(warning * You are using version $(MAKE_VERSION) of make.) 5 $(warning * Android can only be built by version 3.81.) 6 $(warning * see http://source.android.com/source/download.html) 7 $(warning ********************************************************************************) 8$(error stopping) 9endif 1011 TOP := . 12 TOPDIR := 1314 BUILD_SYSTEM := $(TOPDIR)build/core
build/core/main.mk
1 # This is the default target. It must be the first declared target. 2 .PHONY: droid 3 DEFAULT_GOAL := droid 4$(DEFAULT_GOAL): 56 # Used to force goals to build. Only use for conditionally defined goals. 7.PHONY: FORCE 8 FORCE:
默认目标为 “droid”,没有什么依赖,直接执行下面的命令。
build/core/main.mk
build/core/help.mk
1 ifeq ($(MAKECMDGOALS),help) 2 dont_bother := true 3endif 4ifeq ($(MAKECMDGOALS),out) 5 dont_bother := true 6endif 7 8.PHONY: help 9help: 10 @echo 11 @echo "Common make targets:"12 @echo "----------------------------------------------------------------------------------"13 @echo "droid Default target"14 @echo "clean (aka clobber) equivalent to rm -rf out/"15 @echo "snod Quickly rebuild the system image from built packages"16 @echo "offline-sdk-docs Generate the HTML for the developer SDK docs"17 @echo "doc-comment-check-docs Check HTML doc links & validity, without generating HTML"18 @echo "libandroid_runtime All the JNI framework stuff"19 @echo "framework All the java framework stuff"20 @echo "services The system server (Java) and friends"21 @echo "help You‘re reading it right now"2223.PHONY: out 24out: 25 @echo "I‘m sure you‘re nice and all, but no thanks."
提供一些帮助。当然这个目标不手动调用是不会执行的,这里不做分析。
build/core/main.mk
1 # Set up various standard variables based on configuration 2 # and host information. 3 include $(BUILD_SYSTEM)/config.mk
原文:http://www.cnblogs.com/JonnyLulu/p/3573547.html
内容总结
以上是互联网集市为您收集整理的编译cubieboard android 源码过程详解之(五):make全部内容,希望文章能够帮你解决编译cubieboard android 源码过程详解之(五):make所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。