The Android code is huge. If you need to compile it all, it takes a lot of time, which leads to low development efficiency. Is there a way to compile and modify the code? The answer is yes, because in the face of so many code, development fails if there is no good method. Next we will learn how to compile a single directory.
In the top-level directory of android, run the following command:
. Build/envsetup. sh
After running the command, a lot of commands are added to the sh interpreter. The specific command is as follows:
-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.
The command croot is changed to the top-level directory; m is the source code tree; mm is the compilation of all modules in the current directory;
Mmm is used to compile all the modules that meet the condition. cgrep is used to find all local C/C ++ files. jgrep is used to find all local java files; resgrep is to find all local resource files res /*. xml; godir is to jump to the directory that includes this file.
The following shows how to use commands to compile a directory:
Android-2.0/system/core $ "> tony @ tony-desktop :~ /Arm/Android-2.0/system/core $ mm
========================================================== ====
PLATFORM_VERSION_CODENAME = AOSP
PLATFORM_VERSION = AOSP
TARGET_PRODUCT = generic
TARGET_BUILD_VARIANT = eng
TARGET_SIMULATOR =
TARGET_BUILD_TYPE = release
TARGET_ARCH = arm
HOST_ARCH = x86
HOST_ OS = linux
HOST_BUILD_TYPE = release
BUILD_ID = MASTER
========================================================== ====
Make: Go to the/home/tony/arm/Android-2.0 directory.
This command is in the directory ~ /Arm/Android-2.0/system/core starts compilation, which improves the compilation speed.