1 LOCAL_PATH := $(call my-dir) 2 include $(CLEAR_VARS) 3 4 ifeq ($(ARCH_ARM_HAVE_NEON),true) 5 libvpx_target := armv7a-neon 6 libvpx_asm := .asm.s 7 else ifeq ($(ARCH_ARM_HAVE_ARMV7A),true) 8 libvpx_target := armv7a 9 libvpx_asm := .asm.s 10 endif 11 12 ifeq ($(TARGET_ARCH),mips) 13 ifneq ($(ARCH_HAS_BIGENDIAN),true) 14 ifeq ($(ARCH_MIPS_DSP_REV),2) 15 libvpx_target := mips-dspr2 16 LOCAL_CFLAGS += -DMIPS_DSP_REV=$(ARCH_MIPS_DSP_REV) 17 else 18 libvpx_target := mips 19 ifeq ($(ARCH_MIPS_DSP_REV),1) 20 LOCAL_CFLAGS += -DMIPS_DSP_REV=$(ARCH_MIPS_DSP_REV) 21 else 22 LOCAL_CFLAGS += -DMIPS_DSP_REV=0 23 endif #mips_dsp_rev1 24 endif #mips_dsp_rev2 25 endif #bigendian 26 endif #mips 27 28 # Un-optimized targets 29 libvpx_target ?= generic 30 libvpx_asm ?= .asm 31 32 libvpx_config_dir := $(LOCAL_PATH)/$(libvpx_target) 33 libvpx_source_dir := $(LOCAL_PATH)/libvpx 34 35 libvpx_codec_srcs := $(shell cat $(libvpx_config_dir)/libvpx_srcs.txt) 36 37 LOCAL_CFLAGS := -DHAVE_CONFIG_H=vpx_config.h 38 39 LOCAL_MODULE := libvpx 40 41 LOCAL_MODULE_CLASS := STATIC_LIBRARIES 42 libvpx_intermediates := $(call local-intermediates-dir) 43 44 # Extract the C files from the list and add them to LOCAL_SRC_FILES. 45 libvpx_codec_srcs_unique := $(sort $(libvpx_codec_srcs)) 46 libvpx_codec_srcs_c := $(filter %.c, $(libvpx_codec_srcs_unique)) 47 # vpx_config.c is an auto-generated file in $(config_dir) 48 libvpx_codec_srcs_c_static := $(filter-out vpx_config.c, $(libvpx_codec_srcs_c)) 49 LOCAL_SRC_FILES += $(addprefix libvpx/, $(libvpx_codec_srcs_c_static)) 50 LOCAL_SRC_FILES += $(libvpx_target)/vpx_config.c 51 52 # ARM and x86 use an 'offsets' file in the assembly. It is generated by 53 # tricking the compiler and generating non-functional output which is then 54 # processed with grep. For ARM, this must be additionally converted from 55 # RVCT (ARM's in-house compiler) format to GNU Assembler Format for gcc. 56 57 # Offset files are currently used in vpx_scale for NEON and some encoder 58 # functions used in both ARM and x86. These files can not be compiled and need 59 # to be named accordingly to avoid auto-build rules. The encoder files are not 60 # used yet but are included in the comments for future reference. 61 62 libvpx_asm_offsets_intermediates := \ 63 vp8/common/asm_com_offsets.intermediate \ 64 vp8/decoder/asm_dec_offsets.intermediate \ 65 vp8/encoder/asm_enc_offsets.intermediate \ 66 67 libvpx_asm_offsets_files := \ 68 vp8/common/asm_com_offsets.asm \ 69 vp8/decoder/asm_dec_offsets.asm \ 70 vp8/encoder/asm_enc_offsets.asm \ 71 72 # Build the S files with inline assembly. 73 COMPILE_TO_S := $(addprefix $(libvpx_intermediates)/, $(libvpx_asm_offsets_intermediates)) 74 $(COMPILE_TO_S) : PRIVATE_INTERMEDIATES := $(libvpx_intermediates) 75 $(COMPILE_TO_S) : PRIVATE_SOURCE_DIR := $(libvpx_source_dir) 76 $(COMPILE_TO_S) : PRIVATE_CONFIG_DIR := $(libvpx_config_dir) 77 $(COMPILE_TO_S) : PRIVATE_CUSTOM_TOOL = $(TARGET_CC) -S $(addprefix -I, $(TARGET_C_INCLUDES)) -I $(PRIVATE_INTERMEDIATES) -I $(PRIVATE_SOURCE_DIR) -I $(PRIVATE_CONFIG_DIR) -DINLINE_ASM -o $@ $< 78 $(COMPILE_TO_S) : $(libvpx_intermediates)/%.intermediate : $(libvpx_source_dir)/%.c 79 $(transform-generated-source) 80 81 # Extract the offsets from the inline assembly. 82 OFFSETS_GEN := $(addprefix $(libvpx_intermediates)/, $(libvpx_asm_offsets_files)) 83 $(OFFSETS_GEN) : PRIVATE_OFFSET_PATTERN := '^[a-zA-Z0-9_]* EQU' 84 $(OFFSETS_GEN) : PRIVATE_SOURCE_DIR := $(libvpx_source_dir) 85 $(OFFSETS_GEN) : PRIVATE_CUSTOM_TOOL = grep $(PRIVATE_OFFSET_PATTERN) $< | tr -d '$$\#' | perl $(PRIVATE_SOURCE_DIR)/build/make/ads2gas.pl > $@ 86 $(OFFSETS_GEN) : %.asm : %.intermediate 87 $(transform-generated-source) 88 89 LOCAL_GENERATED_SOURCES += $(OFFSETS_GEN) 90 91 # This step is only required for ARM. MIPS uses intrinsics and x86 requires an 92 # assembler to pre-process its assembly files. 93 libvpx_asm_srcs := $(filter %.asm.s, $(libvpx_codec_srcs_unique)) 94 95 # The ARM assembly sources must be converted from ADS to GAS compatible format. 96 VPX_GEN := $(addprefix $(libvpx_intermediates)/, $(libvpx_asm_srcs)) 97 $(VPX_GEN) : PRIVATE_SOURCE_DIR := $(libvpx_source_dir) 98 $(VPX_GEN) : PRIVATE_CUSTOM_TOOL = cat $< | perl $(PRIVATE_SOURCE_DIR)/build/make/ads2gas.pl > $@ 99 $(VPX_GEN) : $(libvpx_intermediates)/%.s : $(libvpx_source_dir)/% 100 $(transform-generated-source) 101 102 LOCAL_GENERATED_SOURCES += $(VPX_GEN) 103 104 LOCAL_C_INCLUDES := \ 105 $(libvpx_source_dir) \ 106 $(libvpx_config_dir) \ 107 $(libvpx_intermediates)/vp8/common \ 108 $(libvpx_intermediates)/vp8/decoder \ 109 $(libvpx_intermediates)/vp8/encoder \ 110 111 libvpx_target := 112 libvpx_asm := 113 libvpx_config_dir := 114 libvpx_source_dir := 115 libvpx_codec_srcs := 116 libvpx_intermediates := 117 libvpx_codec_srcs_unique := 118 libvpx_codec_srcs_c := 119 libvpx_codec_srcs_c_static := 120 libvpx_asm_offsets_intermediates := 121 libvpx_asm_offsets_files := 122 libvpx_asm_srcs := 123 124 include $(BUILD_STATIC_LIBRARY) 125