Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame^] | 1 | # -*- mode: makefile -*- |
| 2 | # Copyright (C) 2013 The Android Open Source Project |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | # |
| 17 | # Definitions for building the Conscrypt Java library, native code, |
| 18 | # and associated tests. |
| 19 | # |
| 20 | |
| 21 | # |
| 22 | # Common definitions for host and target. |
| 23 | # |
| 24 | |
| 25 | # Conscrypt is divided into modules. |
| 26 | # |
| 27 | # The structure is: |
| 28 | # |
| 29 | # src/ |
| 30 | # main/ # To be shipped on every device. |
| 31 | # java/ # Java source for library code. |
| 32 | # native/ # C++ source for library code. |
| 33 | # resources/ # Support files. |
| 34 | # test/ # Built only on demand, for testing. |
| 35 | # java/ # Java source for tests. |
| 36 | # native/ # C++ source for tests (rare). |
| 37 | # resources/ # Support files. |
| 38 | # |
| 39 | # All subdirectories are optional (hence the "2> /dev/null"s below). |
| 40 | |
| 41 | LOCAL_PATH := $(call my-dir) |
| 42 | |
| 43 | local_javac_flags=-encoding UTF-8 |
| 44 | #local_javac_flags+=-Xlint:all -Xlint:-serial,-deprecation,-unchecked |
| 45 | local_javac_flags+=-Xmaxwarns 9999999 |
| 46 | |
| 47 | core_cflags := -Wall -Wextra -Werror |
| 48 | core_cppflags := -std=gnu++11 |
| 49 | |
| 50 | # |
| 51 | # Build for the target (device). |
| 52 | # |
| 53 | |
| 54 | # Create the conscrypt library |
| 55 | include $(CLEAR_VARS) |
| 56 | LOCAL_SRC_FILES := $(call all-java-files-under,src/main/java) |
| 57 | LOCAL_JAVA_LIBRARIES := core |
| 58 | LOCAL_NO_STANDARD_LIBRARIES := true |
| 59 | LOCAL_JAVACFLAGS := $(local_javac_flags) |
| 60 | LOCAL_JARJAR_RULES := $(LOCAL_PATH)/jarjar-rules.txt |
| 61 | LOCAL_MODULE_TAGS := optional |
| 62 | LOCAL_MODULE := conscrypt |
| 63 | LOCAL_REQUIRED_MODULES := libjavacrypto |
| 64 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 65 | include $(BUILD_JAVA_LIBRARY) |
| 66 | |
| 67 | # Create the conscrypt library without jarjar for tests |
| 68 | include $(CLEAR_VARS) |
| 69 | LOCAL_SRC_FILES := $(call all-java-files-under,src/main/java) |
| 70 | LOCAL_JAVA_LIBRARIES := core |
| 71 | LOCAL_NO_STANDARD_LIBRARIES := true |
| 72 | LOCAL_JAVACFLAGS := $(local_javac_flags) |
| 73 | LOCAL_MODULE_TAGS := optional |
| 74 | LOCAL_MODULE := conscrypt-nojarjar |
| 75 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 76 | include $(BUILD_STATIC_JAVA_LIBRARY) |
| 77 | |
| 78 | ifeq ($(LIBCORE_SKIP_TESTS),) |
| 79 | # Make the conscrypt-tests library. |
| 80 | include $(CLEAR_VARS) |
| 81 | LOCAL_SRC_FILES := $(call all-java-files-under,src/test/java) |
| 82 | LOCAL_NO_STANDARD_LIBRARIES := true |
| 83 | LOCAL_JAVA_LIBRARIES := bouncycastle core core-junit |
| 84 | LOCAL_STATIC_JAVA_LIBRARIES := core-tests-support conscrypt-nojarjar |
| 85 | LOCAL_JAVACFLAGS := $(local_javac_flags) |
| 86 | LOCAL_MODULE_TAGS := optional |
| 87 | LOCAL_MODULE := conscrypt-tests |
| 88 | LOCAL_REQUIRED_MODULES := libjavacrypto |
| 89 | LOCAL_JARJAR_RULES := $(LOCAL_PATH)/jarjar-rules.txt |
| 90 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 91 | include $(BUILD_STATIC_JAVA_LIBRARY) |
| 92 | endif |
| 93 | |
| 94 | # Platform conscrypt crypto JNI library |
| 95 | include $(CLEAR_VARS) |
| 96 | LOCAL_CFLAGS += $(core_cflags) |
| 97 | LOCAL_CFLAGS += -DJNI_JARJAR_PREFIX="com/android/" |
| 98 | LOCAL_CPPFLAGS += $(core_cppflags) |
| 99 | LOCAL_SRC_FILES := \ |
| 100 | src/main/native/org_conscrypt_NativeCrypto.cpp |
| 101 | LOCAL_C_INCLUDES += $(core_c_includes) \ |
| 102 | libcore/luni/src/main/native |
| 103 | LOCAL_SHARED_LIBRARIES += $(core_shared_libraries) libcrypto libssl libnativehelper libz libjavacore |
| 104 | LOCAL_STATIC_LIBRARIES += $(core_static_libraries) |
| 105 | LOCAL_MODULE_TAGS := optional |
| 106 | LOCAL_MODULE := libjavacrypto |
| 107 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 108 | include $(BUILD_SHARED_LIBRARY) |
| 109 | |
| 110 | # |
| 111 | # Build for the host. |
| 112 | # |
| 113 | |
| 114 | ifeq ($(WITH_HOST_DALVIK),true) |
| 115 | # Make the conscrypt-hostdex library |
| 116 | include $(CLEAR_VARS) |
| 117 | LOCAL_SRC_FILES := $(call all-java-files-under,src/main/java) |
| 118 | LOCAL_JAVA_LIBRARIES := core-hostdex |
| 119 | LOCAL_NO_STANDARD_LIBRARIES := true |
| 120 | LOCAL_JAVACFLAGS := $(local_javac_flags) |
| 121 | LOCAL_JARJAR_RULES := $(LOCAL_PATH)/jarjar-rules.txt |
| 122 | LOCAL_BUILD_HOST_DEX := true |
| 123 | LOCAL_MODULE_TAGS := optional |
| 124 | LOCAL_MODULE := conscrypt-hostdex |
| 125 | LOCAL_REQUIRED_MODULES := libjavacrypto |
| 126 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 127 | include $(BUILD_HOST_JAVA_LIBRARY) |
| 128 | |
| 129 | # Make the conscrypt-hostdex-nojarjar for tests |
| 130 | include $(CLEAR_VARS) |
| 131 | LOCAL_SRC_FILES := $(call all-java-files-under,src/main/java) |
| 132 | LOCAL_JAVA_LIBRARIES := core-hostdex |
| 133 | LOCAL_NO_STANDARD_LIBRARIES := true |
| 134 | LOCAL_JAVACFLAGS := $(local_javac_flags) |
| 135 | LOCAL_BUILD_HOST_DEX := true |
| 136 | LOCAL_MODULE_TAGS := optional |
| 137 | LOCAL_MODULE := conscrypt-hostdex-nojarjar |
| 138 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 139 | include $(BUILD_HOST_JAVA_LIBRARY) |
| 140 | |
| 141 | # Make the conscrypt-tests library. |
| 142 | ifeq ($(LIBCORE_SKIP_TESTS),) |
| 143 | include $(CLEAR_VARS) |
| 144 | LOCAL_SRC_FILES := $(call all-java-files-under,src/test/java) |
| 145 | LOCAL_NO_STANDARD_LIBRARIES := true |
| 146 | LOCAL_JAVA_LIBRARIES := bouncycastle-hostdex core-hostdex core-junit-hostdex core-tests-support-hostdex conscrypt-hostdex-nojarjar |
| 147 | LOCAL_JAVACFLAGS := $(local_javac_flags) |
| 148 | LOCAL_MODULE_TAGS := optional |
| 149 | LOCAL_MODULE := conscrypt-tests-hostdex |
| 150 | LOCAL_REQUIRED_MODULES := libjavacrypto |
| 151 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 152 | LOCAL_BUILD_HOST_DEX := true |
| 153 | include $(BUILD_HOST_JAVA_LIBRARY) |
| 154 | endif |
| 155 | |
| 156 | # Conscrypt native library for host |
| 157 | include $(CLEAR_VARS) |
| 158 | LOCAL_SRC_FILES += \ |
| 159 | src/main/native/org_conscrypt_NativeCrypto.cpp |
| 160 | LOCAL_C_INCLUDES += $(core_c_includes) \ |
| 161 | libcore/luni/src/main/native |
| 162 | LOCAL_CPPFLAGS += $(core_cppflags) |
| 163 | LOCAL_LDLIBS += -lpthread |
| 164 | LOCAL_MODULE_TAGS := optional |
| 165 | LOCAL_MODULE := libjavacrypto |
| 166 | LOCAL_CFLAGS += -DJNI_JARJAR_PREFIX="com/android/" |
| 167 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 168 | LOCAL_SHARED_LIBRARIES += $(core_shared_libraries) libssl-host libcrypto-host libjavacore |
| 169 | LOCAL_STATIC_LIBRARIES += $(core_static_libraries) |
| 170 | include $(BUILD_HOST_SHARED_LIBRARY) |
| 171 | |
| 172 | # Conscrypt native library for nojarjar'd version |
| 173 | include $(CLEAR_VARS) |
| 174 | LOCAL_SRC_FILES += \ |
| 175 | src/main/native/org_conscrypt_NativeCrypto.cpp |
| 176 | LOCAL_C_INCLUDES += $(core_c_includes) \ |
| 177 | libcore/luni/src/main/native |
| 178 | LOCAL_CPPFLAGS += $(core_cppflags) |
| 179 | LOCAL_LDLIBS += -lpthread |
| 180 | LOCAL_MODULE_TAGS := optional |
| 181 | LOCAL_MODULE := libconscrypt_jni |
| 182 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 183 | LOCAL_SHARED_LIBRARIES += $(core_shared_libraries) libssl-host libcrypto-host libjavacore |
| 184 | LOCAL_STATIC_LIBRARIES += $(core_static_libraries) |
| 185 | include $(BUILD_HOST_SHARED_LIBRARY) |
| 186 | endif |