1# 2# Copyright (C) 2015 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 17ifeq ($(HOST_OS),linux) 18common_cppflags := -Wall -Wextra -Wunused -Werror -Wold-style-cast 19 20LOCAL_PATH := $(call my-dir) 21 22include $(CLEAR_VARS) 23 24LOCAL_CPP_EXTENSION := .cc 25 26LOCAL_SRC_FILES := \ 27 src/debug.cc \ 28 src/delta_encoder.cc \ 29 src/elf_file.cc \ 30 src/packer.cc \ 31 src/sleb128.cc \ 32 33LOCAL_STATIC_LIBRARIES := libelf libz 34LOCAL_C_INCLUDES := external/elfutils/src/libelf 35LOCAL_MODULE := lib_relocation_packer 36 37LOCAL_CPPFLAGS := $(common_cppflags) 38 39LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 40 41include $(BUILD_HOST_STATIC_LIBRARY) 42 43include $(CLEAR_VARS) 44 45LOCAL_CPP_EXTENSION := .cc 46 47LOCAL_SRC_FILES := src/main.cc 48LOCAL_STATIC_LIBRARIES := lib_relocation_packer libelf libz 49 50# Statically linking libc++ to make it work from prebuilts 51LOCAL_CXX_STL := libc++_static 52LOCAL_C_INCLUDES := external/elfutils/src/libelf libnativehelper/include 53 54LOCAL_MODULE := relocation_packer 55 56LOCAL_CPPFLAGS := $(common_cppflags) 57 58LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 59 60include $(BUILD_HOST_EXECUTABLE) 61 62include $(CLEAR_VARS) 63 64LOCAL_CPP_EXTENSION := .cc 65 66LOCAL_SRC_FILES := \ 67 src/debug_unittest.cc \ 68 src/delta_encoder_unittest.cc \ 69 src/elf_file_unittest.cc \ 70 src/sleb128_unittest.cc \ 71 src/packer_unittest.cc \ 72 73LOCAL_STATIC_LIBRARIES := lib_relocation_packer libelf libz 74LOCAL_C_INCLUDES := external/elfutils/src/libelf 75 76LOCAL_CPPFLAGS := $(common_cppflags) 77 78LOCAL_MODULE := relocation_packer_unit_tests 79LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 80 81include $(BUILD_HOST_NATIVE_TEST) 82 83# $(1) library name 84define copy-test-library 85include $(CLEAR_VARS) 86LOCAL_IS_HOST_MODULE := true 87LOCAL_MODULE := $(1) 88LOCAL_MODULE_CLASS := SHARED_LIBRARIES 89LOCAL_MODULE_PATH := $(HOST_OUT_EXECUTABLES) 90LOCAL_STRIP_MODULE := false 91LOCAL_SRC_FILES := test_data/$(1) 92include $(BUILD_PREBUILT) 93endef 94 95$(eval $(call copy-test-library,elf_file_unittest_relocs_arm32.so)) 96$(eval $(call copy-test-library,elf_file_unittest_relocs_arm32_packed.so)) 97$(eval $(call copy-test-library,elf_file_unittest_relocs_arm64.so)) 98$(eval $(call copy-test-library,elf_file_unittest_relocs_arm64_packed.so)) 99$(eval $(call copy-test-library,elf_file_unittest_relocs_ia32.so)) 100$(eval $(call copy-test-library,elf_file_unittest_relocs_ia32_packed.so)) 101$(eval $(call copy-test-library,elf_file_unittest_relocs_x64.so)) 102$(eval $(call copy-test-library,elf_file_unittest_relocs_x64_packed.so)) 103$(eval $(call copy-test-library,elf_file_unittest_relocs_mips32.so)) 104$(eval $(call copy-test-library,elf_file_unittest_relocs_mips32_packed.so)) 105 106endif 107