I've added a new C++ subproject at frameworks/base/cmds/myproject
and it has its own Android.mk
file. When I run make myproject
, it'll compile well and no problem.
However I want to add make myproject
to the main make
. I mean, when someone runs make
at the root of AOSP, my project to be included as well. What should I do?
You need your
Android.mk
file to be called. There are various ways to do so, depending on your needs.If you want your
myproyect
to be compiled for several of the devices you have underdevice/
, then look for a commonmk
file. For example this is how Qualcomm does it, you can copy it for AOSP.device/common/common.mk
device/common/common.mk
from every device you want to. (This is how QCM does it:$(call inherit-product, device/qcom/common/common.mk)
If you want it just for a specific device:
mini_emulator_x86-userdebug
, which has it'smk
file indevice/generic/mini-emulator-x86
.mini_emulator_x86.mk
Edit or add
PRODUCT_PACKAGES
as follows:Watch out for correct indentation.
This way, when you do
source build/envsetup.sh
andlunch mini_emulator_x86-user
and thenmake
, yourmyproyect.mk
will be reached.In order to test it:
myproject.mk
file by adding something like this:$(warning MyProject MK has been called
lunch mini_emulator_x86-user
.make | grep MyProject
and you don't need to wait for the whole compilation, if this outputs something in the first seconds, you're good to go.For additional reference you may take a look at how Qualcomm organizes their
device
folder, withcommon
andbase
mk files. Take a look at their open source code here