Home | History | Annotate | Download | only in protobuf
      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 
     17 LOCAL_PATH := $(call my-dir)
     18 
     19 IGNORED_WARNINGS := -Wno-sign-compare -Wno-unused-parameter -Wno-sign-promo
     20 
     21 CC_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 
     38 JAVA_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 
     52 COMPILER_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 # =======================================================
    138 include $(CLEAR_VARS)
    139 
    140 LOCAL_MODULE := libprotobuf-java-2.3.0-nano
    141 LOCAL_MODULE_TAGS := optional
    142 LOCAL_SDK_VERSION := 8
    143 
    144 LOCAL_SRC_FILES := $(call all-java-files-under, java/src/main/java/com/google/protobuf/nano)
    145 LOCAL_SRC_FILES += $(call all-java-files-under, java/src/device/main/java/com/google/protobuf/nano)
    146 
    147 include $(BUILD_STATIC_JAVA_LIBRARY)
    148 
    149 # Java nano library (for host-side users)
    150 # =======================================================
    151 include $(CLEAR_VARS)
    152 
    153 LOCAL_MODULE := host-libprotobuf-java-2.3.0-nano
    154 LOCAL_MODULE_TAGS := optional
    155 
    156 LOCAL_SRC_FILES := $(call all-java-files-under, java/src/main/java/com/google/protobuf/nano)
    157 
    158 include $(BUILD_HOST_JAVA_LIBRARY)
    159 
    160 # Java micro library (for device-side users)
    161 # =======================================================
    162 include $(CLEAR_VARS)
    163 
    164 LOCAL_MODULE := libprotobuf-java-2.3.0-micro
    165 LOCAL_MODULE_TAGS := optional
    166 LOCAL_SDK_VERSION := 8
    167 
    168 LOCAL_SRC_FILES := $(call all-java-files-under, java/src/main/java/com/google/protobuf/micro)
    169 
    170 include $(BUILD_STATIC_JAVA_LIBRARY)
    171 
    172 # Java micro library (for host-side users)
    173 # =======================================================
    174 include $(CLEAR_VARS)
    175 
    176 LOCAL_MODULE := host-libprotobuf-java-2.3.0-micro
    177 LOCAL_MODULE_TAGS := optional
    178 
    179 LOCAL_SRC_FILES := $(call all-java-files-under, java/src/main/java/com/google/protobuf/micro)
    180 
    181 include $(BUILD_HOST_JAVA_LIBRARY)
    182 
    183 # Java lite library (for device-side users)
    184 # =======================================================
    185 include $(CLEAR_VARS)
    186 
    187 LOCAL_MODULE := libprotobuf-java-2.3.0-lite
    188 LOCAL_MODULE_TAGS := optional
    189 LOCAL_SDK_VERSION := 8
    190 
    191 LOCAL_SRC_FILES := $(JAVA_LITE_SRC_FILES)
    192 
    193 include $(BUILD_STATIC_JAVA_LIBRARY)
    194 
    195 # Java lite library (for host-side users)
    196 # =======================================================
    197 include $(CLEAR_VARS)
    198 
    199 LOCAL_MODULE := host-libprotobuf-java-2.3.0-lite
    200 LOCAL_MODULE_TAGS := optional
    201 
    202 LOCAL_SRC_FILES := $(JAVA_LITE_SRC_FILES)
    203 
    204 include $(BUILD_HOST_JAVA_LIBRARY)
    205 
    206 # C++ lite library
    207 # =======================================================
    208 include $(CLEAR_VARS)
    209 
    210 LOCAL_MODULE := libprotobuf-cpp-2.3.0-lite
    211 LOCAL_MODULE_TAGS := optional
    212 
    213 LOCAL_CPP_EXTENSION := .cc
    214 
    215 LOCAL_SRC_FILES := $(CC_LITE_SRC_FILES)
    216 
    217 LOCAL_C_INCLUDES := \
    218     $(LOCAL_PATH)/android \
    219     $(LOCAL_PATH)/src
    220 
    221 # Define the header files to be copied
    222 #LOCAL_COPY_HEADERS := \
    223 #    src/google/protobuf/stubs/once.h \
    224 #    src/google/protobuf/stubs/common.h \
    225 #    src/google/protobuf/io/coded_stream.h \
    226 #    src/google/protobuf/generated_message_util.h \
    227 #    src/google/protobuf/repeated_field.h \
    228 #    src/google/protobuf/extension_set.h \
    229 #    src/google/protobuf/wire_format_lite_inl.h
    230 #
    231 #LOCAL_COPY_HEADERS_TO := $(LOCAL_MODULE)
    232 
    233 LOCAL_CFLAGS := -DGOOGLE_PROTOBUF_NO_RTTI $(IGNORED_WARNINGS)
    234 
    235 # These are the minimum versions and don't need to be update.
    236 ifeq ($(TARGET_ARCH),arm)
    237 LOCAL_SDK_VERSION := 8
    238 else
    239 # x86/mips support only available from API 9.
    240 LOCAL_SDK_VERSION := 9
    241 endif
    242 LOCAL_NDK_STL_VARIANT := stlport_static
    243 
    244 include $(BUILD_STATIC_LIBRARY)
    245 
    246 # C++ full library
    247 # =======================================================
    248 protobuf_cc_full_src_files := \
    249     $(CC_LITE_SRC_FILES)                                             \
    250     src/google/protobuf/stubs/strutil.cc                             \
    251     src/google/protobuf/stubs/strutil.h                              \
    252     src/google/protobuf/stubs/substitute.cc                          \
    253     src/google/protobuf/stubs/substitute.h                           \
    254     src/google/protobuf/stubs/structurally_valid.cc                  \
    255     src/google/protobuf/descriptor.cc                                \
    256     src/google/protobuf/descriptor.pb.cc                             \
    257     src/google/protobuf/descriptor_database.cc                       \
    258     src/google/protobuf/dynamic_message.cc                           \
    259     src/google/protobuf/extension_set_heavy.cc                       \
    260     src/google/protobuf/generated_message_reflection.cc              \
    261     src/google/protobuf/message.cc                                   \
    262     src/google/protobuf/reflection_ops.cc                            \
    263     src/google/protobuf/service.cc                                   \
    264     src/google/protobuf/text_format.cc                               \
    265     src/google/protobuf/unknown_field_set.cc                         \
    266     src/google/protobuf/wire_format.cc                               \
    267     src/google/protobuf/io/gzip_stream.cc                            \
    268     src/google/protobuf/io/printer.cc                                \
    269     src/google/protobuf/io/tokenizer.cc                              \
    270     src/google/protobuf/io/zero_copy_stream_impl.cc                  \
    271     src/google/protobuf/compiler/importer.cc                         \
    272     src/google/protobuf/compiler/parser.cc
    273 
    274 # C++ full library - stlport version
    275 # =======================================================
    276 include $(CLEAR_VARS)
    277 
    278 LOCAL_MODULE := libprotobuf-cpp-2.3.0-full
    279 LOCAL_MODULE_TAGS := optional
    280 LOCAL_CPP_EXTENSION := .cc
    281 LOCAL_SRC_FILES := $(protobuf_cc_full_src_files)
    282 LOCAL_C_INCLUDES := \
    283     $(LOCAL_PATH)/android \
    284     external/zlib \
    285     $(LOCAL_PATH)/src
    286 
    287 # Define the header files to be copied
    288 #LOCAL_COPY_HEADERS := \
    289 #    src/google/protobuf/stubs/once.h \
    290 #    src/google/protobuf/stubs/common.h \
    291 #    src/google/protobuf/io/coded_stream.h \
    292 #    src/google/protobuf/generated_message_util.h \
    293 #    src/google/protobuf/repeated_field.h \
    294 #    src/google/protobuf/extension_set.h \
    295 #    src/google/protobuf/wire_format_lite_inl.h
    296 #
    297 #LOCAL_COPY_HEADERS_TO := $(LOCAL_MODULE)
    298 
    299 LOCAL_CFLAGS := -DGOOGLE_PROTOBUF_NO_RTTI $(IGNORED_WARNINGS)
    300 
    301 # These are the minimum versions and don't need to be update.
    302 ifeq ($(TARGET_ARCH),arm)
    303 LOCAL_SDK_VERSION := 8
    304 else
    305 # x86/mips support only available from API 9.
    306 LOCAL_SDK_VERSION := 9
    307 endif
    308 LOCAL_NDK_STL_VARIANT := stlport_static
    309 
    310 include $(BUILD_STATIC_LIBRARY)
    311 
    312 # C++ full library - Gnustl+rtti version
    313 # =======================================================
    314 include $(CLEAR_VARS)
    315 
    316 LOCAL_MODULE := libprotobuf-cpp-2.3.0-full-gnustl-rtti
    317 LOCAL_MODULE_TAGS := optional
    318 LOCAL_CPP_EXTENSION := .cc
    319 LOCAL_SRC_FILES := $(protobuf_cc_full_src_files)
    320 LOCAL_C_INCLUDES := \
    321     $(LOCAL_PATH)/android \
    322     external/zlib \
    323     $(LOCAL_PATH)/src
    324 
    325 LOCAL_CFLAGS := -frtti $(IGNORED_WARNINGS)
    326 LOCAL_SDK_VERSION := 14
    327 LOCAL_NDK_STL_VARIANT := gnustl_static
    328 
    329 include $(BUILD_STATIC_LIBRARY)
    330 
    331 # Clean temp vars
    332 protobuf_cc_full_src_files :=
    333 
    334 
    335 # Android Protocol buffer compiler, aprotoc (host executable)
    336 # used by the build systems as $(PROTOC) defined in
    337 # build/core/config.mk
    338 # =======================================================
    339 include $(CLEAR_VARS)
    340 
    341 LOCAL_MODULE := aprotoc
    342 LOCAL_MODULE_CLASS := EXECUTABLES
    343 LOCAL_MODULE_TAGS := optional
    344 
    345 LOCAL_CPP_EXTENSION := .cc
    346 LOCAL_SRC_FILES := $(COMPILER_SRC_FILES)
    347 
    348 LOCAL_C_INCLUDES := \
    349     $(LOCAL_PATH)/android \
    350     external/zlib \
    351     $(LOCAL_PATH)/src
    352 
    353 LOCAL_STATIC_LIBRARIES += libz
    354 LOCAL_LDLIBS := -lpthread
    355 
    356 LOCAL_CFLAGS := $(IGNORED_WARNINGS)
    357 
    358 include $(BUILD_HOST_EXECUTABLE)
    359 
    360 # To test java proto params build rules.
    361 # =======================================================
    362 include $(CLEAR_VARS)
    363 
    364 LOCAL_MODULE := aprotoc-test-nano-params
    365 LOCAL_MODULE_TAGS := tests
    366 LOCAL_SDK_VERSION := current
    367 
    368 LOCAL_PROTOC_OPTIMIZE_TYPE := nano
    369 
    370 LOCAL_SRC_FILES := \
    371         src/google/protobuf/unittest_import_nano.proto \
    372         src/google/protobuf/unittest_simple_nano.proto \
    373         src/google/protobuf/unittest_stringutf8_nano.proto \
    374         src/google/protobuf/unittest_recursive_nano.proto
    375 
    376 
    377 LOCAL_PROTOC_FLAGS := --proto_path=$(LOCAL_PATH)/src
    378 
    379 LOCAL_PROTO_JAVA_OUTPUT_PARAMS := \
    380         java_package = $(LOCAL_PATH)/src/google/protobuf/unittest_import_nano.proto|com.google.protobuf.nano, \
    381         java_outer_classname = $(LOCAL_PATH)/src/google/protobuf/unittest_import_nano.proto|UnittestImportNano
    382 
    383 include $(BUILD_STATIC_JAVA_LIBRARY)
    384 
    385 # To test Android-specific nanoproto features.
    386 # =======================================================
    387 include $(CLEAR_VARS)
    388 
    389 # Parcelable messages
    390 LOCAL_MODULE := android-nano-test-parcelable
    391 LOCAL_MODULE_TAGS := tests
    392 LOCAL_SDK_VERSION := current
    393 
    394 LOCAL_PROTOC_OPTIMIZE_TYPE := nano
    395 
    396 LOCAL_SRC_FILES := src/google/protobuf/unittest_simple_nano.proto
    397 
    398 LOCAL_PROTOC_FLAGS := --proto_path=$(LOCAL_PATH)/src
    399 
    400 LOCAL_PROTO_JAVA_OUTPUT_PARAMS := \
    401         parcelable_messages = true
    402 
    403 include $(BUILD_STATIC_JAVA_LIBRARY)
    404 
    405 include $(CLEAR_VARS)
    406 
    407 # Parcelable and extendable messages
    408 LOCAL_MODULE := android-nano-test-parcelable-extendable
    409 LOCAL_MODULE_TAGS := tests
    410 LOCAL_SDK_VERSION := current
    411 
    412 LOCAL_PROTOC_OPTIMIZE_TYPE := nano
    413 
    414 LOCAL_SRC_FILES := src/google/protobuf/unittest_extension_nano.proto
    415 
    416 LOCAL_PROTOC_FLAGS := --proto_path=$(LOCAL_PATH)/src
    417 
    418 LOCAL_PROTO_JAVA_OUTPUT_PARAMS := \
    419         parcelable_messages = true, \
    420         store_unknown_fields = true
    421 
    422 include $(BUILD_STATIC_JAVA_LIBRARY)
    423 
    424 include $(CLEAR_VARS)
    425 
    426 # Test APK
    427 LOCAL_PACKAGE_NAME := NanoAndroidTest
    428 
    429 LOCAL_SDK_VERSION := 8
    430 
    431 LOCAL_MODULE_TAGS := tests
    432 
    433 LOCAL_SRC_FILES := $(call all-java-files-under, java/src/device/test/java/com/google/protobuf/nano)
    434 
    435 LOCAL_MANIFEST_FILE := java/src/device/test/AndroidManifest.xml
    436 
    437 LOCAL_STATIC_JAVA_LIBRARIES := libprotobuf-java-2.3.0-nano \
    438         android-nano-test-parcelable \
    439         android-nano-test-parcelable-extendable
    440 
    441 LOCAL_DEX_PREOPT := false
    442 
    443 include $(BUILD_PACKAGE)
    444