当前位置:   article > 正文

Android.mk 转换为 Android.bp简介_android.bp prebuilt_etc

android.bp prebuilt_etc

 

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)
示例如下:

  1. Write normal Android.mk file for prebuilt library like this
  2. include $(CLEAR_VARS)
  3. LOCAL_MODULE := newlib
  4. LOCAL_SRC_FILES := newlib.so
  5. LOCAL_MODULE_SUFFIX := .so
  6. LOCAL_MODULE_CLASS := SHARED_LIBRARIES
  7. LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)
  8. LOCAL_MODULE_TAGS := optional
  9. include $(BUILD_PREBUILT)
  10. Now run below command
  11. androidmk Android.mk
  12. Android.bp file will be created as below
  13. cc_prebuilt_library_shared {
  14. name: "newlib",
  15. srcs: ["newlib.so"],
  16. //ANDROIDMK TRANSLATION ERROR: unspported assignment to LOCAL_MODULE_PATH
  17. //LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARY)
  18. }

这里有一些androidmk 工具无法转换的语句,或者想在Andorid.bp中实现一些特定的目标,则可以参考源码中关于soong的两个资料,也可以用于学习Android.bp的命令

1.源码目录 /LINUX/android/build/soong/androidmk/cmd/androidmk/android.go:

  1. 174 addStandardProperties(bpparser.BoolType,
  2. 175 map[string]string{
  3. 176 // Bool properties
  4. 177 "LOCAL_IS_HOST_MODULE": "host",
  5. 178 "LOCAL_CLANG": "clang",
  6. 179 "LOCAL_FORCE_STATIC_EXECUTABLE": "static_executable",
  7. 180 "LOCAL_NATIVE_COVERAGE": "native_coverage",
  8. 181 "LOCAL_NO_CRT": "nocrt",
  9. 182 "LOCAL_ALLOW_UNDEFINED_SYMBOLS": "allow_undefined_symbols",
  10. 183 "LOCAL_RTTI_FLAG": "rtti",
  11. 184 "LOCAL_NO_STANDARD_LIBRARIES": "no_standard_libs",
  12. 185 "LOCAL_PACK_MODULE_RELOCATIONS": "pack_relocations",
  13. 186 "LOCAL_TIDY": "tidy",
  14. 187 "LOCAL_USE_CLANG_LLD": "use_clang_lld",
  15. 188 "LOCAL_PROPRIETARY_MODULE": "proprietary",
  16. 189 "LOCAL_VENDOR_MODULE": "vendor",
  17. 190 "LOCAL_ODM_MODULE": "device_specific",
  18. 191 "LOCAL_PRODUCT_MODULE": "product_specific",
  19. 192 "LOCAL_PRODUCT_SERVICES_MODULE": "product_services_specific",
  20. 193 "LOCAL_EXPORT_PACKAGE_RESOURCES": "export_package_resources",
  21. 194 "LOCAL_PRIVILEGED_MODULE": "privileged",
  22. 195 "LOCAL_AAPT_INCLUDE_ALL_RESOURCES": "aapt_include_all_resources",
  23. 196 "LOCAL_USE_EMBEDDED_NATIVE_LIBS": "use_embedded_native_libs",
  24. 197 "LOCAL_USE_EMBEDDED_DEX": "use_embedded_dex",

2.文档资料目录/LINUX/android/out/soong/docs/soong_build.html

该文件描述了Android.bp所有的可用的命令以及命令的各个属性的意义

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/weixin_40725706/article/detail/255798
推荐阅读
相关标签
  

闽ICP备14008679号