Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 #Setup the libvpx assembler config.
6 AS=$(VPX_AS)
7 ASFLAGS=$(VPX_ASFLAGS) -I. -I$(topsrcdir)/media/libvpx/ -I$(topsrcdir)/media/libvpx/vpx_ports/
8 AS_DASH_C_FLAG=$(VPX_DASH_C_FLAG)
9 ASM_SUFFIX=$(VPX_ASM_SUFFIX)
11 ifdef VPX_ARM_ASM
12 # Building on an ARM platform with a supported assembler, include
13 # the optimized assembly in the build.
15 ifeq ($(OS_TARGET),Android)
16 # For cpu-features.h
17 LOCAL_INCLUDES += -I$(ANDROID_NDK)/sources/android/cpufeatures
18 endif
20 ASM_OFFSETS = vpx_scale_asm_offsets.asm vp8_asm_enc_offsets.asm
23 ifdef VPX_AS_CONVERSION
24 # The ARM asm is written in ARM RVCT syntax, but we actually build it with
25 # gas using GNU syntax. Add some rules to perform the conversion.
27 GENERATED_DIRS += $(dir $(ASFILES))
29 %.asm.$(ASM_SUFFIX): %.asm $(ASM_OFFSETS)
30 $(VPX_AS_CONVERSION) < $< > $@
32 endif
33 endif
35 ifdef VPX_NEED_OBJ_INT_EXTRACT
37 # We don't have a compiler that supports a compatible inline asm syntax, so we
38 # have to resort to extracting asm offsets from a compiled object. This only
39 # works if we have the appropriate system headers obj_int_extract needs to
40 # parse that format, and so only has limited support for cross-compilation.
42 ifdef VPX_ARM_ASM
43 VPX_OIE_FORMAT := rvds
44 else
45 VPX_OIE_FORMAT := gas
46 endif
48 GARBAGE += vpx_scale_asm_offsets.$(OBJ_SUFFIX) vpx_scale_asm_offsets.asm
49 GARBAGE += vp8_asm_enc_offsets.$(OBJ_SUFFIX) vp8_asm_enc_offsets.asm
51 else
53 # We can extract the asm offsets directly from generated assembly using inline
54 # asm. This is the preferred method. However we need to strip out CFLAGS that
55 # cause LTO because then the resulting .S file is useless.
57 vpx_scale_asm_offsets.s: CFLAGS := -DINLINE_ASM
59 OFFSET_PATTERN := '^[a-zA-Z0-9_]* EQU'
61 # This rule, as well as the rule for vp8_asm_enc_offsets.s further below are here
62 # because the generic rule in rules.mk was made to not be implicit, and we
63 # can't put the C files in CSRCS.
64 vpx_scale_asm_offsets.s: $(srcdir)/vpx_scale/vpx_scale_asm_offsets.c
65 $(REPORT_BUILD)
66 $(CC) -S $(COMPILE_CFLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
68 vpx_scale_asm_offsets.asm: vpx_scale_asm_offsets.s
69 grep $(OFFSET_PATTERN) $< | sed -e 's/[$$\#]//g' \
70 $(if $(VPX_AS_CONVERSION),| $(VPX_AS_CONVERSION)) > $@
72 GARBAGE += vpx_scale_asm_offsets.s vpx_scale_asm_offsets.asm
74 vp8_asm_enc_offsets.s: CFLAGS := -DINLINE_ASM
76 vp8_asm_enc_offsets.s: $(srcdir)/vp8/encoder/vp8_asm_enc_offsets.c
77 $(REPORT_BUILD)
78 $(CC) -S $(COMPILE_CFLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
80 vp8_asm_enc_offsets.asm: vp8_asm_enc_offsets.s
81 grep $(OFFSET_PATTERN) $< | sed -e 's/[$$\#]//g' \
82 $(if $(VPX_AS_CONVERSION),| $(VPX_AS_CONVERSION)) > $@
84 GARBAGE += vp8_asm_enc_offsets.s vp8_asm_enc_offsets.asm
86 endif
88 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
90 include $(topsrcdir)/config/rules.mk
92 quantize_sse4.$(OBJ_SUFFIX): vp8_asm_enc_offsets.asm
93 quantize_ssse3.$(OBJ_SUFFIX): vp8_asm_enc_offsets.asm
95 ifdef VPX_NEED_OBJ_INT_EXTRACT
97 vpx_scale_asm_offsets.asm: vpx_scale_asm_offsets.$(OBJ_SUFFIX) $(HOST_PROGRAM)
98 ./$(HOST_PROGRAM) $(VPX_OIE_FORMAT) $< \
99 $(if $(VPX_AS_CONVERSION),| $(VPX_AS_CONVERSION)) > $@
101 # Filter out this object, because we don't want to link against it.
102 # It was generated solely so it could be parsed by obj_int_extract.
103 OBJS := $(filter-out vpx_scale_asm_offsets.$(OBJ_SUFFIX),$(OBJS))
105 vp8_asm_enc_offsets.asm: vp8_asm_enc_offsets.$(OBJ_SUFFIX) $(HOST_PROGRAM)
106 ./$(HOST_PROGRAM) $(VPX_OIE_FORMAT) $< \
107 $(if $(VPX_AS_CONVERSION),| $(VPX_AS_CONVERSION)) > $@
109 # Filter out this object, because we don't want to link against it.
110 # It was generated solely so it could be parsed by obj_int_extract.
111 OBJS := $(filter-out vp8_asm_enc_offsets.$(OBJ_SUFFIX),$(OBJS))
113 endif
115 # Workaround a bug of Sun Studio (CR 6963410)
116 ifdef SOLARIS_SUNPRO_CC
117 ifeq (86,$(findstring 86,$(OS_TEST)))
118 filter.o: filter.c Makefile.in
119 $(REPORT_BUILD)
120 @$(MAKE_DEPS_AUTO_CC)
121 $(CC) -o $@ -c $(patsubst -xO[45],-xO3,$(COMPILE_CFLAGS)) $<
122 endif
123 endif