m、mm、mmm命令差异

本文介绍了在Android源码中,`. build/envsetup.sh`后的关键构建命令——`lunch`用于选择平台,`m`用于编译所有模块,`mm`针对当前目录下的模块进行编译,而`mmm`则用于编译指定路径的模块,这些命令都是基于存在Android.mk文件的前提。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


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文件:

mmm

eg:当前目录为源码根目录,编译\hardware\libhardware_legacy\power模块: 
. build/envsetup.sh 
mmm -B hardware/libhardware_legacy/power/     //-B全新编译

或者 : 
. build/envsetup.sh 
cd hardware/libhardware_legacy/power/ 
mm
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值