|
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/. |
|
4 |
|
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) |
|
10 |
|
11 ifdef VPX_ARM_ASM |
|
12 # Building on an ARM platform with a supported assembler, include |
|
13 # the optimized assembly in the build. |
|
14 |
|
15 ifeq ($(OS_TARGET),Android) |
|
16 # For cpu-features.h |
|
17 LOCAL_INCLUDES += -I$(ANDROID_NDK)/sources/android/cpufeatures |
|
18 endif |
|
19 |
|
20 ASM_OFFSETS = vpx_scale_asm_offsets.asm vp8_asm_enc_offsets.asm |
|
21 |
|
22 |
|
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. |
|
26 |
|
27 GENERATED_DIRS += $(dir $(ASFILES)) |
|
28 |
|
29 %.asm.$(ASM_SUFFIX): %.asm $(ASM_OFFSETS) |
|
30 $(VPX_AS_CONVERSION) < $< > $@ |
|
31 |
|
32 endif |
|
33 endif |
|
34 |
|
35 ifdef VPX_NEED_OBJ_INT_EXTRACT |
|
36 |
|
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. |
|
41 |
|
42 ifdef VPX_ARM_ASM |
|
43 VPX_OIE_FORMAT := rvds |
|
44 else |
|
45 VPX_OIE_FORMAT := gas |
|
46 endif |
|
47 |
|
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 |
|
50 |
|
51 else |
|
52 |
|
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. |
|
56 |
|
57 vpx_scale_asm_offsets.s: CFLAGS := -DINLINE_ASM |
|
58 |
|
59 OFFSET_PATTERN := '^[a-zA-Z0-9_]* EQU' |
|
60 |
|
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) |
|
67 |
|
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)) > $@ |
|
71 |
|
72 GARBAGE += vpx_scale_asm_offsets.s vpx_scale_asm_offsets.asm |
|
73 |
|
74 vp8_asm_enc_offsets.s: CFLAGS := -DINLINE_ASM |
|
75 |
|
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) |
|
79 |
|
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)) > $@ |
|
83 |
|
84 GARBAGE += vp8_asm_enc_offsets.s vp8_asm_enc_offsets.asm |
|
85 |
|
86 endif |
|
87 |
|
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 |
|
89 |
|
90 include $(topsrcdir)/config/rules.mk |
|
91 |
|
92 quantize_sse4.$(OBJ_SUFFIX): vp8_asm_enc_offsets.asm |
|
93 quantize_ssse3.$(OBJ_SUFFIX): vp8_asm_enc_offsets.asm |
|
94 |
|
95 ifdef VPX_NEED_OBJ_INT_EXTRACT |
|
96 |
|
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)) > $@ |
|
100 |
|
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)) |
|
104 |
|
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)) > $@ |
|
108 |
|
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)) |
|
112 |
|
113 endif |
|
114 |
|
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 |