1# 2# Copyright (C) 2014 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# ----------------------------------------------------------------------------- 18# Library used by dlext tests - zipped and aligned 19# ----------------------------------------------------------------------------- 20 21BIONIC_TESTS_ZIPALIGN := $(HOST_OUT_EXECUTABLES)/bionic_tests_zipalign 22 23include $(CLEAR_VARS) 24 25LOCAL_MODULE_CLASS := SHARED_LIBRARIES 26LOCAL_MODULE := libdlext_test_zip_zipaligned 27LOCAL_MODULE_SUFFIX := .zip 28LOCAL_MODULE_TAGS := tests 29LOCAL_MODULE_PATH := $($(bionic_2nd_arch_prefix)TARGET_OUT_DATA_NATIVE_TESTS)/libdlext_test_zip 30LOCAL_2ND_ARCH_VAR_PREFIX := $(bionic_2nd_arch_prefix) 31 32include $(BUILD_SYSTEM)/base_rules.mk 33 34my_shared_libs := \ 35 $($(bionic_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/libdlext_test_zip.so \ 36 $($(bionic_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/libatest_simple_zip.so 37 38$(LOCAL_BUILT_MODULE) : $(my_shared_libs) | $(BIONIC_TESTS_ZIPALIGN) 39 @echo "Aligning zip: $@" 40 $(hide) rm -rf $(dir $@) && mkdir -p $(dir $@)/libdir 41 $(hide) cp $^ $(dir $@)/libdir 42 $(hide) (cd $(dir $@) && touch empty_file.txt && zip -qrD0 $(notdir $@).unaligned empty_file.txt libdir/*.so) 43 $(hide) $(BIONIC_TESTS_ZIPALIGN) 4096 $@.unaligned $@ 44 45include $(CLEAR_VARS) 46 47LOCAL_MODULE_CLASS := SHARED_LIBRARIES 48LOCAL_MODULE := libdlext_test_runpath_zip_zipaligned 49LOCAL_MODULE_SUFFIX := .zip 50LOCAL_MODULE_TAGS := tests 51LOCAL_MODULE_PATH := $($(bionic_2nd_arch_prefix)TARGET_OUT_DATA_NATIVE_TESTS)/libdlext_test_runpath_zip 52LOCAL_2ND_ARCH_VAR_PREFIX := $(bionic_2nd_arch_prefix) 53 54include $(BUILD_SYSTEM)/base_rules.mk 55my_shared_libs := \ 56 $($(bionic_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/libtest_dt_runpath_d_zip.so \ 57 $($(bionic_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/libtest_dt_runpath_b.so \ 58 $($(bionic_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/libtest_dt_runpath_a.so \ 59 $($(bionic_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/libtest_dt_runpath_c.so \ 60 $($(bionic_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/libtest_dt_runpath_x.so 61 62 63$(LOCAL_BUILT_MODULE) : PRIVATE_LIB_D := \ 64 $($(bionic_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/libtest_dt_runpath_d_zip.so 65$(LOCAL_BUILT_MODULE) : PRIVATE_LIB_A := \ 66 $($(bionic_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/libtest_dt_runpath_a.so 67$(LOCAL_BUILT_MODULE) : PRIVATE_LIB_B := \ 68 $($(bionic_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/libtest_dt_runpath_b.so 69$(LOCAL_BUILT_MODULE) : PRIVATE_LIB_C := \ 70 $($(bionic_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/libtest_dt_runpath_c.so 71$(LOCAL_BUILT_MODULE) : PRIVATE_LIB_X := \ 72 $($(bionic_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/libtest_dt_runpath_x.so 73$(LOCAL_BUILT_MODULE) : $(my_shared_libs) | $(BIONIC_TESTS_ZIPALIGN) 74 @echo "Aligning zip: $@" 75 $(hide) rm -rf $(dir $@) && mkdir -p $(dir $@)/libdir && \ 76 mkdir -p $(dir $@)/libdir/dt_runpath_a && mkdir -p $(dir $@)/libdir/dt_runpath_b_c_x 77 $(hide) cp $(PRIVATE_LIB_D) $(dir $@)/libdir 78 $(hide) cp $(PRIVATE_LIB_A) $(dir $@)/libdir/dt_runpath_a 79 $(hide) cp $(PRIVATE_LIB_B) $(dir $@)/libdir/dt_runpath_b_c_x 80 $(hide) cp $(PRIVATE_LIB_C) $(dir $@)/libdir/dt_runpath_b_c_x 81 $(hide) cp $(PRIVATE_LIB_X) $(dir $@)/libdir/dt_runpath_b_c_x 82 $(hide) (cd $(dir $@) && touch empty_file.txt && zip -qrD0 $(notdir $@).unaligned empty_file.txt libdir) 83 $(hide) $(BIONIC_TESTS_ZIPALIGN) 4096 $@.unaligned $@ 84 85