blob: 274e99898f1f63d48febc543b956eb9ca8e341f9 [file] [log] [blame]
Dmitriy Ivanov07e5bc12014-10-03 17:52:44 -07001#
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
21# TODO: It there simple way to do this?
22$(bionic_2nd_arch_prefix)bionic_dlext_test_zip := \
23 $($(bionic_2nd_arch_prefix)TARGET_OUT_INTERMEDIATES)/libdlext_test_fd/dlext_test_origin.zip
24$(bionic_2nd_arch_prefix)bionic_dlext_test_zip_aligned := \
25 $($(bionic_2nd_arch_prefix)TARGET_OUT_DATA_NATIVE_TESTS)/libdlext_test_fd/dlext_test.zip
26ALL_MODULES += $($(bionic_2nd_arch_prefix)bionic_dlext_test_zip_aligned)
Dmitriy Ivanov51166d32014-10-08 14:55:39 -070027ALL_MODULES.$($(bionic_2nd_arch_prefix)bionic_dlext_test_zip_aligned).PATH := $(call my-dir)
Dmitriy Ivanov07e5bc12014-10-03 17:52:44 -070028
29$(bionic_2nd_arch_prefix)bionic_dlext_built_shared_libraries := \
30 $($(bionic_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/libdlext_test_fd.so
31
32bionic_dlext_test_zip_alignment := 4096 # PAGE_SIZE
33
34$(bionic_2nd_arch_prefix)bionic_dlext_test_zip_tmpdir := $(dir $($(bionic_2nd_arch_prefix)bionic_dlext_test_zip))
35
36$($(bionic_2nd_arch_prefix)bionic_dlext_test_zip)_prepare: $($(bionic_2nd_arch_prefix)bionic_dlext_built_shared_libraries)
37 $(hide) mkdir -p $(dir $@)
38 $(hide) cp -p $< $(dir $@)
39
40$($(bionic_2nd_arch_prefix)bionic_dlext_test_zip): $($(bionic_2nd_arch_prefix)bionic_dlext_test_zip)_prepare
41 @echo "Zip: $@"
42 $(hide) (cd $(dir $@) && touch empty_file.txt && zip -rD0 $(notdir $@) empty_file.txt libdlext_test_fd.so)
43
44$($(bionic_2nd_arch_prefix)bionic_dlext_test_zip_aligned): $($(bionic_2nd_arch_prefix)bionic_dlext_test_zip) | $(ZIPALIGN)
45 $(hide) rm -rf $@
46 $(hide) mkdir -p $(dir $@)
47 @echo "Zipalign $(bionic_dlext_test_zip_alignment): $@"
48 $(hide) zipalign $(bionic_dlext_test_zip_alignment) $< $@
49