NativeCode.mk revision 992bc97a7c13d2b7d99b6811bc796fd93412fe0c
1c3d30bfb532fc1e609a67a324d6bfb9776f88778Elliott Hughes# -*- mode: makefile -*- 26ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# Copyright (C) 2007 The Android Open Source Project 36ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# 46ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# Licensed under the Apache License, Version 2.0 (the "License"); 56ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# you may not use this file except in compliance with the License. 66ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# You may obtain a copy of the License at 76ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# 86ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# http://www.apache.org/licenses/LICENSE-2.0 96ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# 106ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# Unless required by applicable law or agreed to in writing, software 116ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# distributed under the License is distributed on an "AS IS" BASIS, 126ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 136ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# See the License for the specific language governing permissions and 146ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# limitations under the License. 156ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein 166ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# 176ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# Definitions for building the native code needed for the core library. 186ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# 196ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein 206ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# 216ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# Common definitions for host and target. 226ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# 236ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein 246ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# These two definitions are used to help sanity check what's put in 256ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# sub.mk. See, the "error" directives immediately below. 266ac43c29e4f1918d40441178c22bfca7409101beDan Bornsteincore_magic_local_target := ...//::default:://... 276ac43c29e4f1918d40441178c22bfca7409101beDan Bornsteincore_local_path := $(LOCAL_PATH) 286ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein 296ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# Include a submakefile, resolve its source file locations, 306ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# and stick them on core_src_files. The submakefiles are 316ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# free to append to LOCAL_SRC_FILES, LOCAL_C_INCLUDES, 326ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# LOCAL_SHARED_LIBRARIES, or LOCAL_STATIC_LIBRARIES, but nothing 336ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# else. All other LOCAL_* variables will be ignored. 346ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# 356ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# $(1): directory containing the makefile to include 366ac43c29e4f1918d40441178c22bfca7409101beDan Bornsteindefine include-core-native-dir 376ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein LOCAL_SRC_FILES := 386ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein include $(LOCAL_PATH)/$(1)/sub.mk 396ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein ifneq ($$(LOCAL_MODULE),$(core_magic_local_target)) 406ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein $$(error $(LOCAL_PATH)/$(1)/sub.mk should not include CLEAR_VARS \ 416ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein or define LOCAL_MODULE) 426ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein endif 436ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein ifneq ($$(LOCAL_PATH),$(core_local_path)) 446ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein $$(error $(LOCAL_PATH)/$(1)/sub.mk should not define LOCAL_PATH) 456ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein endif 466ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein core_src_files += $$(addprefix $(1)/,$$(LOCAL_SRC_FILES)) 476ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein LOCAL_SRC_FILES := 486ac43c29e4f1918d40441178c22bfca7409101beDan Bornsteinendef 496ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein 506ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# Set up the default state. Note: We use CLEAR_VARS here, even though 516ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# we aren't quite defining a new rule yet, to make sure that the 526ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# sub.mk files don't see anything stray from the last rule that was 536ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# set up. 546914efca8fe737a753d234d7e91222da6a8cdabeKenny Root 556ac43c29e4f1918d40441178c22bfca7409101beDan Bornsteininclude $(CLEAR_VARS) 566ac43c29e4f1918d40441178c22bfca7409101beDan BornsteinLOCAL_MODULE := $(core_magic_local_target) 5773d3e262ecf514ef17f47da335fdad899aecc3dcElliott HughesLOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/NativeCode.mk 586ac43c29e4f1918d40441178c22bfca7409101beDan Bornsteincore_src_files := 596ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein 606ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# Include the sub.mk files. 616ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein$(foreach dir, \ 6238375a4d0b3d34e2babbd2f6a013976c7c439696Kenny Root crypto/src/main/native dalvik/src/main/native luni/src/main/native, \ 636ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein $(eval $(call include-core-native-dir,$(dir)))) 646ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein 656ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# Extract out the allowed LOCAL_* variables. Note: $(sort) also 666ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# removes duplicates. 676e1c2a95596e3ea72b48c7b54395131acbeab1daJean-Baptiste Querucore_c_includes := $(sort libcore/include $(LOCAL_C_INCLUDES) $(JNI_H_INCLUDE)) 686ac43c29e4f1918d40441178c22bfca7409101beDan Bornsteincore_shared_libraries := $(sort $(LOCAL_SHARED_LIBRARIES)) 696ac43c29e4f1918d40441178c22bfca7409101beDan Bornsteincore_static_libraries := $(sort $(LOCAL_STATIC_LIBRARIES)) 7038375a4d0b3d34e2babbd2f6a013976c7c439696Kenny Rootcore_cflags := -DJNI_JARJAR_PREFIX="com/android/" 716ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein 723042efc693a56888cdd0194ba1fd2504ef1ab67dBrian Carlstromcore_test_files := \ 733042efc693a56888cdd0194ba1fd2504ef1ab67dBrian Carlstrom luni/src/test/native/test_openssl_engine.cpp \ 743042efc693a56888cdd0194ba1fd2504ef1ab67dBrian Carlstrom 756ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# 766ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# Build for the target (device). 776ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# 786ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein 796ac43c29e4f1918d40441178c22bfca7409101beDan Bornsteininclude $(CLEAR_VARS) 806ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein 8124144d482dcd5deac58a5dca7042379c05b56b5eElliott HughesLOCAL_CFLAGS += -Wall -Wextra -Werror 822f03ccad590827233fcba84a8b6eafcd414e5fe7Elliott HughesLOCAL_CFLAGS += $(core_cflags) 831f504c8a04a1ca4131bcfa57c5080b3702224a25Andy McFaddenLOCAL_CPPFLAGS += $(core_cppflags) 8464f2ba48fb9306ab1d97f5f83053ee7f48223de8Elliott Hughesifeq ($(TARGET_ARCH),arm) 8564f2ba48fb9306ab1d97f5f83053ee7f48223de8Elliott Hughes# Ignore "note: the mangling of 'va_list' has changed in GCC 4.4" 8664f2ba48fb9306ab1d97f5f83053ee7f48223de8Elliott HughesLOCAL_CFLAGS += -Wno-psabi 8764f2ba48fb9306ab1d97f5f83053ee7f48223de8Elliott Hughesendif 8864f2ba48fb9306ab1d97f5f83053ee7f48223de8Elliott Hughes 896ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# Define the rules. 906ac43c29e4f1918d40441178c22bfca7409101beDan BornsteinLOCAL_SRC_FILES := $(core_src_files) 9138375a4d0b3d34e2babbd2f6a013976c7c439696Kenny RootLOCAL_CFLAGS := $(core_cflags) 92bb2532130c1c52755916d8608b7057496c6b395aMarco NelissenLOCAL_C_INCLUDES := $(core_c_includes) 937cd6760f7045d771faae8080a8c6150bf678f679Elliott HughesLOCAL_SHARED_LIBRARIES := $(core_shared_libraries) libexpat libicuuc libicui18n libssl libcrypto libz libnativehelper 946ac43c29e4f1918d40441178c22bfca7409101beDan BornsteinLOCAL_STATIC_LIBRARIES := $(core_static_libraries) 9553fbc0a776feebcc04f6c24b34f2c7ba39e6b5a1Jesse WilsonLOCAL_MODULE_TAGS := optional 966ac43c29e4f1918d40441178c22bfca7409101beDan BornsteinLOCAL_MODULE := libjavacore 9773d3e262ecf514ef17f47da335fdad899aecc3dcElliott HughesLOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/NativeCode.mk 9818fb450a3043d52ff6c134ff901987f4d3a9af96Kristian Monsen 99c3d30bfb532fc1e609a67a324d6bfb9776f88778Elliott HughesLOCAL_C_INCLUDES += external/stlport/stlport bionic/ bionic/libstdc++/include 1002cfb2ad66741e923bcd99719bb6b8f4e1189dd4dBrian CarlstromLOCAL_SHARED_LIBRARIES += libstlport 10118fb450a3043d52ff6c134ff901987f4d3a9af96Kristian Monsen 1027cd6760f7045d771faae8080a8c6150bf678f679Elliott Hughesinclude $(BUILD_SHARED_LIBRARY) 1036ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein 1046914efca8fe737a753d234d7e91222da6a8cdabeKenny Root 1056914efca8fe737a753d234d7e91222da6a8cdabeKenny Root# Test library 1066914efca8fe737a753d234d7e91222da6a8cdabeKenny Rootifeq ($(LIBCORE_SKIP_TESTS),) 1076914efca8fe737a753d234d7e91222da6a8cdabeKenny Rootinclude $(CLEAR_VARS) 1086914efca8fe737a753d234d7e91222da6a8cdabeKenny Root 1096914efca8fe737a753d234d7e91222da6a8cdabeKenny RootLOCAL_CFLAGS += -Wall -Wextra -Werror 1106914efca8fe737a753d234d7e91222da6a8cdabeKenny RootLOCAL_CFLAGS += $(core_cflags) 1116914efca8fe737a753d234d7e91222da6a8cdabeKenny RootLOCAL_CPPFLAGS += $(core_cppflags) 1126914efca8fe737a753d234d7e91222da6a8cdabeKenny Rootifeq ($(TARGET_ARCH),arm) 1136914efca8fe737a753d234d7e91222da6a8cdabeKenny Root# Ignore "note: the mangling of 'va_list' has changed in GCC 4.4" 1146914efca8fe737a753d234d7e91222da6a8cdabeKenny RootLOCAL_CFLAGS += -Wno-psabi 1156914efca8fe737a753d234d7e91222da6a8cdabeKenny Rootendif 1166914efca8fe737a753d234d7e91222da6a8cdabeKenny Root 1176914efca8fe737a753d234d7e91222da6a8cdabeKenny Root# Define the rules. 1183042efc693a56888cdd0194ba1fd2504ef1ab67dBrian CarlstromLOCAL_SRC_FILES := $(core_test_files) 1193042efc693a56888cdd0194ba1fd2504ef1ab67dBrian CarlstromLOCAL_C_INCLUDES := libcore/include external/openssl/include 1203042efc693a56888cdd0194ba1fd2504ef1ab67dBrian CarlstromLOCAL_SHARED_LIBRARIES := libcrypto 1216914efca8fe737a753d234d7e91222da6a8cdabeKenny RootLOCAL_MODULE_TAGS := optional 1225f1f97c39628995ed1d1913c192d91e17ea26ef1Kenny RootLOCAL_MODULE := libjavacoretests 1236914efca8fe737a753d234d7e91222da6a8cdabeKenny RootLOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/NativeCode.mk 124992bc97a7c13d2b7d99b6811bc796fd93412fe0cBrian Carlstrominclude external/stlport/libstlport.mk 1256914efca8fe737a753d234d7e91222da6a8cdabeKenny Root 1266914efca8fe737a753d234d7e91222da6a8cdabeKenny Rootinclude $(BUILD_SHARED_LIBRARY) 1276914efca8fe737a753d234d7e91222da6a8cdabeKenny Rootendif # LIBCORE_SKIP_TESTS 1286914efca8fe737a753d234d7e91222da6a8cdabeKenny Root 1296914efca8fe737a753d234d7e91222da6a8cdabeKenny Root 1306ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# 1316ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# Build for the host. 1326ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# 1336ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein 1346ac43c29e4f1918d40441178c22bfca7409101beDan Bornsteinifeq ($(WITH_HOST_DALVIK),true) 1356ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein include $(CLEAR_VARS) 1366ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein # Define the rules. 1376ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein LOCAL_SRC_FILES := $(core_src_files) 1382f03ccad590827233fcba84a8b6eafcd414e5fe7Elliott Hughes LOCAL_CFLAGS += $(core_cflags) 1396ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein LOCAL_C_INCLUDES := $(core_c_includes) 1407cd6760f7045d771faae8080a8c6150bf678f679Elliott Hughes LOCAL_CPPFLAGS += $(core_cppflags) 1417cd6760f7045d771faae8080a8c6150bf678f679Elliott Hughes LOCAL_LDLIBS += -ldl -lpthread 14253fbc0a776feebcc04f6c24b34f2c7ba39e6b5a1Jesse Wilson LOCAL_MODULE_TAGS := optional 1437cd6760f7045d771faae8080a8c6150bf678f679Elliott Hughes LOCAL_MODULE := libjavacore 14473d3e262ecf514ef17f47da335fdad899aecc3dcElliott Hughes LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/NativeCode.mk 1453042efc693a56888cdd0194ba1fd2504ef1ab67dBrian Carlstrom LOCAL_SHARED_LIBRARIES := $(core_shared_libraries) libexpat-host libicuuc-host libicui18n-host libssl-host libcrypto-host libz-host 1467cd6760f7045d771faae8080a8c6150bf678f679Elliott Hughes LOCAL_STATIC_LIBRARIES := $(core_static_libraries) 1477cd6760f7045d771faae8080a8c6150bf678f679Elliott Hughes include $(BUILD_HOST_SHARED_LIBRARY) 1486914efca8fe737a753d234d7e91222da6a8cdabeKenny Root 14920ec13bd54d56d6832ef2a02a02e65a5f0a304dbKenny Root # Conscrypt native library for nojarjar'd version 15020ec13bd54d56d6832ef2a02a02e65a5f0a304dbKenny Root include $(CLEAR_VARS) 15120ec13bd54d56d6832ef2a02a02e65a5f0a304dbKenny Root LOCAL_SRC_FILES := \ 15220ec13bd54d56d6832ef2a02a02e65a5f0a304dbKenny Root crypto/src/main/native/org_conscrypt_NativeCrypto.cpp \ 15320ec13bd54d56d6832ef2a02a02e65a5f0a304dbKenny Root luni/src/main/native/AsynchronousSocketCloseMonitor.cpp 15420ec13bd54d56d6832ef2a02a02e65a5f0a304dbKenny Root LOCAL_C_INCLUDES := $(core_c_includes) 15520ec13bd54d56d6832ef2a02a02e65a5f0a304dbKenny Root LOCAL_CPPFLAGS += $(core_cppflags) 15620ec13bd54d56d6832ef2a02a02e65a5f0a304dbKenny Root LOCAL_LDLIBS += -lpthread 15720ec13bd54d56d6832ef2a02a02e65a5f0a304dbKenny Root LOCAL_MODULE_TAGS := optional 15820ec13bd54d56d6832ef2a02a02e65a5f0a304dbKenny Root LOCAL_MODULE := libconscrypt_jni 15920ec13bd54d56d6832ef2a02a02e65a5f0a304dbKenny Root LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/NativeCode.mk 1607296812aedb06b6faadbb6123a3f626de88c25baKenny Root LOCAL_SHARED_LIBRARIES := $(core_shared_libraries) libssl-host libcrypto-host 16120ec13bd54d56d6832ef2a02a02e65a5f0a304dbKenny Root LOCAL_STATIC_LIBRARIES := $(core_static_libraries) 16220ec13bd54d56d6832ef2a02a02e65a5f0a304dbKenny Root include $(BUILD_HOST_SHARED_LIBRARY) 16320ec13bd54d56d6832ef2a02a02e65a5f0a304dbKenny Root 1646914efca8fe737a753d234d7e91222da6a8cdabeKenny Root ifeq ($(LIBCORE_SKIP_TESTS),) 1656914efca8fe737a753d234d7e91222da6a8cdabeKenny Root include $(CLEAR_VARS) 1666914efca8fe737a753d234d7e91222da6a8cdabeKenny Root # Define the rules. 1673042efc693a56888cdd0194ba1fd2504ef1ab67dBrian Carlstrom LOCAL_SRC_FILES := $(core_test_files) 1686914efca8fe737a753d234d7e91222da6a8cdabeKenny Root LOCAL_CFLAGS += $(core_cflags) 1693042efc693a56888cdd0194ba1fd2504ef1ab67dBrian Carlstrom LOCAL_C_INCLUDES := libcore/include external/openssl/include 1706914efca8fe737a753d234d7e91222da6a8cdabeKenny Root LOCAL_CPPFLAGS += $(core_cppflags) 1716914efca8fe737a753d234d7e91222da6a8cdabeKenny Root LOCAL_LDLIBS += -ldl -lpthread 1726914efca8fe737a753d234d7e91222da6a8cdabeKenny Root LOCAL_MODULE_TAGS := optional 1735f1f97c39628995ed1d1913c192d91e17ea26ef1Kenny Root LOCAL_MODULE := libjavacoretests 1746914efca8fe737a753d234d7e91222da6a8cdabeKenny Root LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/NativeCode.mk 1753042efc693a56888cdd0194ba1fd2504ef1ab67dBrian Carlstrom LOCAL_SHARED_LIBRARIES := libcrypto-host 1766914efca8fe737a753d234d7e91222da6a8cdabeKenny Root include $(BUILD_HOST_SHARED_LIBRARY) 1776914efca8fe737a753d234d7e91222da6a8cdabeKenny Root endif # LIBCORE_SKIP_TESTS 178845ce3cbfd6972542b275c95eddfbb6e94469737Elliott Hughesendif 179