Frank Cheng
Frank Cheng

Reputation: 6196

How to speed up mm in module making of AOSP

I am working on the contacts app from android open source project. My android version is 2.3.5_r1. And using mm to make the module, but the making speed is quite slow, so i doubt if there is a method to speed up the making.

PS:Actually if i compile this module in eclipse, i will speed up a litter because the auto build feature of eclipse. But i don't like work with eclipse so give it up.

Upvotes: 4

Views: 5505

Answers (4)

jiaqi jiang
jiaqi jiang

Reputation: 531

I found that when I use my laptop ssh to my desktop computer and build module, I can build it very very fast. I don't know why.

Upvotes: 0

Paschalis
Paschalis

Reputation: 12301

1. Build module + dependencies

mmma is slower than mmm, as the former make sure all dependencies are met for the module, and if they are not it compiles them as well. So, initially instead of a full make command, build the dependencies concerning the module you are interested in using the following:

mmma -j4 adir/yourmoduledir

2. Build module

Now that dependencies have met, keep recompiling just the module you are interested in. Skipping check for dependencies saves precious time. The directory you are using though, might contain more than one compilation target. To compile a single target, use something like:

mmm -j4 adir/yourmoduledir:moduletargetname

Example

Build libart

Build library and all of its dependencies once:
mmma -j4 art/runtime
Modify libart's code and quickly build it:
mmm -j4 art/runtime:libart

You will get half compilation time in comparison to Yury's approach as for example the debugging flavor of libart (libartd) will be omitted altogether.

Further speedup?

You should of course enable caching as suggested by aultbot.

Also, depending on the modules you are interested, there might be compilation targets you might want to disable by digging up in the makefiles. For example libart is compiled for both the host and the target. If you modify a variable in the makefiles can force compilation just for one of the 2, saving you half of the time.

Additional info:

Upvotes: 2

aultimus
aultimus

Reputation: 803

In order of least cost to you:

  • Don't make clean so much. Allow the makefile to determine what to rebuild.
  • Use CCACHE export USE_CCACHE=1. You're only likely to see the effects of CCACHE upon having rebuilt multiple times. If your project is large set a higher CCACHE size e.g. 10GB ${ANDROID_DIR}/prebuilt/linux-x86/ccache/ccache -M 10G
  • Get a better processor and run with higher -j parameter

Upvotes: 5

Yury
Yury

Reputation: 20936

For instance, I use the following command from the root folder of your Android project:

mmm frameworks/base snod -j4

And I think that this is the best choice. Try it but substitute frameworks/base with your project name (relative path where Android.mk is stored).

Upvotes: 6

Related Questions