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