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