2 ## Copyright (c) 2010 The WebM project authors. All Rights Reserved.
4 ## Use of this source code is governed by a BSD-style license
5 ## that can be found in the LICENSE file in the root of the source
6 ## tree. An additional intellectual property rights grant can be found
7 ## in the file PATENTS. All contributing project authors may
8 ## be found in the AUTHORS file in the root of the source tree.
12 # ARM assembly files are written in RVCT-style. We use some make magic to
13 # filter those files to allow GCC compilation
14 ifeq ($(ARCH_ARM
),yes
)
15 ASM
:=$(if
$(filter yes
,$(CONFIG_GCC
)),.asm.s
,.asm
)
20 CODEC_SRCS-yes
+= libs.mk
22 include $(SRC_PATH_BARE
)/vpx
/vpx_codec.mk
23 CODEC_SRCS-yes
+= $(addprefix vpx
/,$(call enabled
,API_SRCS
))
25 include $(SRC_PATH_BARE
)/vpx_mem
/vpx_mem.mk
26 CODEC_SRCS-yes
+= $(addprefix vpx_mem
/,$(call enabled
,MEM_SRCS
))
28 include $(SRC_PATH_BARE
)/vpx_scale
/vpx_scale.mk
29 CODEC_SRCS-yes
+= $(addprefix vpx_scale
/,$(call enabled
,SCALE_SRCS
))
32 ifeq ($(CONFIG_VP8_ENCODER
),yes
)
34 include $(SRC_PATH_BARE
)/$(VP8_PREFIX
)vp8cx.mk
35 CODEC_SRCS-yes
+= $(addprefix $(VP8_PREFIX
),$(call enabled
,VP8_CX_SRCS
))
36 CODEC_EXPORTS-yes
+= $(addprefix $(VP8_PREFIX
),$(VP8_CX_EXPORTS
))
37 CODEC_SRCS-yes
+= $(VP8_PREFIX
)vp8cx.mk vpx
/vp8.h vpx
/vp8cx.h vpx
/vp8e.h
38 INSTALL-LIBS-yes
+= include/vpx
/vp8.h
include/vpx
/vp8e.h
include/vpx
/vp8cx.h
39 INSTALL_MAPS
+= include/vpx
/% $(SRC_PATH_BARE
)/$(VP8_PREFIX
)/%
40 CODEC_DOC_SRCS
+= vpx
/vp8.h vpx
/vp8cx.h
41 CODEC_DOC_SECTIONS
+= vp8 vp8_encoder
44 ifeq ($(CONFIG_VP8_DECODER
),yes
)
46 include $(SRC_PATH_BARE
)/$(VP8_PREFIX
)vp8dx.mk
47 CODEC_SRCS-yes
+= $(addprefix $(VP8_PREFIX
),$(call enabled
,VP8_DX_SRCS
))
48 CODEC_EXPORTS-yes
+= $(addprefix $(VP8_PREFIX
),$(VP8_DX_EXPORTS
))
49 CODEC_SRCS-yes
+= $(VP8_PREFIX
)vp8dx.mk vpx
/vp8.h vpx
/vp8dx.h
50 INSTALL-LIBS-yes
+= include/vpx
/vp8.h
include/vpx
/vp8dx.h
51 INSTALL_MAPS
+= include/vpx
/% $(SRC_PATH_BARE
)/$(VP8_PREFIX
)/%
52 CODEC_DOC_SRCS
+= vpx
/vp8.h vpx
/vp8dx.h
53 CODEC_DOC_SECTIONS
+= vp8 vp8_decoder
57 ifeq ($(CONFIG_ENCODERS
),yes
)
58 CODEC_DOC_SECTIONS
+= encoder
60 ifeq ($(CONFIG_DECODERS
),yes
)
61 CODEC_DOC_SECTIONS
+= decoder
65 ifeq ($(CONFIG_MSVS
),yes
)
66 CODEC_LIB
=$(if
$(CONFIG_STATIC_MSVCRT
),vpxmt
,vpxmd
)
67 # This variable uses deferred expansion intentionally, since the results of
68 # $(wildcard) may change during the course of the Make.
69 VS_PLATFORMS
= $(foreach d
,$(wildcard */Release
/$(CODEC_LIB
).lib
),$(word 1,$(subst /, ,$(d
))))
72 # The following pairs define a mapping of locations in the distribution
73 # tree to locations in the source/build trees.
74 INSTALL_MAPS
+= include/vpx
/% $(SRC_PATH_BARE
)/vpx
/%
75 INSTALL_MAPS
+= include/vpx
/% $(SRC_PATH_BARE
)/vpx_ports
/%
76 INSTALL_MAPS
+= $(LIBSUBDIR
)/% %
77 INSTALL_MAPS
+= src
/% $(SRC_PATH_BARE
)/%
78 ifeq ($(CONFIG_MSVS
),yes
)
79 INSTALL_MAPS
+= $(foreach p
,$(VS_PLATFORMS
),$(LIBSUBDIR
)/$(p
)/% $(p
)/Release
/%)
80 INSTALL_MAPS
+= $(foreach p
,$(VS_PLATFORMS
),$(LIBSUBDIR
)/$(p
)/% $(p
)/Debug
/%)
83 # If this is a universal (fat) binary, then all the subarchitectures have
84 # already been built and our job is to stitch them together. The
85 # BUILD_LIBVPX variable indicates whether we should be building
86 # (compiling, linking) the library. The LIPO_LIBVPX variable indicates
87 # that we're stitching.
88 $(eval
$(if
$(filter universal
%,$(TOOLCHAIN
)),LIPO_LIBVPX
,BUILD_LIBVPX
):=yes
)
90 CODEC_SRCS-
$(BUILD_LIBVPX
) += build
/make
/version.sh
91 CODEC_SRCS-
$(BUILD_LIBVPX
) += vpx
/vpx_integer.h
92 CODEC_SRCS-
$(BUILD_LIBVPX
) += vpx_ports
/vpx_timer.h
93 CODEC_SRCS-
$(BUILD_LIBVPX
) += vpx_ports
/mem.h
94 CODEC_SRCS-
$(BUILD_LIBVPX
) += $(BUILD_PFX
)vpx_config.c
95 INSTALL-SRCS-no
+= $(BUILD_PFX
)vpx_config.c
96 ifeq ($(ARCH_X86
)$(ARCH_X86_64
),yes
)
97 CODEC_SRCS-
$(BUILD_LIBVPX
) += vpx_ports
/emms.asm
98 CODEC_SRCS-
$(BUILD_LIBVPX
) += vpx_ports
/x86.h
99 CODEC_SRCS-
$(BUILD_LIBVPX
) += vpx_ports
/x86_abi_support.asm
100 CODEC_SRCS-
$(BUILD_LIBVPX
) += vpx_ports
/x86_cpuid.c
102 CODEC_SRCS-
$(ARCH_ARM
) += vpx_ports
/arm_cpudetect.c
103 CODEC_SRCS-
$(ARCH_ARM
) += $(BUILD_PFX
)vpx_config.asm
104 CODEC_EXPORTS-
$(BUILD_LIBVPX
) += vpx
/exports_com
105 CODEC_EXPORTS-
$(CONFIG_ENCODERS
) += vpx
/exports_enc
106 CODEC_EXPORTS-
$(CONFIG_DECODERS
) += vpx
/exports_dec
108 INSTALL-LIBS-yes
+= include/vpx
/vpx_codec.h
109 INSTALL-LIBS-yes
+= include/vpx
/vpx_image.h
110 INSTALL-LIBS-yes
+= include/vpx
/vpx_integer.h
111 INSTALL-LIBS-yes
+= include/vpx
/vpx_codec_impl_top.h
112 INSTALL-LIBS-yes
+= include/vpx
/vpx_codec_impl_bottom.h
113 INSTALL-LIBS-
$(CONFIG_DECODERS
) += include/vpx
/vpx_decoder.h
114 INSTALL-LIBS-
$(CONFIG_DECODERS
) += include/vpx
/vpx_decoder_compat.h
115 INSTALL-LIBS-
$(CONFIG_ENCODERS
) += include/vpx
/vpx_encoder.h
116 ifeq ($(CONFIG_EXTERNAL_BUILD
),yes
)
117 ifeq ($(CONFIG_MSVS
),yes
)
118 INSTALL-LIBS-yes
+= $(foreach p
,$(VS_PLATFORMS
),$(LIBSUBDIR
)/$(p
)/$(CODEC_LIB
).lib
)
119 INSTALL-LIBS-
$(CONFIG_DEBUG_LIBS
) += $(foreach p
,$(VS_PLATFORMS
),$(LIBSUBDIR
)/$(p
)/$(CODEC_LIB
)d.lib
)
120 INSTALL-LIBS-
$(CONFIG_SHARED
) += $(foreach p
,$(VS_PLATFORMS
),$(LIBSUBDIR
)/$(p
)/vpx.dll
)
121 INSTALL-LIBS-
$(CONFIG_SHARED
) += $(foreach p
,$(VS_PLATFORMS
),$(LIBSUBDIR
)/$(p
)/vpx.exp
)
124 INSTALL-LIBS-yes
+= $(LIBSUBDIR
)/libvpx.a
125 INSTALL-LIBS-
$(CONFIG_DEBUG_LIBS
) += $(LIBSUBDIR
)/libvpx_g.a
128 CODEC_SRCS
=$(call enabled
,CODEC_SRCS
)
129 INSTALL-SRCS-
$(CONFIG_CODEC_SRCS
) += $(CODEC_SRCS
)
130 INSTALL-SRCS-
$(CONFIG_CODEC_SRCS
) += $(call enabled
,CODEC_EXPORTS
)
132 ifeq ($(CONFIG_EXTERNAL_BUILD
),yes
)
133 ifeq ($(CONFIG_MSVS
),yes
)
135 obj_int_extract.vcproj
: $(SRC_PATH_BARE
)/build
/make
/obj_int_extract.c
136 @cp
$(SRC_PATH_BARE
)/build
/x86-msvs
/obj_int_extract.bat .
138 $(SRC_PATH_BARE
)/build
/make
/gen_msvs_proj.sh \
140 --target
=$(TOOLCHAIN
) \
141 --name
=obj_int_extract \
142 --ver
=$(CONFIG_VS_VERSION
) \
143 --proj-guid
=E1360C65-D375-4335-8057-7ED99CC3F9B2 \
144 $(if
$(CONFIG_STATIC_MSVCRT
),--static-crt
) \
147 -I
"$(SRC_PATH_BARE)" \
149 PROJECTS-
$(BUILD_LIBVPX
) += obj_int_extract.vcproj
150 PROJECTS-
$(BUILD_LIBVPX
) += obj_int_extract.bat
152 vpx.def
: $(call enabled
,CODEC_EXPORTS
)
154 $(SRC_PATH_BARE
)/build
/make
/gen_msvs_def.sh\
157 CLEAN-OBJS
+= vpx.def
159 vpx.vcproj
: $(CODEC_SRCS
) vpx.def
161 $(SRC_PATH_BARE
)/build
/make
/gen_msvs_proj.sh \
163 --target
=$(TOOLCHAIN
) \
164 $(if
$(CONFIG_STATIC_MSVCRT
),--static-crt
) \
166 --proj-guid
=DCE19DAF-69AC-46DB-B14A-39F0FAA5DB74 \
167 --module-def
=vpx.def \
168 --ver
=$(CONFIG_VS_VERSION
) \
169 --out
=$@
$(CFLAGS
) $^ \
170 --src-path-bare
="$(SRC_PATH_BARE)" \
172 PROJECTS-
$(BUILD_LIBVPX
) += vpx.vcproj
174 vpx.vcproj
: vpx_config.asm
178 LIBVPX_OBJS
=$(call objs
,$(CODEC_SRCS
))
179 OBJS-
$(BUILD_LIBVPX
) += $(LIBVPX_OBJS
)
180 LIBS-
$(BUILD_LIBVPX
) += $(BUILD_PFX
)libvpx.a
$(BUILD_PFX
)libvpx_g.a
181 $(BUILD_PFX
)libvpx_g.a
: $(LIBVPX_OBJS
)
183 BUILD_LIBVPX_SO
:= $(if
$(BUILD_LIBVPX
),$(CONFIG_SHARED
))
184 LIBVPX_SO
:= libvpx.so.
$(VERSION_MAJOR
).
$(VERSION_MINOR
).
$(VERSION_PATCH
)
185 LIBS-
$(BUILD_LIBVPX_SO
) += $(BUILD_PFX
)$(LIBVPX_SO
)
186 $(BUILD_PFX
)$(LIBVPX_SO
): $(LIBVPX_OBJS
) libvpx.ver
187 $(BUILD_PFX
)$(LIBVPX_SO
): extralibs
+= -lm
-pthread
188 $(BUILD_PFX
)$(LIBVPX_SO
): SONAME
= libvpx.so.
$(VERSION_MAJOR
)
189 $(BUILD_PFX
)$(LIBVPX_SO
): SO_VERSION_SCRIPT
= libvpx.ver
190 LIBVPX_SO_SYMLINKS
:= $(addprefix $(LIBSUBDIR
)/, \
191 libvpx.so libvpx.so.
$(VERSION_MAJOR
) \
192 libvpx.so.
$(VERSION_MAJOR
).
$(VERSION_MINOR
))
194 libvpx.ver
: $(call enabled
,CODEC_EXPORTS
)
196 $(qexec
)echo
"{ global:" > $@
197 $(qexec
)for f in
$?
; do awk
'{print $$2";"}' < $$f >>$@
; done
198 $(qexec
)echo
"local: *; };" >> $@
199 CLEAN-OBJS
+= libvpx.ver
201 $(addprefix $(DIST_DIR
)/,$(LIBVPX_SO_SYMLINKS
)):
203 $(qexec
)ln
-sf
$(LIBVPX_SO
) $@
205 INSTALL-LIBS-
$(CONFIG_SHARED
) += $(LIBVPX_SO_SYMLINKS
)
206 INSTALL-LIBS-
$(CONFIG_SHARED
) += $(LIBSUBDIR
)/$(LIBVPX_SO
)
209 LIBS-
$(LIPO_LIBVPX
) += libvpx.a
210 $(eval
$(if
$(LIPO_LIBVPX
),$(call lipo_lib_template
,libvpx.a
)))
213 # Rule to make assembler configuration file from C configuration file
215 ifeq ($(ARCH_X86
)$(ARCH_X86_64
),yes
)
217 $(BUILD_PFX
)vpx_config.asm
: $(BUILD_PFX
)vpx_config.h
219 @egrep
"#define [A-Z0-9_]+ [01]" $< \
220 | awk
'{print $$2 " equ " $$3}' > $@
222 ADS2GAS
=$(if
$(filter yes
,$(CONFIG_GCC
)),|
$(ASM_CONVERSION
))
223 $(BUILD_PFX
)vpx_config.asm
: $(BUILD_PFX
)vpx_config.h
225 @egrep
"#define [A-Z0-9_]+ [01]" $< \
226 | awk
'{print $$2 " EQU " $$3}' $(ADS2GAS
) > $@
227 @echo
" END" $(ADS2GAS
) >> $@
228 CLEAN-OBJS
+= $(BUILD_PFX
)vpx_config.asm
232 # Add assembler dependencies for configuration and offsets
234 $(filter %.s.o
,$(OBJS-yes
)): $(BUILD_PFX
)vpx_config.asm
235 $(filter %$(ASM
).o
,$(OBJS-yes
)): $(BUILD_PFX
)vpx_config.asm
238 # Calculate platform- and compiler-specific offsets for hand coded assembly
240 ifeq ($(CONFIG_EXTERNAL_BUILD
),) # Visual Studio uses obj_int_extract.bat
241 ifeq ($(ARCH_ARM
), yes
)
242 asm_com_offsets.asm
: obj_int_extract
243 asm_com_offsets.asm
: $(VP8_PREFIX
)common
/asm_com_offsets.c.o
244 .
/obj_int_extract rvds
$< $(ADS2GAS
) > $@
245 OBJS-yes
+= $(VP8_PREFIX
)common
/asm_com_offsets.c.o
246 CLEAN-OBJS
+= asm_com_offsets.asm
247 $(filter %$(ASM
).o
,$(OBJS-yes
)): $(BUILD_PFX
)asm_com_offsets.asm
249 ifeq ($(CONFIG_VP8_ENCODER
), yes
)
250 asm_enc_offsets.asm
: obj_int_extract
251 asm_enc_offsets.asm
: $(VP8_PREFIX
)encoder
/asm_enc_offsets.c.o
252 .
/obj_int_extract rvds
$< $(ADS2GAS
) > $@
253 OBJS-yes
+= $(VP8_PREFIX
)encoder
/asm_enc_offsets.c.o
254 CLEAN-OBJS
+= asm_enc_offsets.asm
255 $(filter %$(ASM
).o
,$(OBJS-yes
)): $(BUILD_PFX
)asm_enc_offsets.asm
258 ifeq ($(CONFIG_VP8_DECODER
), yes
)
259 asm_dec_offsets.asm
: obj_int_extract
260 asm_dec_offsets.asm
: $(VP8_PREFIX
)decoder
/asm_dec_offsets.c.o
261 .
/obj_int_extract rvds
$< $(ADS2GAS
) > $@
262 OBJS-yes
+= $(VP8_PREFIX
)decoder
/asm_dec_offsets.c.o
263 CLEAN-OBJS
+= asm_dec_offsets.asm
264 $(filter %$(ASM
).o
,$(OBJS-yes
)): $(BUILD_PFX
)asm_dec_offsets.asm
269 $(shell $(SRC_PATH_BARE
)/build
/make
/version.sh
"$(SRC_PATH_BARE)" $(BUILD_PFX
)vpx_version.h
)
270 CLEAN-OBJS
+= $(BUILD_PFX
)vpx_version.h
272 CODEC_DOC_SRCS
+= vpx
/vpx_codec.h \
277 CLEAN-OBJS
+= libs.doxy
278 DOCS-yes
+= libs.doxy
279 libs.doxy
: $(CODEC_DOC_SRCS
)
282 @echo
"INPUT += $^" >> $@
283 @echo
"PREDEFINED = VPX_CODEC_DISABLE_COMPAT" >> $@
284 @echo
"INCLUDE_PATH += ." >> $@
;
285 @echo
"ENABLED_SECTIONS += $(sort $(CODEC_DOC_SECTIONS))" >> $@