diff options
-rw-r--r-- | config.arm.mk | 22 | ||||
-rw-r--r-- | config.arm64.mk | 16 | ||||
-rw-r--r-- | config.mips.mk | 24 | ||||
-rw-r--r-- | config.mips64.mk | 16 | ||||
-rw-r--r-- | config.x86.mk | 16 | ||||
-rw-r--r-- | config.x86_64.mk | 16 | ||||
-rw-r--r-- | libvpx-offsets.mk | 26 | ||||
-rw-r--r-- | libvpx.mk | 66 |
8 files changed, 145 insertions, 57 deletions
diff --git a/config.arm.mk b/config.arm.mk new file mode 100644 index 0000000..3f0f0b7 --- /dev/null +++ b/config.arm.mk @@ -0,0 +1,22 @@ +# Output variables: +# libvpx_config_dir_arm +# libvpx_codec_srcs_c_arm +# libvpx_codec_srcs_asm_arm + +ifeq ($(ARCH_ARM_HAVE_NEON),true) +libvpx_target := armv7a-neon +else ifeq ($(ARCH_ARM_HAVE_ARMV7A),true) +libvpx_target := armv7a +else +libvpx_target := generic +endif + +libvpx_config_dir_arm := $(LOCAL_PATH)/$(libvpx_target) +libvpx_codec_srcs := $(sort $(shell cat $(libvpx_config_dir_arm)/libvpx_srcs.txt)) + +# vpx_config.c is an auto-generated file in $(libvpx_target). +libvpx_codec_srcs_c_arm := $(addprefix libvpx/, $(filter-out vpx_config.c, \ + $(filter %.c, $(libvpx_codec_srcs)))) \ + $(libvpx_target)/vpx_config.c + +libvpx_codec_srcs_asm_arm := $(filter %.asm.s, $(libvpx_codec_srcs)) diff --git a/config.arm64.mk b/config.arm64.mk new file mode 100644 index 0000000..eb7e167 --- /dev/null +++ b/config.arm64.mk @@ -0,0 +1,16 @@ +# Output variables: +# libvpx_config_dir_arm64 +# libvpx_codec_srcs_c_arm64 +# libvpx_codec_srcs_asm_arm64 + +libvpx_target := generic + +libvpx_config_dir_arm64 := $(LOCAL_PATH)/$(libvpx_target) +libvpx_codec_srcs := $(sort $(shell cat $(libvpx_config_dir_arm64)/libvpx_srcs.txt)) + +# vpx_config.c is an auto-generated file in $(libvpx_target). +libvpx_codec_srcs_c_arm64 := $(addprefix libvpx/, $(filter-out vpx_config.c, \ + $(filter %.c, $(libvpx_codec_srcs)))) \ + $(libvpx_target)/vpx_config.c + +libvpx_codec_srcs_asm_arm64 := $(filter %.asm.s, $(libvpx_codec_srcs)) diff --git a/config.mips.mk b/config.mips.mk new file mode 100644 index 0000000..842c0ab --- /dev/null +++ b/config.mips.mk @@ -0,0 +1,24 @@ +# Output variables: +# libvpx_config_dir_mips +# libvpx_codec_srcs_c_mips +# libvpx_codec_srcs_asm_mips + +ifneq ($(ARCH_HAS_BIGENDIAN),true) + ifeq ($(ARCH_MIPS_DSP_REV),2) + libvpx_target := mips-dspr2 + else + libvpx_target := mips + endif +else + libvpx_target := generic +endif + +libvpx_config_dir_mips := $(LOCAL_PATH)/$(libvpx_target) +libvpx_codec_srcs := $(sort $(shell cat $(libvpx_config_dir_mips)/libvpx_srcs.txt)) + +# vpx_config.c is an auto-generated file in $(libvpx_target). +libvpx_codec_srcs_c_mips := $(addprefix libvpx/, $(filter-out vpx_config.c, \ + $(filter %.c, $(libvpx_codec_srcs)))) \ + $(libvpx_target)/vpx_config.c + +libvpx_codec_srcs_asm_mips := $(filter %.asm.s, $(libvpx_codec_srcs)) diff --git a/config.mips64.mk b/config.mips64.mk new file mode 100644 index 0000000..fa1f1d2 --- /dev/null +++ b/config.mips64.mk @@ -0,0 +1,16 @@ +# Output variables: +# libvpx_config_dir_mips64 +# libvpx_codec_srcs_c_mips64 +# libvpx_codec_srcs_asm_mips64 + +libvpx_target := generic + +libvpx_config_dir_mips64 := $(LOCAL_PATH)/$(libvpx_target) +libvpx_codec_srcs := $(sort $(shell cat $(libvpx_config_dir_mips64)/libvpx_srcs.txt)) + +# vpx_config.c is an auto-generated file in $(libvpx_target). +libvpx_codec_srcs_c_mips64 := $(addprefix libvpx/, $(filter-out vpx_config.c, \ + $(filter %.c, $(libvpx_codec_srcs)))) \ + $(libvpx_target)/vpx_config.c + +libvpx_codec_srcs_asm_mips64 := $(filter %.asm.s, $(libvpx_codec_srcs)) diff --git a/config.x86.mk b/config.x86.mk new file mode 100644 index 0000000..055a793 --- /dev/null +++ b/config.x86.mk @@ -0,0 +1,16 @@ +# Output variables: +# libvpx_config_dir_x86 +# libvpx_codec_srcs_c_x86 +# libvpx_codec_srcs_asm_x86 + +libvpx_target := generic + +libvpx_config_dir_x86 := $(LOCAL_PATH)/$(libvpx_target) +libvpx_codec_srcs := $(sort $(shell cat $(libvpx_config_dir_x86)/libvpx_srcs.txt)) + +# vpx_config.c is an auto-generated file in $(libvpx_target). +libvpx_codec_srcs_c_x86 := $(addprefix libvpx/, $(filter-out vpx_config.c, \ + $(filter %.c, $(libvpx_codec_srcs)))) \ + $(libvpx_target)/vpx_config.c + +libvpx_codec_srcs_asm_x86 := $(filter %.asm.s, $(libvpx_codec_srcs)) diff --git a/config.x86_64.mk b/config.x86_64.mk new file mode 100644 index 0000000..ed003d6 --- /dev/null +++ b/config.x86_64.mk @@ -0,0 +1,16 @@ +# Output variables: +# libvpx_config_dir_x86_64 +# libvpx_codec_srcs_c_x86_64 +# libvpx_codec_srcs_asm_x86_64 + +libvpx_target := generic + +libvpx_config_dir_x86_64 := $(LOCAL_PATH)/$(libvpx_target) +libvpx_codec_srcs := $(sort $(shell cat $(libvpx_config_dir_x86_64)/libvpx_srcs.txt)) + +# vpx_config.c is an auto-generated file in $(libvpx_target). +libvpx_codec_srcs_c_x86_64 := $(addprefix libvpx/, $(filter-out vpx_config.c, \ + $(filter %.c, $(libvpx_codec_srcs)))) \ + $(libvpx_target)/vpx_config.c + +libvpx_codec_srcs_asm_x86_64 := $(filter %.asm.s, $(libvpx_codec_srcs)) diff --git a/libvpx-offsets.mk b/libvpx-offsets.mk index 3336b1f..826520c 100644 --- a/libvpx-offsets.mk +++ b/libvpx-offsets.mk @@ -1,3 +1,15 @@ +# Rules to generate assembly. +# Input variables: +# libvpx_2nd_arch +# libvpx_source_dir +# libvpx_config_dir_<arch> +# libvpx_codec_srcs_asm_<arch> +# +# Output variables: +# LOCAL_GENERATED_SOURCES_<arch> +# LOCAL_C_INCLUDES_<arch> +# + # ARM and x86 use an 'offsets' file in the assembly. It is generated by # tricking the compiler and generating non-functional output which is then # processed with grep. For ARM, this must be additionally converted from @@ -22,7 +34,7 @@ COMPILE_TO_S := $(addprefix $(libvpx_intermediates)/, $(libvpx_asm_offsets_inter $(COMPILE_TO_S) : PRIVATE_2ND_ARCH := $(libvpx_2nd_arch) $(COMPILE_TO_S) : PRIVATE_INTERMEDIATES := $(libvpx_intermediates) $(COMPILE_TO_S) : PRIVATE_SOURCE_DIR := $(libvpx_source_dir) -$(COMPILE_TO_S) : PRIVATE_CONFIG_DIR := $(libvpx_config_dir) +$(COMPILE_TO_S) : PRIVATE_CONFIG_DIR := $(libvpx_config_dir_$(TARGET_$(libvpx_2nd_arch)ARCH)) $(COMPILE_TO_S) : PRIVATE_CUSTOM_TOOL = $($(PRIVATE_2ND_ARCH)TARGET_CC) -S $(addprefix -I, $($(PRIVATE_2ND_ARCH)TARGET_C_INCLUDES)) -I $(PRIVATE_INTERMEDIATES) -I $(PRIVATE_SOURCE_DIR) -I $(PRIVATE_CONFIG_DIR) -DINLINE_ASM -o $@ $< $(COMPILE_TO_S) : $(libvpx_intermediates)/%.intermediate : $(libvpx_source_dir)/%.c $(transform-generated-source) @@ -37,15 +49,21 @@ $(OFFSETS_GEN) : %.asm : %.intermediate LOCAL_GENERATED_SOURCES_$(TARGET_$(libvpx_2nd_arch)ARCH) += $(OFFSETS_GEN) +ifneq ($(strip $(libvpx_codec_srcs_asm_$(TARGET_$(libvpx_2nd_arch)ARCH))),) # This step is only required for ARM. MIPS uses intrinsics and x86 requires an # assembler to pre-process its assembly files. -libvpx_asm_srcs := $(filter %.asm.s, $(libvpx_codec_srcs_unique)) - # The ARM assembly sources must be converted from ADS to GAS compatible format. -VPX_GEN := $(addprefix $(libvpx_intermediates)/, $(libvpx_asm_srcs)) +VPX_GEN := $(addprefix $(libvpx_intermediates)/, $(libvpx_codec_srcs_asm_$(TARGET_$(libvpx_2nd_arch)ARCH))) $(VPX_GEN) : PRIVATE_SOURCE_DIR := $(libvpx_source_dir) $(VPX_GEN) : PRIVATE_CUSTOM_TOOL = cat $< | perl $(PRIVATE_SOURCE_DIR)/build/make/ads2gas.pl > $@ $(VPX_GEN) : $(libvpx_intermediates)/%.s : $(libvpx_source_dir)/% $(transform-generated-source) LOCAL_GENERATED_SOURCES_$(TARGET_$(libvpx_2nd_arch)ARCH) += $(VPX_GEN) +endif + +LOCAL_C_INCLUDES_$(TARGET_$(libvpx_2nd_arch)ARCH) += \ + $(libvpx_intermediates)/vp8/common \ + $(libvpx_intermediates)/vp8/decoder \ + $(libvpx_intermediates)/vp8/encoder \ + $(libvpx_intermediates)/vpx_scale @@ -1,76 +1,36 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) -ifeq ($(ARCH_ARM_HAVE_NEON),true) - libvpx_target := armv7a-neon - libvpx_asm := .asm.s -else ifeq ($(ARCH_ARM_HAVE_ARMV7A),true) - libvpx_target := armv7a - libvpx_asm := .asm.s -endif - -ifeq ($(TARGET_ARCH),mips) - ifneq ($(ARCH_HAS_BIGENDIAN),true) - ifeq ($(ARCH_MIPS_DSP_REV),2) - libvpx_target := mips-dspr2 - else - libvpx_target := mips - endif #mips_dsp_rev2 - endif #bigendian -endif #mips - -# Un-optimized targets -libvpx_target ?= generic -libvpx_asm ?= .asm - -libvpx_config_dir := $(LOCAL_PATH)/$(libvpx_target) libvpx_source_dir := $(LOCAL_PATH)/libvpx -libvpx_codec_srcs := $(shell cat $(libvpx_config_dir)/libvpx_srcs.txt) - -LOCAL_CFLAGS := -DHAVE_CONFIG_H=vpx_config.h - +## Arch-common settings LOCAL_MODULE := libvpx - LOCAL_MODULE_CLASS := STATIC_LIBRARIES -# Extract the C files from the list and add them to LOCAL_SRC_FILES. -libvpx_codec_srcs_unique := $(sort $(libvpx_codec_srcs)) -libvpx_codec_srcs_c := $(filter %.c, $(libvpx_codec_srcs_unique)) -# vpx_config.c is an auto-generated file in $(config_dir) -libvpx_codec_srcs_c_static := $(filter-out vpx_config.c, $(libvpx_codec_srcs_c)) -LOCAL_SRC_FILES += $(addprefix libvpx/, $(libvpx_codec_srcs_c_static)) -LOCAL_SRC_FILES += $(libvpx_target)/vpx_config.c +LOCAL_CFLAGS := -DHAVE_CONFIG_H=vpx_config.h + +LOCAL_C_INCLUDES := $(libvpx_source_dir) +# Load the arch-specific settings +include $(LOCAL_PATH)/config.$(TARGET_ARCH).mk +LOCAL_SRC_FILES_$(TARGET_ARCH) := $(libvpx_codec_srcs_c_$(TARGET_ARCH)) +LOCAL_C_INCLUDES_$(TARGET_ARCH) := $(libvpx_config_dir_$(TARGET_ARCH)) libvpx_2nd_arch := include $(LOCAL_PATH)/libvpx-offsets.mk + ifdef TARGET_2ND_ARCH +include $(LOCAL_PATH)/config.$(TARGET_2ND_ARCH).mk +LOCAL_SRC_FILES_$(TARGET_2ND_ARCH) := $(libvpx_codec_srcs_c_$(TARGET_2ND_ARCH)) +LOCAL_C_INCLUDES_$(TARGET_2ND_ARCH) := $(libvpx_config_dir_$(TARGET_2ND_ARCH)) libvpx_2nd_arch := $(TARGET_2ND_ARCH_VAR_PREFIX) include $(LOCAL_PATH)/libvpx-offsets.mk -endif libvpx_2nd_arch := - -LOCAL_C_INCLUDES := \ - $(libvpx_source_dir) \ - $(libvpx_config_dir) \ - $(libvpx_intermediates)/vp8/common \ - $(libvpx_intermediates)/vp8/decoder \ - $(libvpx_intermediates)/vp8/encoder \ - $(libvpx_intermediates)/vpx_scale \ +endif libvpx_target := -libvpx_asm := -libvpx_config_dir := libvpx_source_dir := -libvpx_codec_srcs := libvpx_intermediates := -libvpx_codec_srcs_unique := -libvpx_codec_srcs_c := -libvpx_codec_srcs_c_static := libvpx_asm_offsets_intermediates := libvpx_asm_offsets_files := -libvpx_asm_srcs := - -LOCAL_32_BIT_ONLY := true include $(BUILD_STATIC_LIBRARY) |