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/encoder/vp8_asm_enc_offsets.intermediate \ 64 vpx_scale/vpx_scale_asm_offsets.intermediate \ 65 66 libvpx_asm_offsets_files := \ 67 vp8/encoder/vp8_asm_enc_offsets.asm \ 68 vpx_scale/vpx_scale_asm_offsets.asm \ 69 70 # Build the S files with inline assembly. 71 COMPILE_TO_S := $(addprefix $(libvpx_intermediates)/, $(libvpx_asm_offsets_intermediates)) 72 $(COMPILE_TO_S) : PRIVATE_INTERMEDIATES := $(libvpx_intermediates) 73 $(COMPILE_TO_S) : PRIVATE_SOURCE_DIR := $(libvpx_source_dir) 74 $(COMPILE_TO_S) : PRIVATE_CONFIG_DIR := $(libvpx_config_dir) 75 $(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 $@ $< 76 $(COMPILE_TO_S) : $(libvpx_intermediates)/%.intermediate : $(libvpx_source_dir)/%.c 77 $(transform-generated-source) 78 79 # Extract the offsets from the inline assembly. 80 OFFSETS_GEN := $(addprefix $(libvpx_intermediates)/, $(libvpx_asm_offsets_files)) 81 $(OFFSETS_GEN) : PRIVATE_OFFSET_PATTERN := '^[a-zA-Z0-9_]* EQU' 82 $(OFFSETS_GEN) : PRIVATE_SOURCE_DIR := $(libvpx_source_dir) 83 $(OFFSETS_GEN) : PRIVATE_CUSTOM_TOOL = grep $(PRIVATE_OFFSET_PATTERN) $< | tr -d '$$\#' | perl $(PRIVATE_SOURCE_DIR)/build/make/ads2gas.pl > $@ 84 $(OFFSETS_GEN) : %.asm : %.intermediate 85 $(transform-generated-source) 86 87 LOCAL_GENERATED_SOURCES += $(OFFSETS_GEN) 88 89 # This step is only required for ARM. MIPS uses intrinsics and x86 requires an 90 # assembler to pre-process its assembly files. 91 libvpx_asm_srcs := $(filter %.asm.s, $(libvpx_codec_srcs_unique)) 92 93 # The ARM assembly sources must be converted from ADS to GAS compatible format. 94 VPX_GEN := $(addprefix $(libvpx_intermediates)/, $(libvpx_asm_srcs)) 95 $(VPX_GEN) : PRIVATE_SOURCE_DIR := $(libvpx_source_dir) 96 $(VPX_GEN) : PRIVATE_CUSTOM_TOOL = cat $< | perl $(PRIVATE_SOURCE_DIR)/build/make/ads2gas.pl > $@ 97 $(VPX_GEN) : $(libvpx_intermediates)/%.s : $(libvpx_source_dir)/% 98 $(transform-generated-source) 99 100 LOCAL_GENERATED_SOURCES += $(VPX_GEN) 101 102 LOCAL_C_INCLUDES := \ 103 $(libvpx_source_dir) \ 104 $(libvpx_config_dir) \ 105 $(libvpx_intermediates)/vp8/common \ 106 $(libvpx_intermediates)/vp8/decoder \ 107 $(libvpx_intermediates)/vp8/encoder \ 108 $(libvpx_intermediates)/vpx_scale \ 109 110 libvpx_target := 111 libvpx_asm := 112 libvpx_config_dir := 113 libvpx_source_dir := 114 libvpx_codec_srcs := 115 libvpx_intermediates := 116 libvpx_codec_srcs_unique := 117 libvpx_codec_srcs_c := 118 libvpx_codec_srcs_c_static := 119 libvpx_asm_offsets_intermediates := 120 libvpx_asm_offsets_files := 121 libvpx_asm_srcs := 122 123 include $(BUILD_STATIC_LIBRARY) 124