在Android Source Code中有envsetup.sh檔案,當執行過此檔案後,可以大幅將build的過程簡單化、自動化

此檔案在src(android source code 位置)/build/中
所以可以執行以下指令
cd /src/build/
. envsetup.sh


可以使用help來檢示有哪些指令可以使用
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.
- hgrep:   Greps on all local C/C++ header files.
- jgrep:   Greps on all local Java files.
- mkgrep:  Greps on all local make files.
- rcgrep:  Greps on all local .rc files.
- resgrep: Greps on all local res/*.xml files.
- shgrep:  Greps on all local .sh files.
- godir:   Go to the directory containing a file.

其中對模組的編譯有輔助說明的是tapas、m、mm、mmm這幾個指令

mm和mmm的區別:

mm:編譯當前目錄下的模塊,當前目錄下要有Android.mk文件。

mmm path:編譯指定路徑下的模塊,指定路徑下要有Android.mk文件。


當中mmm後面要跟模組的根目錄,不是所有的目錄下都有子模組。

那些含有Android.mk檔案目錄才是模組的根目錄,模組名可以從Android.mk的LOCAL_MODULE或者LOCAL_PACKAGE_NAME變數中得到。

單獨編譯某模組,需要在 mmm 後面指定模組路徑,例如編譯external 中的jpeg
root@ubuntu:/home/android/src# mmm external/jpeg/

或者可用 mm 再欲編譯的模組目錄下執行
root@ubuntu:/home/android/src/external/jpeg# mm

或者可用 m 編譯全部的模組
root@ubuntu:/home/android/src# m

也可以在src目錄下直接執行make module name:
打開看 ./external/jpeg/Android.mk
看到裡面模組名稱為 libjpeg
這樣你就可以直接打模組名稱編譯
cd ~/android/src
make libjpeg

arrow
arrow
    全站熱搜

    BB 發表在 痞客邦 留言(0) 人氣()