赞
踩
There is a tool called androidmk to generate Android.bp file out of Android.mk file
androidmk工具在编译后生成所在目录out/soong/host/linux-x86/bin/androidmk
工具使用方法:
1. cd out/soong/host/linux-x86/bin/androidmk
2. androidmk [flags] <inputFile>
注:androidmk parses <inputFile> as an Android.mk file and attempts to output an analogous Android.bp file (to standard out)
示例如下:
- Write normal Android.mk file for prebuilt library like this
-
- include $(CLEAR_VARS)
- LOCAL_MODULE := newlib
- LOCAL_SRC_FILES := newlib.so
- LOCAL_MODULE_SUFFIX := .so
- LOCAL_MODULE_CLASS := SHARED_LIBRARIES
- LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)
- LOCAL_MODULE_TAGS := optional
- include $(BUILD_PREBUILT)
-
- Now run below command
- androidmk Android.mk
-
- Android.bp file will be created as below
-
- cc_prebuilt_library_shared {
- name: "newlib",
- srcs: ["newlib.so"],
-
- //ANDROIDMK TRANSLATION ERROR: unspported assignment to LOCAL_MODULE_PATH
- //LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARY)
- }
这里有一些androidmk 工具无法转换的语句,或者想在Andorid.bp中实现一些特定的目标,则可以参考源码中关于soong的两个资料,也可以用于学习Android.bp的命令
1.源码目录 /LINUX/android/build/soong/androidmk/cmd/androidmk/android.go:
-
- 174 addStandardProperties(bpparser.BoolType,
- 175 map[string]string{
- 176 // Bool properties
- 177 "LOCAL_IS_HOST_MODULE": "host",
- 178 "LOCAL_CLANG": "clang",
- 179 "LOCAL_FORCE_STATIC_EXECUTABLE": "static_executable",
- 180 "LOCAL_NATIVE_COVERAGE": "native_coverage",
- 181 "LOCAL_NO_CRT": "nocrt",
- 182 "LOCAL_ALLOW_UNDEFINED_SYMBOLS": "allow_undefined_symbols",
- 183 "LOCAL_RTTI_FLAG": "rtti",
- 184 "LOCAL_NO_STANDARD_LIBRARIES": "no_standard_libs",
- 185 "LOCAL_PACK_MODULE_RELOCATIONS": "pack_relocations",
- 186 "LOCAL_TIDY": "tidy",
- 187 "LOCAL_USE_CLANG_LLD": "use_clang_lld",
- 188 "LOCAL_PROPRIETARY_MODULE": "proprietary",
- 189 "LOCAL_VENDOR_MODULE": "vendor",
- 190 "LOCAL_ODM_MODULE": "device_specific",
- 191 "LOCAL_PRODUCT_MODULE": "product_specific",
- 192 "LOCAL_PRODUCT_SERVICES_MODULE": "product_services_specific",
- 193 "LOCAL_EXPORT_PACKAGE_RESOURCES": "export_package_resources",
- 194 "LOCAL_PRIVILEGED_MODULE": "privileged",
- 195 "LOCAL_AAPT_INCLUDE_ALL_RESOURCES": "aapt_include_all_resources",
- 196 "LOCAL_USE_EMBEDDED_NATIVE_LIBS": "use_embedded_native_libs",
- 197 "LOCAL_USE_EMBEDDED_DEX": "use_embedded_dex",
2.文档资料目录/LINUX/android/out/soong/docs/soong_build.html
该文件描述了Android.bp所有的可用的命令以及命令的各个属性的意义
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。