android源码目录下的build/envsetup.sh文件开头可以看到如下描述:
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function help() {cat <<EOF
Invoke ". build/envsetup.sh" from your shell to add the following functions to your environment:
- croot: Changes directory to the top of the tree.
- m: Makes from the top of the tree.
- mm: Builds all of the modules in the current directory.
- mmm: Builds all of the modules in the supplied directories.
- cgrep: Greps on all local C/C++ files.
- jgrep: Greps on all local Java files.
- resgrep: Greps on all local res/*.xml files.
- godir: Go to the directory containing a file.
Look at the source to view more functions. The complete list is:
EOF
T=$(gettop)
local A
A=""
for i in `cat $T/build/envsetup.sh | sed -n "/^function /s/function \([a-z_]*\).*/\1/p" | sort`; do
A="$A $i"
done
echo $A
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
设置环境,在src目录执行如下命令:
. build/envsetup.sh
对平台的配置:
lunch
再选择对应平台
编译所有的模块:
m
编译当前目录下的模块,当前目录下要有Android.mk文件:
mm
编译指定路径下的模块,指定路径下要有Android.mk文件:
mmmeg:当前目录为源码根目录,编译\hardware\libhardware_legacy\power模块:
. build/envsetup.sh
mmm -B hardware/libhardware_legacy/power/ //-B全新编译
或者 :
. build/envsetup.sh
cd hardware/libhardware_legacy/power/
mm
本文介绍了在Android源码中,`. build/envsetup.sh`后的关键构建命令——`lunch`用于选择平台,`m`用于编译所有模块,`mm`针对当前目录下的模块进行编译,而`mmm`则用于编译指定路径的模块,这些命令都是基于存在Android.mk文件的前提。
2850

被折叠的 条评论
为什么被折叠?



