Android.mk 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  1. # Copyright (C) 2009 The Android Open Source Project
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. #
  15. #
  16. LOCAL_PATH := $(call my-dir)
  17. IGNORED_WARNINGS := -Wno-sign-compare -Wno-unused-parameter -Wno-sign-promo
  18. CC_LITE_SRC_FILES := \
  19. src/google/protobuf/stubs/common.cc \
  20. src/google/protobuf/stubs/once.cc \
  21. src/google/protobuf/stubs/hash.cc \
  22. src/google/protobuf/stubs/hash.h \
  23. src/google/protobuf/stubs/map-util.h \
  24. src/google/protobuf/stubs/stl_util-inl.h \
  25. src/google/protobuf/extension_set.cc \
  26. src/google/protobuf/generated_message_util.cc \
  27. src/google/protobuf/message_lite.cc \
  28. src/google/protobuf/repeated_field.cc \
  29. src/google/protobuf/wire_format_lite.cc \
  30. src/google/protobuf/io/coded_stream.cc \
  31. src/google/protobuf/io/coded_stream_inl.h \
  32. src/google/protobuf/io/zero_copy_stream.cc \
  33. src/google/protobuf/io/zero_copy_stream_impl_lite.cc
  34. JAVA_LITE_SRC_FILES := \
  35. java/src/main/java/com/google/protobuf/UninitializedMessageException.java \
  36. java/src/main/java/com/google/protobuf/MessageLite.java \
  37. java/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java \
  38. java/src/main/java/com/google/protobuf/CodedOutputStream.java \
  39. java/src/main/java/com/google/protobuf/ByteString.java \
  40. java/src/main/java/com/google/protobuf/CodedInputStream.java \
  41. java/src/main/java/com/google/protobuf/ExtensionRegistryLite.java \
  42. java/src/main/java/com/google/protobuf/AbstractMessageLite.java \
  43. java/src/main/java/com/google/protobuf/FieldSet.java \
  44. java/src/main/java/com/google/protobuf/Internal.java \
  45. java/src/main/java/com/google/protobuf/WireFormat.java \
  46. java/src/main/java/com/google/protobuf/GeneratedMessageLite.java
  47. COMPILER_SRC_FILES := \
  48. src/google/protobuf/descriptor.cc \
  49. src/google/protobuf/descriptor.pb.cc \
  50. src/google/protobuf/descriptor_database.cc \
  51. src/google/protobuf/dynamic_message.cc \
  52. src/google/protobuf/extension_set.cc \
  53. src/google/protobuf/extension_set_heavy.cc \
  54. src/google/protobuf/generated_message_reflection.cc \
  55. src/google/protobuf/generated_message_util.cc \
  56. src/google/protobuf/message.cc \
  57. src/google/protobuf/message_lite.cc \
  58. src/google/protobuf/reflection_ops.cc \
  59. src/google/protobuf/repeated_field.cc \
  60. src/google/protobuf/service.cc \
  61. src/google/protobuf/text_format.cc \
  62. src/google/protobuf/unknown_field_set.cc \
  63. src/google/protobuf/wire_format.cc \
  64. src/google/protobuf/wire_format_lite.cc \
  65. src/google/protobuf/compiler/code_generator.cc \
  66. src/google/protobuf/compiler/command_line_interface.cc \
  67. src/google/protobuf/compiler/importer.cc \
  68. src/google/protobuf/compiler/main.cc \
  69. src/google/protobuf/compiler/parser.cc \
  70. src/google/protobuf/compiler/plugin.cc \
  71. src/google/protobuf/compiler/plugin.pb.cc \
  72. src/google/protobuf/compiler/subprocess.cc \
  73. src/google/protobuf/compiler/zip_writer.cc \
  74. src/google/protobuf/compiler/cpp/cpp_enum.cc \
  75. src/google/protobuf/compiler/cpp/cpp_enum_field.cc \
  76. src/google/protobuf/compiler/cpp/cpp_extension.cc \
  77. src/google/protobuf/compiler/cpp/cpp_field.cc \
  78. src/google/protobuf/compiler/cpp/cpp_file.cc \
  79. src/google/protobuf/compiler/cpp/cpp_generator.cc \
  80. src/google/protobuf/compiler/cpp/cpp_helpers.cc \
  81. src/google/protobuf/compiler/cpp/cpp_message.cc \
  82. src/google/protobuf/compiler/cpp/cpp_message_field.cc \
  83. src/google/protobuf/compiler/cpp/cpp_primitive_field.cc \
  84. src/google/protobuf/compiler/cpp/cpp_service.cc \
  85. src/google/protobuf/compiler/cpp/cpp_string_field.cc \
  86. src/google/protobuf/compiler/java/java_enum.cc \
  87. src/google/protobuf/compiler/java/java_enum_field.cc \
  88. src/google/protobuf/compiler/java/java_extension.cc \
  89. src/google/protobuf/compiler/java/java_field.cc \
  90. src/google/protobuf/compiler/java/java_file.cc \
  91. src/google/protobuf/compiler/java/java_generator.cc \
  92. src/google/protobuf/compiler/java/java_helpers.cc \
  93. src/google/protobuf/compiler/java/java_message.cc \
  94. src/google/protobuf/compiler/java/java_message_field.cc \
  95. src/google/protobuf/compiler/java/java_primitive_field.cc \
  96. src/google/protobuf/compiler/java/java_service.cc \
  97. src/google/protobuf/compiler/javamicro/javamicro_enum.cc \
  98. src/google/protobuf/compiler/javamicro/javamicro_enum_field.cc \
  99. src/google/protobuf/compiler/javamicro/javamicro_field.cc \
  100. src/google/protobuf/compiler/javamicro/javamicro_file.cc \
  101. src/google/protobuf/compiler/javamicro/javamicro_generator.cc \
  102. src/google/protobuf/compiler/javamicro/javamicro_helpers.cc \
  103. src/google/protobuf/compiler/javamicro/javamicro_message.cc \
  104. src/google/protobuf/compiler/javamicro/javamicro_message_field.cc \
  105. src/google/protobuf/compiler/javamicro/javamicro_primitive_field.cc \
  106. src/google/protobuf/compiler/javanano/javanano_enum.cc \
  107. src/google/protobuf/compiler/javanano/javanano_enum_field.cc \
  108. src/google/protobuf/compiler/javanano/javanano_extension.cc \
  109. src/google/protobuf/compiler/javanano/javanano_field.cc \
  110. src/google/protobuf/compiler/javanano/javanano_file.cc \
  111. src/google/protobuf/compiler/javanano/javanano_generator.cc \
  112. src/google/protobuf/compiler/javanano/javanano_helpers.cc \
  113. src/google/protobuf/compiler/javanano/javanano_message.cc \
  114. src/google/protobuf/compiler/javanano/javanano_message_field.cc \
  115. src/google/protobuf/compiler/javanano/javanano_primitive_field.cc \
  116. src/google/protobuf/compiler/python/python_generator.cc \
  117. src/google/protobuf/io/coded_stream.cc \
  118. src/google/protobuf/io/gzip_stream.cc \
  119. src/google/protobuf/io/printer.cc \
  120. src/google/protobuf/io/tokenizer.cc \
  121. src/google/protobuf/io/zero_copy_stream.cc \
  122. src/google/protobuf/io/zero_copy_stream_impl.cc \
  123. src/google/protobuf/io/zero_copy_stream_impl_lite.cc \
  124. src/google/protobuf/stubs/common.cc \
  125. src/google/protobuf/stubs/hash.cc \
  126. src/google/protobuf/stubs/once.cc \
  127. src/google/protobuf/stubs/structurally_valid.cc \
  128. src/google/protobuf/stubs/strutil.cc \
  129. src/google/protobuf/stubs/substitute.cc
  130. # Java nano library (for device-side users)
  131. # =======================================================
  132. include $(CLEAR_VARS)
  133. LOCAL_MODULE := libprotobuf-java-nano
  134. LOCAL_MODULE_TAGS := optional
  135. LOCAL_SDK_VERSION := 8
  136. LOCAL_SRC_FILES := $(call all-java-files-under, java/src/main/java/com/google/protobuf/nano)
  137. LOCAL_SRC_FILES += $(call all-java-files-under, java/src/device/main/java/com/google/protobuf/nano)
  138. include $(BUILD_STATIC_JAVA_LIBRARY)
  139. # Java nano library (for host-side users)
  140. # =======================================================
  141. include $(CLEAR_VARS)
  142. LOCAL_MODULE := host-libprotobuf-java-nano
  143. LOCAL_MODULE_TAGS := optional
  144. LOCAL_SRC_FILES := $(call all-java-files-under, java/src/main/java/com/google/protobuf/nano)
  145. include $(BUILD_HOST_JAVA_LIBRARY)
  146. # Java micro library (for device-side users)
  147. # =======================================================
  148. include $(CLEAR_VARS)
  149. LOCAL_MODULE := libprotobuf-java-micro
  150. LOCAL_MODULE_TAGS := optional
  151. LOCAL_SDK_VERSION := 8
  152. LOCAL_SRC_FILES := $(call all-java-files-under, java/src/main/java/com/google/protobuf/micro)
  153. include $(BUILD_STATIC_JAVA_LIBRARY)
  154. # Java micro library (for host-side users)
  155. # =======================================================
  156. include $(CLEAR_VARS)
  157. LOCAL_MODULE := host-libprotobuf-java-micro
  158. LOCAL_MODULE_TAGS := optional
  159. LOCAL_SRC_FILES := $(call all-java-files-under, java/src/main/java/com/google/protobuf/micro)
  160. include $(BUILD_HOST_JAVA_LIBRARY)
  161. # Java lite library (for device-side users)
  162. # =======================================================
  163. include $(CLEAR_VARS)
  164. LOCAL_MODULE := libprotobuf-java-lite
  165. LOCAL_MODULE_TAGS := optional
  166. LOCAL_SDK_VERSION := 8
  167. LOCAL_SRC_FILES := $(JAVA_LITE_SRC_FILES)
  168. include $(BUILD_STATIC_JAVA_LIBRARY)
  169. # Java lite library (for host-side users)
  170. # =======================================================
  171. include $(CLEAR_VARS)
  172. LOCAL_MODULE := host-libprotobuf-java-lite
  173. LOCAL_MODULE_TAGS := optional
  174. LOCAL_SRC_FILES := $(JAVA_LITE_SRC_FILES)
  175. include $(BUILD_HOST_JAVA_LIBRARY)
  176. # C++ lite library
  177. # =======================================================
  178. include $(CLEAR_VARS)
  179. LOCAL_MODULE := libprotobuf-cpp-lite
  180. LOCAL_MODULE_TAGS := optional
  181. LOCAL_CPP_EXTENSION := .cc
  182. LOCAL_SRC_FILES := $(CC_LITE_SRC_FILES)
  183. LOCAL_C_INCLUDES := \
  184. $(LOCAL_PATH)/android \
  185. $(LOCAL_PATH)/src
  186. # Define the header files to be copied
  187. #LOCAL_COPY_HEADERS := \
  188. # src/google/protobuf/stubs/once.h \
  189. # src/google/protobuf/stubs/common.h \
  190. # src/google/protobuf/io/coded_stream.h \
  191. # src/google/protobuf/generated_message_util.h \
  192. # src/google/protobuf/repeated_field.h \
  193. # src/google/protobuf/extension_set.h \
  194. # src/google/protobuf/wire_format_lite_inl.h
  195. #
  196. #LOCAL_COPY_HEADERS_TO := $(LOCAL_MODULE)
  197. LOCAL_CFLAGS := -DGOOGLE_PROTOBUF_NO_RTTI $(IGNORED_WARNINGS)
  198. # These are the minimum versions and don't need to be update.
  199. ifeq ($(TARGET_ARCH),arm)
  200. LOCAL_SDK_VERSION := 8
  201. else
  202. # x86/mips support only available from API 9.
  203. LOCAL_SDK_VERSION := 9
  204. endif
  205. LOCAL_NDK_STL_VARIANT := stlport_static
  206. include $(BUILD_STATIC_LIBRARY)
  207. # C++ lite library (libc++ flavored for the platform)
  208. # =======================================================
  209. include $(CLEAR_VARS)
  210. LOCAL_MODULE := libprotobuf-cpp-lite
  211. LOCAL_MODULE_TAGS := optional
  212. LOCAL_CPP_EXTENSION := .cc
  213. LOCAL_SRC_FILES := $(CC_LITE_SRC_FILES)
  214. LOCAL_C_INCLUDES := \
  215. $(LOCAL_PATH)/android \
  216. $(LOCAL_PATH)/src
  217. LOCAL_CFLAGS := -DGOOGLE_PROTOBUF_NO_RTTI $(IGNORED_WARNINGS)
  218. include $(BUILD_SHARED_LIBRARY)
  219. # C++ full library
  220. # =======================================================
  221. protobuf_cc_full_src_files := \
  222. $(CC_LITE_SRC_FILES) \
  223. src/google/protobuf/stubs/strutil.cc \
  224. src/google/protobuf/stubs/strutil.h \
  225. src/google/protobuf/stubs/substitute.cc \
  226. src/google/protobuf/stubs/substitute.h \
  227. src/google/protobuf/stubs/structurally_valid.cc \
  228. src/google/protobuf/descriptor.cc \
  229. src/google/protobuf/descriptor.pb.cc \
  230. src/google/protobuf/descriptor_database.cc \
  231. src/google/protobuf/dynamic_message.cc \
  232. src/google/protobuf/extension_set_heavy.cc \
  233. src/google/protobuf/generated_message_reflection.cc \
  234. src/google/protobuf/message.cc \
  235. src/google/protobuf/reflection_ops.cc \
  236. src/google/protobuf/service.cc \
  237. src/google/protobuf/text_format.cc \
  238. src/google/protobuf/unknown_field_set.cc \
  239. src/google/protobuf/wire_format.cc \
  240. src/google/protobuf/io/gzip_stream.cc \
  241. src/google/protobuf/io/printer.cc \
  242. src/google/protobuf/io/tokenizer.cc \
  243. src/google/protobuf/io/zero_copy_stream_impl.cc \
  244. src/google/protobuf/compiler/importer.cc \
  245. src/google/protobuf/compiler/parser.cc
  246. # C++ full library - stlport version
  247. # =======================================================
  248. include $(CLEAR_VARS)
  249. LOCAL_MODULE := libprotobuf-cpp-full
  250. LOCAL_MODULE_TAGS := optional
  251. LOCAL_CPP_EXTENSION := .cc
  252. LOCAL_SRC_FILES := $(protobuf_cc_full_src_files)
  253. LOCAL_C_INCLUDES := \
  254. $(LOCAL_PATH)/android \
  255. external/zlib \
  256. $(LOCAL_PATH)/src
  257. # Define the header files to be copied
  258. #LOCAL_COPY_HEADERS := \
  259. # src/google/protobuf/stubs/once.h \
  260. # src/google/protobuf/stubs/common.h \
  261. # src/google/protobuf/io/coded_stream.h \
  262. # src/google/protobuf/generated_message_util.h \
  263. # src/google/protobuf/repeated_field.h \
  264. # src/google/protobuf/extension_set.h \
  265. # src/google/protobuf/wire_format_lite_inl.h
  266. #
  267. #LOCAL_COPY_HEADERS_TO := $(LOCAL_MODULE)
  268. LOCAL_CFLAGS := -DGOOGLE_PROTOBUF_NO_RTTI $(IGNORED_WARNINGS)
  269. # These are the minimum versions and don't need to be update.
  270. ifeq ($(TARGET_ARCH),arm)
  271. LOCAL_SDK_VERSION := 8
  272. else
  273. # x86/mips support only available from API 9.
  274. LOCAL_SDK_VERSION := 9
  275. endif
  276. LOCAL_NDK_STL_VARIANT := stlport_static
  277. include $(BUILD_STATIC_LIBRARY)
  278. # C++ full library - Gnustl+rtti version
  279. # =======================================================
  280. include $(CLEAR_VARS)
  281. LOCAL_MODULE := libprotobuf-cpp-full-gnustl-rtti
  282. LOCAL_MODULE_TAGS := optional
  283. LOCAL_CPP_EXTENSION := .cc
  284. LOCAL_SRC_FILES := $(protobuf_cc_full_src_files)
  285. LOCAL_C_INCLUDES := \
  286. $(LOCAL_PATH)/android \
  287. external/zlib \
  288. $(LOCAL_PATH)/src
  289. LOCAL_CFLAGS := -frtti $(IGNORED_WARNINGS)
  290. LOCAL_SDK_VERSION := 14
  291. LOCAL_NDK_STL_VARIANT := gnustl_static
  292. include $(BUILD_STATIC_LIBRARY)
  293. # C++ full library - libc++ version for the platform
  294. # =======================================================
  295. include $(CLEAR_VARS)
  296. LOCAL_MODULE := libprotobuf-cpp-full
  297. LOCAL_MODULE_TAGS := optional
  298. LOCAL_CPP_EXTENSION := .cc
  299. LOCAL_SRC_FILES := $(protobuf_cc_full_src_files)
  300. LOCAL_C_INCLUDES := \
  301. $(LOCAL_PATH)/android \
  302. external/zlib \
  303. $(LOCAL_PATH)/src
  304. LOCAL_CFLAGS := -DGOOGLE_PROTOBUF_NO_RTTI $(IGNORED_WARNINGS)
  305. LOCAL_SHARED_LIBRARIES := libz
  306. include $(BUILD_SHARED_LIBRARY)
  307. # Clean temp vars
  308. protobuf_cc_full_src_files :=
  309. # Android Protocol buffer compiler, aprotoc (host executable)
  310. # used by the build systems as $(PROTOC) defined in
  311. # build/core/config.mk
  312. # =======================================================
  313. include $(CLEAR_VARS)
  314. LOCAL_MODULE := aprotoc
  315. LOCAL_MODULE_CLASS := EXECUTABLES
  316. LOCAL_MODULE_TAGS := optional
  317. LOCAL_CPP_EXTENSION := .cc
  318. LOCAL_SRC_FILES := $(COMPILER_SRC_FILES)
  319. LOCAL_C_INCLUDES := \
  320. $(LOCAL_PATH)/android \
  321. external/zlib \
  322. $(LOCAL_PATH)/src
  323. LOCAL_STATIC_LIBRARIES += libz
  324. ifneq ($(HOST_OS),windows)
  325. LOCAL_LDLIBS := -lpthread
  326. endif
  327. LOCAL_CFLAGS := $(IGNORED_WARNINGS)
  328. include $(BUILD_HOST_EXECUTABLE)
  329. # To test java proto params build rules.
  330. # =======================================================
  331. include $(CLEAR_VARS)
  332. LOCAL_MODULE := aprotoc-test-nano-params
  333. LOCAL_MODULE_TAGS := tests
  334. LOCAL_SDK_VERSION := current
  335. LOCAL_PROTOC_OPTIMIZE_TYPE := nano
  336. LOCAL_SRC_FILES := \
  337. src/google/protobuf/unittest_import_nano.proto \
  338. src/google/protobuf/unittest_simple_nano.proto \
  339. src/google/protobuf/unittest_stringutf8_nano.proto \
  340. src/google/protobuf/unittest_recursive_nano.proto
  341. LOCAL_PROTOC_FLAGS := --proto_path=$(LOCAL_PATH)/src
  342. LOCAL_PROTO_JAVA_OUTPUT_PARAMS := \
  343. java_package = $(LOCAL_PATH)/src/google/protobuf/unittest_import_nano.proto|com.google.protobuf.nano, \
  344. java_outer_classname = $(LOCAL_PATH)/src/google/protobuf/unittest_import_nano.proto|UnittestImportNano
  345. include $(BUILD_STATIC_JAVA_LIBRARY)
  346. # To test Android-specific nanoproto features.
  347. # =======================================================
  348. include $(CLEAR_VARS)
  349. # Parcelable messages
  350. LOCAL_MODULE := android-nano-test-parcelable
  351. LOCAL_MODULE_TAGS := tests
  352. LOCAL_SDK_VERSION := current
  353. LOCAL_PROTOC_OPTIMIZE_TYPE := nano
  354. LOCAL_SRC_FILES := src/google/protobuf/unittest_simple_nano.proto
  355. LOCAL_PROTOC_FLAGS := --proto_path=$(LOCAL_PATH)/src
  356. LOCAL_PROTO_JAVA_OUTPUT_PARAMS := \
  357. parcelable_messages = true
  358. include $(BUILD_STATIC_JAVA_LIBRARY)
  359. include $(CLEAR_VARS)
  360. # Parcelable and extendable messages
  361. LOCAL_MODULE := android-nano-test-parcelable-extendable
  362. LOCAL_MODULE_TAGS := tests
  363. LOCAL_SDK_VERSION := current
  364. LOCAL_PROTOC_OPTIMIZE_TYPE := nano
  365. LOCAL_SRC_FILES := src/google/protobuf/unittest_extension_nano.proto
  366. LOCAL_PROTOC_FLAGS := --proto_path=$(LOCAL_PATH)/src
  367. LOCAL_PROTO_JAVA_OUTPUT_PARAMS := \
  368. parcelable_messages = true, \
  369. store_unknown_fields = true
  370. include $(BUILD_STATIC_JAVA_LIBRARY)
  371. include $(CLEAR_VARS)
  372. # Test APK
  373. LOCAL_PACKAGE_NAME := NanoAndroidTest
  374. LOCAL_SDK_VERSION := 8
  375. LOCAL_MODULE_TAGS := tests
  376. LOCAL_SRC_FILES := $(call all-java-files-under, java/src/device/test/java/com/google/protobuf/nano)
  377. LOCAL_MANIFEST_FILE := java/src/device/test/AndroidManifest.xml
  378. LOCAL_STATIC_JAVA_LIBRARIES := libprotobuf-java-nano \
  379. android-nano-test-parcelable \
  380. android-nano-test-parcelable-extendable
  381. LOCAL_DEX_PREOPT := false
  382. include $(BUILD_PACKAGE)
  383. # 2.3.0 prebuilts for backwards compatibility.
  384. include $(LOCAL_PATH)/prebuilts/Android.mk