将制造规则添加到AOSP的主要品牌中 [英] Add a make rule to the main make of AOSP
问题描述
我在frameworks/base/cmds/myproject
处添加了一个新的C ++子项目,它具有自己的Android.mk
文件.当我运行make myproject
时,它将编译良好,没有问题.
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.
但是我想将make myproject
添加到主make
中.我的意思是,当有人在AOSP的根目录下运行make
时,我的项目也将包括在内.我该怎么办?
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?
推荐答案
您需要调用Android.mk
文件.有多种方法,具体取决于您的需求.
You need your Android.mk
file to be called. There are various ways to do so, depending on your needs.
如果要为device/
下的多个设备编译myproyect
,请寻找一个常见的mk
文件.例如,这就是高通公司的做法,您可以将其复制为AOSP.
If you want your myproyect
to be compiled for several of the devices you have under device/
, then look for a common mk
file. For example this is how Qualcomm does it, you can copy it for AOSP.
- 编辑/创建
device/common/common.mk
- 从所需的每个设备拨打该
device/common/common.mk
的电话. (这是QCM的操作方式:$(call inherit-product, device/qcom/common/common.mk)
- Edit/create
device/common/common.mk
- Make calls to that
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
进行编译,而mini_emulator_x86-userdebug
在device/generic/mini-emulator-x86
中包含它. - 编辑
mini_emulator_x86.mk
-
按如下所示编辑或添加
PRODUCT_PACKAGES
:
- Let's take for granted you want to compile for
mini_emulator_x86-userdebug
, which has it'smk
file indevice/generic/mini-emulator-x86
. - Edit
mini_emulator_x86.mk
Edit or add
PRODUCT_PACKAGES
as follows:
PRODUCT_PACKAGES += \
myproyect
当心正确的缩进.
这样,当您先执行source build/envsetup.sh
和lunch mini_emulator_x86-user
然后执行make
时,将到达myproyect.mk
.
This way, when you do source build/envsetup.sh
and lunch mini_emulator_x86-user
and then make
, your myproyect.mk
will be reached.
为了对其进行测试:
- 通过添加以下内容来编辑
myproject.mk
文件:$(warning MyProject MK has been called
- 致电
lunch mini_emulator_x86-user
. -
make | grep MyProject
,您无需等待整个编译,如果在最初的几秒钟内输出了某些内容,那么您就很好了.
- Edit your
myproject.mk
file by adding something like this:$(warning MyProject MK has been called
- Call
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.
有关其他参考,您可以看看高通公司如何组织其device
文件夹以及common
和base
mk文件.在此处
For additional reference you may take a look at how Qualcomm organizes their device
folder, with common
and base
mk files. Take a look at their open source code here
这篇关于将制造规则添加到AOSP的主要品牌中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!