Android.mk 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  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-2.3.0-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. include $(BUILD_STATIC_JAVA_LIBRARY)
  138. # Java nano library (for host-side users)
  139. # =======================================================
  140. include $(CLEAR_VARS)
  141. LOCAL_MODULE := host-libprotobuf-java-2.3.0-nano
  142. LOCAL_MODULE_TAGS := optional
  143. LOCAL_SRC_FILES := $(call all-java-files-under, java/src/main/java/com/google/protobuf/nano)
  144. include $(BUILD_HOST_JAVA_LIBRARY)
  145. # Java micro library (for device-side users)
  146. # =======================================================
  147. include $(CLEAR_VARS)
  148. LOCAL_MODULE := libprotobuf-java-2.3.0-micro
  149. LOCAL_MODULE_TAGS := optional
  150. LOCAL_SDK_VERSION := 8
  151. LOCAL_SRC_FILES := $(call all-java-files-under, java/src/main/java/com/google/protobuf/micro)
  152. include $(BUILD_STATIC_JAVA_LIBRARY)
  153. # Java micro library (for host-side users)
  154. # =======================================================
  155. include $(CLEAR_VARS)
  156. LOCAL_MODULE := host-libprotobuf-java-2.3.0-micro
  157. LOCAL_MODULE_TAGS := optional
  158. LOCAL_SRC_FILES := $(call all-java-files-under, java/src/main/java/com/google/protobuf/micro)
  159. include $(BUILD_HOST_JAVA_LIBRARY)
  160. # Java lite library (for device-side users)
  161. # =======================================================
  162. include $(CLEAR_VARS)
  163. LOCAL_MODULE := libprotobuf-java-2.3.0-lite
  164. LOCAL_MODULE_TAGS := optional
  165. LOCAL_SDK_VERSION := 8
  166. LOCAL_SRC_FILES := $(JAVA_LITE_SRC_FILES)
  167. include $(BUILD_STATIC_JAVA_LIBRARY)
  168. # Java lite library (for host-side users)
  169. # =======================================================
  170. include $(CLEAR_VARS)
  171. LOCAL_MODULE := host-libprotobuf-java-2.3.0-lite
  172. LOCAL_MODULE_TAGS := optional
  173. LOCAL_SRC_FILES := $(JAVA_LITE_SRC_FILES)
  174. include $(BUILD_HOST_JAVA_LIBRARY)
  175. # C++ lite library
  176. # =======================================================
  177. include $(CLEAR_VARS)
  178. LOCAL_MODULE := libprotobuf-cpp-2.3.0-lite
  179. LOCAL_MODULE_TAGS := optional
  180. LOCAL_CPP_EXTENSION := .cc
  181. LOCAL_SRC_FILES := $(CC_LITE_SRC_FILES)
  182. LOCAL_C_INCLUDES := \
  183. $(LOCAL_PATH)/android \
  184. $(LOCAL_PATH)/src
  185. # Define the header files to be copied
  186. #LOCAL_COPY_HEADERS := \
  187. # src/google/protobuf/stubs/once.h \
  188. # src/google/protobuf/stubs/common.h \
  189. # src/google/protobuf/io/coded_stream.h \
  190. # src/google/protobuf/generated_message_util.h \
  191. # src/google/protobuf/repeated_field.h \
  192. # src/google/protobuf/extension_set.h \
  193. # src/google/protobuf/wire_format_lite_inl.h
  194. #
  195. #LOCAL_COPY_HEADERS_TO := $(LOCAL_MODULE)
  196. LOCAL_CFLAGS := -DGOOGLE_PROTOBUF_NO_RTTI $(IGNORED_WARNINGS)
  197. # These are the minimum versions and don't need to be update.
  198. ifeq ($(TARGET_ARCH),arm)
  199. LOCAL_SDK_VERSION := 8
  200. else
  201. # x86/mips support only available from API 9.
  202. LOCAL_SDK_VERSION := 9
  203. endif
  204. LOCAL_NDK_STL_VARIANT := stlport_static
  205. include $(BUILD_STATIC_LIBRARY)
  206. # C++ full library
  207. # =======================================================
  208. protobuf_cc_full_src_files := \
  209. $(CC_LITE_SRC_FILES) \
  210. src/google/protobuf/stubs/strutil.cc \
  211. src/google/protobuf/stubs/strutil.h \
  212. src/google/protobuf/stubs/substitute.cc \
  213. src/google/protobuf/stubs/substitute.h \
  214. src/google/protobuf/stubs/structurally_valid.cc \
  215. src/google/protobuf/descriptor.cc \
  216. src/google/protobuf/descriptor.pb.cc \
  217. src/google/protobuf/descriptor_database.cc \
  218. src/google/protobuf/dynamic_message.cc \
  219. src/google/protobuf/extension_set_heavy.cc \
  220. src/google/protobuf/generated_message_reflection.cc \
  221. src/google/protobuf/message.cc \
  222. src/google/protobuf/reflection_ops.cc \
  223. src/google/protobuf/service.cc \
  224. src/google/protobuf/text_format.cc \
  225. src/google/protobuf/unknown_field_set.cc \
  226. src/google/protobuf/wire_format.cc \
  227. src/google/protobuf/io/gzip_stream.cc \
  228. src/google/protobuf/io/printer.cc \
  229. src/google/protobuf/io/tokenizer.cc \
  230. src/google/protobuf/io/zero_copy_stream_impl.cc \
  231. src/google/protobuf/compiler/importer.cc \
  232. src/google/protobuf/compiler/parser.cc
  233. # C++ full library - stlport version
  234. # =======================================================
  235. include $(CLEAR_VARS)
  236. LOCAL_MODULE := libprotobuf-cpp-2.3.0-full
  237. LOCAL_MODULE_TAGS := optional
  238. LOCAL_CPP_EXTENSION := .cc
  239. LOCAL_SRC_FILES := $(protobuf_cc_full_src_files)
  240. LOCAL_C_INCLUDES := \
  241. $(LOCAL_PATH)/android \
  242. external/zlib \
  243. $(LOCAL_PATH)/src
  244. # Define the header files to be copied
  245. #LOCAL_COPY_HEADERS := \
  246. # src/google/protobuf/stubs/once.h \
  247. # src/google/protobuf/stubs/common.h \
  248. # src/google/protobuf/io/coded_stream.h \
  249. # src/google/protobuf/generated_message_util.h \
  250. # src/google/protobuf/repeated_field.h \
  251. # src/google/protobuf/extension_set.h \
  252. # src/google/protobuf/wire_format_lite_inl.h
  253. #
  254. #LOCAL_COPY_HEADERS_TO := $(LOCAL_MODULE)
  255. LOCAL_CFLAGS := -DGOOGLE_PROTOBUF_NO_RTTI $(IGNORED_WARNINGS)
  256. # These are the minimum versions and don't need to be update.
  257. ifeq ($(TARGET_ARCH),arm)
  258. LOCAL_SDK_VERSION := 8
  259. else
  260. # x86/mips support only available from API 9.
  261. LOCAL_SDK_VERSION := 9
  262. endif
  263. LOCAL_NDK_STL_VARIANT := stlport_static
  264. include $(BUILD_STATIC_LIBRARY)
  265. # C++ full library - Gnustl+rtti version
  266. # =======================================================
  267. include $(CLEAR_VARS)
  268. LOCAL_MODULE := libprotobuf-cpp-2.3.0-full-gnustl-rtti
  269. LOCAL_MODULE_TAGS := optional
  270. LOCAL_CPP_EXTENSION := .cc
  271. LOCAL_SRC_FILES := $(protobuf_cc_full_src_files)
  272. LOCAL_C_INCLUDES := \
  273. $(LOCAL_PATH)/android \
  274. external/zlib \
  275. $(LOCAL_PATH)/src
  276. LOCAL_CFLAGS := -frtti $(IGNORED_WARNINGS)
  277. LOCAL_SDK_VERSION := 14
  278. LOCAL_NDK_STL_VARIANT := gnustl_static
  279. include $(BUILD_STATIC_LIBRARY)
  280. # Clean temp vars
  281. protobuf_cc_full_src_files :=
  282. # Android Protocol buffer compiler, aprotoc (host executable)
  283. # used by the build systems as $(PROTOC) defined in
  284. # build/core/config.mk
  285. # =======================================================
  286. include $(CLEAR_VARS)
  287. LOCAL_MODULE := aprotoc
  288. LOCAL_MODULE_CLASS := EXECUTABLES
  289. LOCAL_MODULE_TAGS := optional
  290. LOCAL_CPP_EXTENSION := .cc
  291. LOCAL_SRC_FILES := $(COMPILER_SRC_FILES)
  292. LOCAL_C_INCLUDES := \
  293. $(LOCAL_PATH)/android \
  294. $(LOCAL_PATH)/src
  295. LOCAL_STATIC_LIBRARIES += libz
  296. LOCAL_LDLIBS := -lpthread
  297. LOCAL_CFLAGS := $(IGNORED_WARNINGS)
  298. include $(BUILD_HOST_EXECUTABLE)
  299. # To test java proto params build rules.
  300. # =======================================================
  301. include $(CLEAR_VARS)
  302. LOCAL_MODULE := aprotoc-test-nano-params
  303. LOCAL_MODULE_TAGS := tests
  304. LOCAL_SDK_VERSION := current
  305. LOCAL_PROTOC_OPTIMIZE_TYPE := nano
  306. LOCAL_SRC_FILES := \
  307. src/google/protobuf/unittest_import_nano.proto \
  308. src/google/protobuf/unittest_simple_nano.proto \
  309. src/google/protobuf/unittest_stringutf8_nano.proto \
  310. src/google/protobuf/unittest_recursive_nano.proto
  311. LOCAL_PROTOC_FLAGS := --proto_path=$(LOCAL_PATH)/src
  312. LOCAL_PROTO_JAVA_OUTPUT_PARAMS := java_package=$(LOCAL_PATH)/src/google/protobuf/unittest_import_nano.proto|com.google.protobuf.nano,java_outer_classname=$(LOCAL_PATH)/src/google/protobuf/unittest_import_nano.proto|UnittestImportNano
  313. include $(BUILD_STATIC_JAVA_LIBRARY)