michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: #Setup the libvpx assembler config. michael@0: AS=$(VPX_AS) michael@0: ASFLAGS=$(VPX_ASFLAGS) -I. -I$(topsrcdir)/media/libvpx/ -I$(topsrcdir)/media/libvpx/vpx_ports/ michael@0: AS_DASH_C_FLAG=$(VPX_DASH_C_FLAG) michael@0: ASM_SUFFIX=$(VPX_ASM_SUFFIX) michael@0: michael@0: ifdef VPX_ARM_ASM michael@0: # Building on an ARM platform with a supported assembler, include michael@0: # the optimized assembly in the build. michael@0: michael@0: ifeq ($(OS_TARGET),Android) michael@0: # For cpu-features.h michael@0: LOCAL_INCLUDES += -I$(ANDROID_NDK)/sources/android/cpufeatures michael@0: endif michael@0: michael@0: ASM_OFFSETS = vpx_scale_asm_offsets.asm vp8_asm_enc_offsets.asm michael@0: michael@0: michael@0: ifdef VPX_AS_CONVERSION michael@0: # The ARM asm is written in ARM RVCT syntax, but we actually build it with michael@0: # gas using GNU syntax. Add some rules to perform the conversion. michael@0: michael@0: GENERATED_DIRS += $(dir $(ASFILES)) michael@0: michael@0: %.asm.$(ASM_SUFFIX): %.asm $(ASM_OFFSETS) michael@0: $(VPX_AS_CONVERSION) < $< > $@ michael@0: michael@0: endif michael@0: endif michael@0: michael@0: ifdef VPX_NEED_OBJ_INT_EXTRACT michael@0: michael@0: # We don't have a compiler that supports a compatible inline asm syntax, so we michael@0: # have to resort to extracting asm offsets from a compiled object. This only michael@0: # works if we have the appropriate system headers obj_int_extract needs to michael@0: # parse that format, and so only has limited support for cross-compilation. michael@0: michael@0: ifdef VPX_ARM_ASM michael@0: VPX_OIE_FORMAT := rvds michael@0: else michael@0: VPX_OIE_FORMAT := gas michael@0: endif michael@0: michael@0: GARBAGE += vpx_scale_asm_offsets.$(OBJ_SUFFIX) vpx_scale_asm_offsets.asm michael@0: GARBAGE += vp8_asm_enc_offsets.$(OBJ_SUFFIX) vp8_asm_enc_offsets.asm michael@0: michael@0: else michael@0: michael@0: # We can extract the asm offsets directly from generated assembly using inline michael@0: # asm. This is the preferred method. However we need to strip out CFLAGS that michael@0: # cause LTO because then the resulting .S file is useless. michael@0: michael@0: vpx_scale_asm_offsets.s: CFLAGS := -DINLINE_ASM michael@0: michael@0: OFFSET_PATTERN := '^[a-zA-Z0-9_]* EQU' michael@0: michael@0: # This rule, as well as the rule for vp8_asm_enc_offsets.s further below are here michael@0: # because the generic rule in rules.mk was made to not be implicit, and we michael@0: # can't put the C files in CSRCS. michael@0: vpx_scale_asm_offsets.s: $(srcdir)/vpx_scale/vpx_scale_asm_offsets.c michael@0: $(REPORT_BUILD) michael@0: $(CC) -S $(COMPILE_CFLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS) michael@0: michael@0: vpx_scale_asm_offsets.asm: vpx_scale_asm_offsets.s michael@0: grep $(OFFSET_PATTERN) $< | sed -e 's/[$$\#]//g' \ michael@0: $(if $(VPX_AS_CONVERSION),| $(VPX_AS_CONVERSION)) > $@ michael@0: michael@0: GARBAGE += vpx_scale_asm_offsets.s vpx_scale_asm_offsets.asm michael@0: michael@0: vp8_asm_enc_offsets.s: CFLAGS := -DINLINE_ASM michael@0: michael@0: vp8_asm_enc_offsets.s: $(srcdir)/vp8/encoder/vp8_asm_enc_offsets.c michael@0: $(REPORT_BUILD) michael@0: $(CC) -S $(COMPILE_CFLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS) michael@0: michael@0: vp8_asm_enc_offsets.asm: vp8_asm_enc_offsets.s michael@0: grep $(OFFSET_PATTERN) $< | sed -e 's/[$$\#]//g' \ michael@0: $(if $(VPX_AS_CONVERSION),| $(VPX_AS_CONVERSION)) > $@ michael@0: michael@0: GARBAGE += vp8_asm_enc_offsets.s vp8_asm_enc_offsets.asm michael@0: michael@0: endif michael@0: michael@0: EXTRA_MDDEPEND_FILES = vp8_asm_enc_offsets.s.pp vp8_asm_enc_offsets.$(OBJ_SUFFIX).pp vpx_scale_asm_offsets.s.pp vpx_scale_asm_offsets.$(OBJ_SUFFIX).pp michael@0: michael@0: include $(topsrcdir)/config/rules.mk michael@0: michael@0: quantize_sse4.$(OBJ_SUFFIX): vp8_asm_enc_offsets.asm michael@0: quantize_ssse3.$(OBJ_SUFFIX): vp8_asm_enc_offsets.asm michael@0: michael@0: ifdef VPX_NEED_OBJ_INT_EXTRACT michael@0: michael@0: vpx_scale_asm_offsets.asm: vpx_scale_asm_offsets.$(OBJ_SUFFIX) $(HOST_PROGRAM) michael@0: ./$(HOST_PROGRAM) $(VPX_OIE_FORMAT) $< \ michael@0: $(if $(VPX_AS_CONVERSION),| $(VPX_AS_CONVERSION)) > $@ michael@0: michael@0: # Filter out this object, because we don't want to link against it. michael@0: # It was generated solely so it could be parsed by obj_int_extract. michael@0: OBJS := $(filter-out vpx_scale_asm_offsets.$(OBJ_SUFFIX),$(OBJS)) michael@0: michael@0: vp8_asm_enc_offsets.asm: vp8_asm_enc_offsets.$(OBJ_SUFFIX) $(HOST_PROGRAM) michael@0: ./$(HOST_PROGRAM) $(VPX_OIE_FORMAT) $< \ michael@0: $(if $(VPX_AS_CONVERSION),| $(VPX_AS_CONVERSION)) > $@ michael@0: michael@0: # Filter out this object, because we don't want to link against it. michael@0: # It was generated solely so it could be parsed by obj_int_extract. michael@0: OBJS := $(filter-out vp8_asm_enc_offsets.$(OBJ_SUFFIX),$(OBJS)) michael@0: michael@0: endif michael@0: michael@0: # Workaround a bug of Sun Studio (CR 6963410) michael@0: ifdef SOLARIS_SUNPRO_CC michael@0: ifeq (86,$(findstring 86,$(OS_TEST))) michael@0: filter.o: filter.c Makefile.in michael@0: $(REPORT_BUILD) michael@0: @$(MAKE_DEPS_AUTO_CC) michael@0: $(CC) -o $@ -c $(patsubst -xO[45],-xO3,$(COMPILE_CFLAGS)) $< michael@0: endif michael@0: endif