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 | |
Kenny Root | 1cfba2b | 2014-05-27 18:44:53 +0000 | [diff] [blame] | 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) |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 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 |
Kenny Root | 92b12a8 | 2013-10-02 16:44:41 -0700 | [diff] [blame] | 74 | LOCAL_MODULE := conscrypt-nojarjar |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 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 |
Kenny Root | 92b12a8 | 2013-10-02 16:44:41 -0700 | [diff] [blame] | 87 | LOCAL_MODULE := conscrypt-tests |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 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 |
Kenny Root | 0a84a21 | 2013-10-01 17:48:03 -0700 | [diff] [blame] | 101 | LOCAL_C_INCLUDES += \ |
| 102 | external/openssl/include \ |
| 103 | libcore/include \ |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 104 | libcore/luni/src/main/native |
Kenny Root | 0a84a21 | 2013-10-01 17:48:03 -0700 | [diff] [blame] | 105 | LOCAL_SHARED_LIBRARIES := libcrypto libjavacore liblog libnativehelper libssl libz |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 106 | LOCAL_MODULE_TAGS := optional |
Kenny Root | 92b12a8 | 2013-10-02 16:44:41 -0700 | [diff] [blame] | 107 | LOCAL_MODULE := libjavacrypto |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 108 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 109 | include $(BUILD_SHARED_LIBRARY) |
| 110 | |
Kenny Root | 3e46e4e | 2014-05-23 13:35:10 -0700 | [diff] [blame] | 111 | # Unbundled Conscrypt jar |
| 112 | include $(CLEAR_VARS) |
| 113 | exclude_src_files := \ |
| 114 | src/main/java/org/conscrypt/CertPinManager.java \ |
| 115 | src/main/java/org/conscrypt/FileClientSessionCache.java \ |
| 116 | src/main/java/org/conscrypt/JSSEProvider.java \ |
| 117 | src/main/java/org/conscrypt/PinFailureLogger.java \ |
| 118 | src/main/java/org/conscrypt/PinListEntry.java \ |
| 119 | src/main/java/org/conscrypt/Platform.java \ |
| 120 | src/main/java/org/conscrypt/TrustedCertificateIndex.java \ |
| 121 | src/main/java/org/conscrypt/TrustedCertificateKeyStoreSpi.java \ |
| 122 | src/main/java/org/conscrypt/TrustedCertificateStore.java \ |
| 123 | src/main/java/org/conscrypt/TrustManagerFactoryImpl.java \ |
| 124 | src/main/java/org/conscrypt/TrustManagerImpl.java |
| 125 | unbundled_src_files := $(call all-java-files-under,src/main/java) |
| 126 | unbundled_src_files += $(call all-java-files-under,src/compat/java) |
| 127 | unbundled_src_files := $(filter-out $(exclude_src_files), $(unbundled_src_files)) |
| 128 | LOCAL_SRC_FILES := $(unbundled_src_files) |
| 129 | LOCAL_SDK_VERSION := 9 |
| 130 | LOCAL_JAVACFLAGS := $(local_javac_flags) |
| 131 | LOCAL_MODULE_TAGS := optional |
Kenny Root | 031510f | 2014-05-29 13:53:05 -0700 | [diff] [blame] | 132 | LOCAL_MODULE := conscrypt_unbundled |
Kenny Root | 3e46e4e | 2014-05-23 13:35:10 -0700 | [diff] [blame] | 133 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 134 | include $(BUILD_STATIC_JAVA_LIBRARY) |
| 135 | |
| 136 | # Unbundled Conscrypt crypto JNI library |
| 137 | include $(CLEAR_VARS) |
| 138 | LOCAL_CFLAGS += $(core_cflags) |
| 139 | LOCAL_CPPFLAGS += $(core_cppflags) |
| 140 | LOCAL_SRC_FILES := \ |
| 141 | src/main/native/org_conscrypt_NativeCrypto.cpp \ |
| 142 | src/compat/native/JNIHelp.cpp |
| 143 | LOCAL_C_INCLUDES += \ |
| 144 | external/openssl/include \ |
| 145 | external/conscrypt/src/compat/native |
Kenny Root | 031510f | 2014-05-29 13:53:05 -0700 | [diff] [blame] | 146 | LOCAL_LDFLAGS := -llog -lz -ldl |
Kenny Root | 3e46e4e | 2014-05-23 13:35:10 -0700 | [diff] [blame] | 147 | LOCAL_STATIC_LIBRARIES := libssl_static libcrypto_static |
| 148 | LOCAL_MODULE_TAGS := optional |
| 149 | LOCAL_MODULE := libconscrypt_jni |
| 150 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 151 | LOCAL_SDK_VERSION := 9 |
| 152 | include $(BUILD_SHARED_LIBRARY) |
| 153 | |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 154 | # |
| 155 | # Build for the host. |
| 156 | # |
| 157 | |
| 158 | ifeq ($(WITH_HOST_DALVIK),true) |
Kenny Root | 1cfba2b | 2014-05-27 18:44:53 +0000 | [diff] [blame] | 159 | # Make the conscrypt-hostdex library |
| 160 | include $(CLEAR_VARS) |
| 161 | LOCAL_SRC_FILES := $(call all-java-files-under,src/main/java) |
| 162 | LOCAL_JAVACFLAGS := $(local_javac_flags) |
| 163 | LOCAL_JARJAR_RULES := $(LOCAL_PATH)/jarjar-rules.txt |
| 164 | LOCAL_MODULE_TAGS := optional |
| 165 | LOCAL_MODULE := conscrypt-hostdex |
| 166 | LOCAL_REQUIRED_MODULES := libjavacrypto |
| 167 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 168 | include $(BUILD_HOST_DALVIK_JAVA_LIBRARY) |
| 169 | |
| 170 | # Make the conscrypt-hostdex-nojarjar for tests |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 171 | include $(CLEAR_VARS) |
| 172 | LOCAL_SRC_FILES := $(call all-java-files-under,src/main/java) |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 173 | LOCAL_JAVACFLAGS := $(local_javac_flags) |
| 174 | LOCAL_BUILD_HOST_DEX := true |
| 175 | LOCAL_MODULE_TAGS := optional |
Kenny Root | 92b12a8 | 2013-10-02 16:44:41 -0700 | [diff] [blame] | 176 | LOCAL_MODULE := conscrypt-hostdex-nojarjar |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 177 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
Narayan Kamath | b32d679 | 2013-10-28 14:22:43 +0000 | [diff] [blame] | 178 | include $(BUILD_HOST_DALVIK_JAVA_LIBRARY) |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 179 | |
| 180 | # Make the conscrypt-tests library. |
| 181 | ifeq ($(LIBCORE_SKIP_TESTS),) |
| 182 | include $(CLEAR_VARS) |
| 183 | LOCAL_SRC_FILES := $(call all-java-files-under,src/test/java) |
Narayan Kamath | b32d679 | 2013-10-28 14:22:43 +0000 | [diff] [blame] | 184 | LOCAL_JAVA_LIBRARIES := bouncycastle-hostdex core-junit-hostdex core-tests-support-hostdex conscrypt-hostdex-nojarjar |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 185 | LOCAL_JAVACFLAGS := $(local_javac_flags) |
| 186 | LOCAL_MODULE_TAGS := optional |
Kenny Root | 92b12a8 | 2013-10-02 16:44:41 -0700 | [diff] [blame] | 187 | LOCAL_MODULE := conscrypt-tests-hostdex |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 188 | LOCAL_REQUIRED_MODULES := libjavacrypto |
| 189 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
Narayan Kamath | b32d679 | 2013-10-28 14:22:43 +0000 | [diff] [blame] | 190 | include $(BUILD_HOST_DALVIK_JAVA_LIBRARY) |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 191 | endif |
| 192 | |
| 193 | # Conscrypt native library for host |
| 194 | include $(CLEAR_VARS) |
| 195 | LOCAL_SRC_FILES += \ |
| 196 | src/main/native/org_conscrypt_NativeCrypto.cpp |
Kenny Root | 0a84a21 | 2013-10-01 17:48:03 -0700 | [diff] [blame] | 197 | LOCAL_C_INCLUDES += \ |
| 198 | external/openssl/include \ |
| 199 | libcore/include \ |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 200 | libcore/luni/src/main/native |
| 201 | LOCAL_CPPFLAGS += $(core_cppflags) |
| 202 | LOCAL_LDLIBS += -lpthread |
| 203 | LOCAL_MODULE_TAGS := optional |
Kenny Root | 92b12a8 | 2013-10-02 16:44:41 -0700 | [diff] [blame] | 204 | LOCAL_MODULE := libjavacrypto |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 205 | LOCAL_CFLAGS += -DJNI_JARJAR_PREFIX="com/android/" |
| 206 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
Kenny Root | 0a84a21 | 2013-10-01 17:48:03 -0700 | [diff] [blame] | 207 | LOCAL_SHARED_LIBRARIES := libcrypto-host libjavacore liblog libnativehelper libssl-host |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 208 | include $(BUILD_HOST_SHARED_LIBRARY) |
| 209 | |
| 210 | # Conscrypt native library for nojarjar'd version |
Kenny Root | 4ccb72f | 2014-05-30 11:27:32 -0700 | [diff] [blame^] | 211 | # Don't build this for unbundled conscrypt build |
| 212 | ifeq (,$(TARGET_BUILD_APPS)) |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 213 | include $(CLEAR_VARS) |
| 214 | LOCAL_SRC_FILES += \ |
| 215 | src/main/native/org_conscrypt_NativeCrypto.cpp |
Kenny Root | 0a84a21 | 2013-10-01 17:48:03 -0700 | [diff] [blame] | 216 | LOCAL_C_INCLUDES += \ |
| 217 | external/openssl/include \ |
| 218 | libcore/include \ |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 219 | libcore/luni/src/main/native |
Kenny Root | 3e46e4e | 2014-05-23 13:35:10 -0700 | [diff] [blame] | 220 | LOCAL_CPPFLAGS += $(core_cppflags) -DCONSCRYPT_NOT_UNBUNDLED |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 221 | LOCAL_LDLIBS += -lpthread |
| 222 | LOCAL_MODULE_TAGS := optional |
Kenny Root | 92b12a8 | 2013-10-02 16:44:41 -0700 | [diff] [blame] | 223 | LOCAL_MODULE := libconscrypt_jni |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 224 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
Kenny Root | 7150e32 | 2013-10-01 19:54:34 -0700 | [diff] [blame] | 225 | LOCAL_SHARED_LIBRARIES := libcrypto-host libjavacore liblog libnativehelper libssl-host |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 226 | include $(BUILD_HOST_SHARED_LIBRARY) |
Kenny Root | 4ccb72f | 2014-05-30 11:27:32 -0700 | [diff] [blame^] | 227 | endif |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 228 | endif |