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
)$(CONFIG_MSVS
)),.asm.s
,.asm
)
21 # Calculate platform- and compiler-specific offsets for hand coded assembly
23 ifeq ($(filter icc gcc
,$(TGT_CC
)), $(TGT_CC
))
24 OFFSET_PATTERN
:='^[a-zA-Z0-9_]* EQU'
25 define asm_offsets_template
26 $$(BUILD_PFX
)$(1): $$(BUILD_PFX
)$(2).S
28 $$(qexec
)LC_ALL
=C grep
$$(OFFSET_PATTERN
) $$< | tr
-d
'$$$$\#' $$(ADS2GAS
) > $$@
29 $$(BUILD_PFX
)$(2).S
: $(2)
30 CLEAN-OBJS
+= $$(BUILD_PFX
)$(1) $(2).S
33 ifeq ($(filter rvct
,$(TGT_CC
)), $(TGT_CC
))
34 define asm_offsets_template
35 $$(BUILD_PFX
)$(1): obj_int_extract
36 $$(BUILD_PFX
)$(1): $$(BUILD_PFX
)$(2).o
38 $$(qexec
).
/obj_int_extract rvds
$$< $$(ADS2GAS
) > $$@
39 OBJS-yes
+= $$(BUILD_PFX
)$(2).o
40 CLEAN-OBJS
+= $$(BUILD_PFX
)$(1)
41 $$(filter %$$(ASM
).o
,$$(OBJS-yes
)): $$(BUILD_PFX
)$(1)
47 # Rule to generate runtime cpu detection files
49 define rtcd_h_template
50 $$(BUILD_PFX
)$(1).h
: $$(SRC_PATH_BARE
)/$(2)
52 $$(qexec
)$$(SRC_PATH_BARE
)/build
/make
/rtcd.sh
--arch
=$$(TGT_ISA
) \
54 --config
=$$(CONFIG_DIR
)$$(target
)$$(if
$$(FAT_ARCHS
),,-$$(TOOLCHAIN
)).mk \
55 $$(RTCD_OPTIONS
) $$^
> $$@
56 CLEAN-OBJS
+= $$(BUILD_PFX
)$(1).h
57 RTCD
+= $$(BUILD_PFX
)$(1).h
60 # x86inc.asm is not compatible with pic 32bit builds. Restrict
61 # files which use it to 64bit builds or 32bit without pic
63 ifeq ($(CONFIG_USE_X86INC
),yes
)
67 CODEC_SRCS-yes
+= CHANGELOG
68 CODEC_SRCS-yes
+= libs.mk
70 # If this is a universal (fat) binary, then all the subarchitectures have
71 # already been built and our job is to stitch them together. The
72 # BUILD_LIBVPX variable indicates whether we should be building
73 # (compiling, linking) the library. The LIPO_LIBVPX variable indicates
74 # that we're stitching.
75 $(eval
$(if
$(filter universal
%,$(TOOLCHAIN
)),LIPO_LIBVPX
,BUILD_LIBVPX
):=yes
)
77 include $(SRC_PATH_BARE
)/vpx
/vpx_codec.mk
78 CODEC_SRCS-yes
+= $(addprefix vpx
/,$(call enabled
,API_SRCS
))
79 CODEC_DOC_SRCS
+= $(addprefix vpx
/,$(call enabled
,API_DOC_SRCS
))
81 include $(SRC_PATH_BARE
)/vpx_mem
/vpx_mem.mk
82 CODEC_SRCS-yes
+= $(addprefix vpx_mem
/,$(call enabled
,MEM_SRCS
))
84 include $(SRC_PATH_BARE
)/vpx_scale
/vpx_scale.mk
85 CODEC_SRCS-yes
+= $(addprefix vpx_scale
/,$(call enabled
,SCALE_SRCS
))
87 include $(SRC_PATH_BARE
)/vpx_ports
/vpx_ports.mk
88 CODEC_SRCS-yes
+= $(addprefix vpx_ports
/,$(call enabled
,PORTS_SRCS
))
90 ifneq ($(CONFIG_VP8_ENCODER
)$(CONFIG_VP8_DECODER
),)
92 include $(SRC_PATH_BARE
)/$(VP8_PREFIX
)vp8_common.mk
95 ifeq ($(CONFIG_VP8_ENCODER
),yes
)
96 include $(SRC_PATH_BARE
)/$(VP8_PREFIX
)vp8cx.mk
97 CODEC_SRCS-yes
+= $(addprefix $(VP8_PREFIX
),$(call enabled
,VP8_CX_SRCS
))
98 CODEC_EXPORTS-yes
+= $(addprefix $(VP8_PREFIX
),$(VP8_CX_EXPORTS
))
99 INSTALL-LIBS-yes
+= include/vpx
/vp8.h
include/vpx
/vp8cx.h
100 INSTALL_MAPS
+= include/vpx
/% $(SRC_PATH_BARE
)/$(VP8_PREFIX
)/%
101 CODEC_DOC_SECTIONS
+= vp8 vp8_encoder
104 ifeq ($(CONFIG_VP8_DECODER
),yes
)
105 include $(SRC_PATH_BARE
)/$(VP8_PREFIX
)vp8dx.mk
106 CODEC_SRCS-yes
+= $(addprefix $(VP8_PREFIX
),$(call enabled
,VP8_DX_SRCS
))
107 CODEC_EXPORTS-yes
+= $(addprefix $(VP8_PREFIX
),$(VP8_DX_EXPORTS
))
108 INSTALL-LIBS-yes
+= include/vpx
/vp8.h
include/vpx
/vp8dx.h
109 INSTALL_MAPS
+= include/vpx
/% $(SRC_PATH_BARE
)/$(VP8_PREFIX
)/%
110 CODEC_DOC_SECTIONS
+= vp8 vp8_decoder
113 ifneq ($(CONFIG_VP9_ENCODER
)$(CONFIG_VP9_DECODER
),)
115 include $(SRC_PATH_BARE
)/$(VP9_PREFIX
)vp9_common.mk
118 ifeq ($(CONFIG_VP9_ENCODER
),yes
)
120 include $(SRC_PATH_BARE
)/$(VP9_PREFIX
)vp9cx.mk
121 CODEC_SRCS-yes
+= $(addprefix $(VP9_PREFIX
),$(call enabled
,VP9_CX_SRCS
))
122 CODEC_EXPORTS-yes
+= $(addprefix $(VP9_PREFIX
),$(VP9_CX_EXPORTS
))
123 CODEC_SRCS-yes
+= $(VP9_PREFIX
)vp9cx.mk vpx
/vp8.h vpx
/vp8cx.h
124 INSTALL-LIBS-yes
+= include/vpx
/vp8.h
include/vpx
/vp8cx.h
125 INSTALL_MAPS
+= include/vpx
/% $(SRC_PATH_BARE
)/$(VP9_PREFIX
)/%
126 CODEC_DOC_SRCS
+= vpx
/vp8.h vpx
/vp8cx.h
127 CODEC_DOC_SECTIONS
+= vp9 vp9_encoder
130 ifeq ($(CONFIG_VP9_DECODER
),yes
)
132 include $(SRC_PATH_BARE
)/$(VP9_PREFIX
)vp9dx.mk
133 CODEC_SRCS-yes
+= $(addprefix $(VP9_PREFIX
),$(call enabled
,VP9_DX_SRCS
))
134 CODEC_EXPORTS-yes
+= $(addprefix $(VP9_PREFIX
),$(VP9_DX_EXPORTS
))
135 CODEC_SRCS-yes
+= $(VP9_PREFIX
)vp9dx.mk vpx
/vp8.h vpx
/vp8dx.h
136 INSTALL-LIBS-yes
+= include/vpx
/vp8.h
include/vpx
/vp8dx.h
137 INSTALL_MAPS
+= include/vpx
/% $(SRC_PATH_BARE
)/$(VP9_PREFIX
)/%
138 CODEC_DOC_SRCS
+= vpx
/vp8.h vpx
/vp8dx.h
139 CODEC_DOC_SECTIONS
+= vp9 vp9_decoder
143 ifeq ($(CONFIG_ENCODERS
),yes
)
144 CODEC_DOC_SECTIONS
+= encoder
146 ifeq ($(CONFIG_DECODERS
),yes
)
147 CODEC_DOC_SECTIONS
+= decoder
151 ifeq ($(CONFIG_MSVS
),yes
)
152 CODEC_LIB
=$(if
$(CONFIG_STATIC_MSVCRT
),vpxmt
,vpxmd
)
153 GTEST_LIB
=$(if
$(CONFIG_STATIC_MSVCRT
),gtestmt
,gtestmd
)
154 # This variable uses deferred expansion intentionally, since the results of
155 # $(wildcard) may change during the course of the Make.
156 VS_PLATFORMS
= $(foreach d
,$(wildcard */Release
/$(CODEC_LIB
).lib
),$(word 1,$(subst /, ,$(d
))))
159 # The following pairs define a mapping of locations in the distribution
160 # tree to locations in the source/build trees.
161 INSTALL_MAPS
+= include/vpx
/% $(SRC_PATH_BARE
)/vpx
/%
162 INSTALL_MAPS
+= include/vpx
/% $(SRC_PATH_BARE
)/vpx_ports
/%
163 INSTALL_MAPS
+= $(LIBSUBDIR
)/% %
164 INSTALL_MAPS
+= src
/% $(SRC_PATH_BARE
)/%
165 ifeq ($(CONFIG_MSVS
),yes
)
166 INSTALL_MAPS
+= $(foreach p
,$(VS_PLATFORMS
),$(LIBSUBDIR
)/$(p
)/% $(p
)/Release
/%)
167 INSTALL_MAPS
+= $(foreach p
,$(VS_PLATFORMS
),$(LIBSUBDIR
)/$(p
)/% $(p
)/Debug
/%)
170 CODEC_SRCS-
$(BUILD_LIBVPX
) += build
/make
/version.sh
171 CODEC_SRCS-
$(BUILD_LIBVPX
) += build
/make
/rtcd.sh
172 CODEC_SRCS-
$(BUILD_LIBVPX
) += vpx_ports
/emmintrin_compat.h
173 CODEC_SRCS-
$(BUILD_LIBVPX
) += vpx_ports
/vpx_once.h
174 CODEC_SRCS-
$(BUILD_LIBVPX
) += $(BUILD_PFX
)vpx_config.c
175 INSTALL-SRCS-no
+= $(BUILD_PFX
)vpx_config.c
176 ifeq ($(ARCH_X86
)$(ARCH_X86_64
),yes
)
177 CODEC_SRCS-
$(BUILD_LIBVPX
) += third_party
/x86inc
/x86inc.asm
179 CODEC_EXPORTS-
$(BUILD_LIBVPX
) += vpx
/exports_com
180 CODEC_EXPORTS-
$(CONFIG_ENCODERS
) += vpx
/exports_enc
181 CODEC_EXPORTS-
$(CONFIG_DECODERS
) += vpx
/exports_dec
183 INSTALL-LIBS-yes
+= include/vpx
/vpx_codec.h
184 INSTALL-LIBS-yes
+= include/vpx
/vpx_image.h
185 INSTALL-LIBS-yes
+= include/vpx
/vpx_integer.h
186 INSTALL-LIBS-yes
+= include/vpx
/vpx_codec_impl_top.h
187 INSTALL-LIBS-yes
+= include/vpx
/vpx_codec_impl_bottom.h
188 INSTALL-LIBS-
$(CONFIG_DECODERS
) += include/vpx
/vpx_decoder.h
189 INSTALL-LIBS-
$(CONFIG_ENCODERS
) += include/vpx
/vpx_encoder.h
190 ifeq ($(CONFIG_EXTERNAL_BUILD
),yes
)
191 ifeq ($(CONFIG_MSVS
),yes
)
192 INSTALL-LIBS-yes
+= $(foreach p
,$(VS_PLATFORMS
),$(LIBSUBDIR
)/$(p
)/$(CODEC_LIB
).lib
)
193 INSTALL-LIBS-
$(CONFIG_DEBUG_LIBS
) += $(foreach p
,$(VS_PLATFORMS
),$(LIBSUBDIR
)/$(p
)/$(CODEC_LIB
)d.lib
)
194 INSTALL-LIBS-
$(CONFIG_SHARED
) += $(foreach p
,$(VS_PLATFORMS
),$(LIBSUBDIR
)/$(p
)/vpx.dll
)
195 INSTALL-LIBS-
$(CONFIG_SHARED
) += $(foreach p
,$(VS_PLATFORMS
),$(LIBSUBDIR
)/$(p
)/vpx.exp
)
198 INSTALL-LIBS-
$(CONFIG_STATIC
) += $(LIBSUBDIR
)/libvpx.a
199 INSTALL-LIBS-
$(CONFIG_DEBUG_LIBS
) += $(LIBSUBDIR
)/libvpx_g.a
202 CODEC_SRCS
=$(call enabled
,CODEC_SRCS
)
203 INSTALL-SRCS-
$(CONFIG_CODEC_SRCS
) += $(CODEC_SRCS
)
204 INSTALL-SRCS-
$(CONFIG_CODEC_SRCS
) += $(call enabled
,CODEC_EXPORTS
)
207 # Generate a list of all enabled sources, in particular for exporting to gyp
208 # based build systems.
211 @echo
$(CODEC_SRCS
) | xargs
-n1 echo |
sort -u
> $@
212 CLEAN-OBJS
+= libvpx_srcs.txt
215 ifeq ($(CONFIG_EXTERNAL_BUILD
),yes
)
216 ifeq ($(CONFIG_MSVS
),yes
)
218 obj_int_extract.
$(VCPROJ_SFX
): $(SRC_PATH_BARE
)/build
/make
/obj_int_extract.c
219 @cp
$(SRC_PATH_BARE
)/build
/$(MSVS_ARCH_DIR
)/obj_int_extract.bat .
221 $(qexec
)$(GEN_VCPROJ
) \
223 --target
=$(TOOLCHAIN
) \
224 --name
=obj_int_extract \
225 --ver
=$(CONFIG_VS_VERSION
) \
226 --proj-guid
=E1360C65-D375-4335-8057-7ED99CC3F9B2 \
227 $(if
$(CONFIG_STATIC_MSVCRT
),--static-crt
) \
230 -I
"$(SRC_PATH_BARE)" \
232 PROJECTS-
$(BUILD_LIBVPX
) += obj_int_extract.
$(VCPROJ_SFX
)
234 vpx.def
: $(call enabled
,CODEC_EXPORTS
)
236 $(qexec
)$(SRC_PATH_BARE
)/build
/make
/gen_msvs_def.sh\
239 CLEAN-OBJS
+= vpx.def
241 vpx.
$(VCPROJ_SFX
): $(CODEC_SRCS
) vpx.def obj_int_extract.
$(VCPROJ_SFX
)
243 $(qexec
)$(GEN_VCPROJ
) \
244 $(if
$(CONFIG_SHARED
),--dll
,--lib
) \
245 --target
=$(TOOLCHAIN
) \
246 $(if
$(CONFIG_STATIC_MSVCRT
),--static-crt
) \
248 --proj-guid
=DCE19DAF-69AC-46DB-B14A-39F0FAA5DB74 \
249 --module-def
=vpx.def \
250 --ver
=$(CONFIG_VS_VERSION
) \
251 --out
=$@
$(CFLAGS
) $^ \
252 --src-path-bare
="$(SRC_PATH_BARE)" \
254 PROJECTS-
$(BUILD_LIBVPX
) += vpx.
$(VCPROJ_SFX
)
256 vpx.
$(VCPROJ_SFX
): vpx_config.asm
257 vpx.
$(VCPROJ_SFX
): $(RTCD
)
261 LIBVPX_OBJS
=$(call objs
,$(CODEC_SRCS
))
262 OBJS-
$(BUILD_LIBVPX
) += $(LIBVPX_OBJS
)
263 LIBS-
$(if
$(BUILD_LIBVPX
),$(CONFIG_STATIC
)) += $(BUILD_PFX
)libvpx.a
$(BUILD_PFX
)libvpx_g.a
264 $(BUILD_PFX
)libvpx_g.a
: $(LIBVPX_OBJS
)
267 BUILD_LIBVPX_SO
:= $(if
$(BUILD_LIBVPX
),$(CONFIG_SHARED
))
269 ifeq ($(filter darwin
%,$(TGT_OS
)),$(TGT_OS
))
270 LIBVPX_SO
:= libvpx.
$(VERSION_MAJOR
).dylib
271 EXPORT_FILE
:= libvpx.syms
272 LIBVPX_SO_SYMLINKS
:= $(addprefix $(LIBSUBDIR
)/, \
275 LIBVPX_SO
:= libvpx.so.
$(VERSION_MAJOR
).
$(VERSION_MINOR
).
$(VERSION_PATCH
)
276 EXPORT_FILE
:= libvpx.ver
277 SYM_LINK
:= libvpx.so
278 LIBVPX_SO_SYMLINKS
:= $(addprefix $(LIBSUBDIR
)/, \
279 libvpx.so libvpx.so.
$(VERSION_MAJOR
) \
280 libvpx.so.
$(VERSION_MAJOR
).
$(VERSION_MINOR
))
283 LIBS-
$(BUILD_LIBVPX_SO
) += $(BUILD_PFX
)$(LIBVPX_SO
)\
284 $(notdir $(LIBVPX_SO_SYMLINKS
))
285 $(BUILD_PFX
)$(LIBVPX_SO
): $(LIBVPX_OBJS
) $(EXPORT_FILE
)
286 $(BUILD_PFX
)$(LIBVPX_SO
): extralibs
+= -lm
287 $(BUILD_PFX
)$(LIBVPX_SO
): SONAME
= libvpx.so.
$(VERSION_MAJOR
)
288 $(BUILD_PFX
)$(LIBVPX_SO
): EXPORTS_FILE
= $(EXPORT_FILE
)
290 libvpx.ver
: $(call enabled
,CODEC_EXPORTS
)
292 $(qexec
)echo
"{ global:" > $@
293 $(qexec
)for f in
$?
; do awk
'{print $$2";"}' < $$f >>$@
; done
294 $(qexec
)echo
"local: *; };" >> $@
295 CLEAN-OBJS
+= libvpx.ver
297 libvpx.syms
: $(call enabled
,CODEC_EXPORTS
)
299 $(qexec
)awk
'{print "_"$$2}' $^
>$@
300 CLEAN-OBJS
+= libvpx.syms
302 define libvpx_symlink_template
304 @echo
" [LN] $(2) $$@"
305 $(qexec
)mkdir
-p
$$(dir $$@
)
306 $(qexec
)ln
-sf
$(2) $$@
309 $(eval
$(call libvpx_symlink_template
,\
310 $(addprefix $(BUILD_PFX
),$(notdir $(LIBVPX_SO_SYMLINKS
))),\
311 $(BUILD_PFX
)$(LIBVPX_SO
)))
312 $(eval
$(call libvpx_symlink_template
,\
313 $(addprefix $(DIST_DIR
)/,$(LIBVPX_SO_SYMLINKS
)),\
317 INSTALL-LIBS-
$(BUILD_LIBVPX_SO
) += $(LIBVPX_SO_SYMLINKS
)
318 INSTALL-LIBS-
$(BUILD_LIBVPX_SO
) += $(LIBSUBDIR
)/$(LIBVPX_SO
)
321 LIBS-
$(BUILD_LIBVPX
) += vpx.
pc
322 vpx.
pc: config.mk libs.mk
324 $(qexec
)echo
'# pkg-config file from libvpx $(VERSION_STRING)' > $@
325 $(qexec
)echo
'prefix=$(PREFIX)' >> $@
326 $(qexec
)echo
'exec_prefix=$${prefix}' >> $@
327 $(qexec
)echo
'libdir=$${prefix}/$(LIBSUBDIR)' >> $@
328 $(qexec
)echo
'includedir=$${prefix}/include' >> $@
329 $(qexec
)echo
'' >> $@
330 $(qexec
)echo
'Name: vpx' >> $@
331 $(qexec
)echo
'Description: WebM Project VPx codec implementation' >> $@
332 $(qexec
)echo
'Version: $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)' >> $@
333 $(qexec
)echo
'Requires:' >> $@
334 $(qexec
)echo
'Conflicts:' >> $@
335 $(qexec
)echo
'Libs: -L$${libdir} -lvpx -lm' >> $@
336 ifeq ($(HAVE_PTHREAD_H
),yes
)
337 $(qexec
)echo
'Libs.private: -lm -lpthread' >> $@
339 $(qexec
)echo
'Libs.private: -lm' >> $@
341 $(qexec
)echo
'Cflags: -I$${includedir}' >> $@
342 INSTALL-LIBS-yes
+= $(LIBSUBDIR
)/pkgconfig
/vpx.
pc
343 INSTALL_MAPS
+= $(LIBSUBDIR
)/pkgconfig
/%.
pc %.
pc
347 LIBS-
$(LIPO_LIBVPX
) += libvpx.a
348 $(eval
$(if
$(LIPO_LIBVPX
),$(call lipo_lib_template
,libvpx.a
)))
351 # Rule to make assembler configuration file from C configuration file
353 ifeq ($(ARCH_X86
)$(ARCH_X86_64
),yes
)
355 $(BUILD_PFX
)vpx_config.asm
: $(BUILD_PFX
)vpx_config.h
357 @egrep
"#define [A-Z0-9_]+ [01]" $< \
358 | awk
'{print $$2 " equ " $$3}' > $@
360 ADS2GAS
=$(if
$(filter yes
,$(CONFIG_GCC
)),|
$(ASM_CONVERSION
))
361 $(BUILD_PFX
)vpx_config.asm
: $(BUILD_PFX
)vpx_config.h
363 @egrep
"#define [A-Z0-9_]+ [01]" $< \
364 | awk
'{print $$2 " EQU " $$3}' $(ADS2GAS
) > $@
365 @echo
" END" $(ADS2GAS
) >> $@
366 CLEAN-OBJS
+= $(BUILD_PFX
)vpx_config.asm
370 # Add assembler dependencies for configuration and offsets
372 $(filter %.s.o
,$(OBJS-yes
)): $(BUILD_PFX
)vpx_config.asm
373 $(filter %$(ASM
).o
,$(OBJS-yes
)): $(BUILD_PFX
)vpx_config.asm
376 $(shell $(SRC_PATH_BARE
)/build
/make
/version.sh
"$(SRC_PATH_BARE)" $(BUILD_PFX
)vpx_version.h
)
377 CLEAN-OBJS
+= $(BUILD_PFX
)vpx_version.h
381 ## libvpx test directives
383 ifeq ($(CONFIG_UNIT_TESTS
),yes
)
384 LIBVPX_TEST_DATA_PATH ?
= .
386 include $(SRC_PATH_BARE
)/test/test.mk
387 LIBVPX_TEST_SRCS
=$(addprefix test/,$(call enabled
,LIBVPX_TEST_SRCS
))
388 LIBVPX_TEST_BINS
=.
/test_libvpx
$(EXE_SFX
)
389 LIBVPX_TEST_DATA
=$(addprefix $(LIBVPX_TEST_DATA_PATH
)/,\
390 $(call enabled
,LIBVPX_TEST_DATA
))
391 libvpx_test_data_url
=http
://downloads.webmproject.org
/test_data
/libvpx
/$(1)
393 libvpx_test_srcs.txt
:
395 @echo
$(LIBVPX_TEST_SRCS
) | xargs
-n1 echo |
sort -u
> $@
396 CLEAN-OBJS
+= libvpx_test_srcs.txt
399 @echo
" [DOWNLOAD] $@"
400 $(qexec
)trap
'rm -f $@' INT TERM
&&\
401 curl
-L
-o
$@
$(call libvpx_test_data_url
,$(@F
))
403 testdata
:: $(LIBVPX_TEST_DATA
)
404 $(qexec
)if
[ -x
"$$(which sha1sum)" ]; then\
405 echo
"Checking test data:";\
406 if
[ -n
"$(LIBVPX_TEST_DATA)" ]; then\
407 for f in
$(call enabled
,LIBVPX_TEST_DATA
); do\
408 grep
$$f $(SRC_PATH_BARE
)/test/test-data.sha1 |\
409 (cd
$(LIBVPX_TEST_DATA_PATH
); sha1sum
-c
);\
413 echo
"Skipping test data integrity check, sha1sum not found.";\
416 ifeq ($(CONFIG_EXTERNAL_BUILD
),yes
)
417 ifeq ($(CONFIG_MSVS
),yes
)
419 gtest.
$(VCPROJ_SFX
): $(SRC_PATH_BARE
)/third_party
/googletest
/src
/src
/gtest-all.
cc
421 $(qexec
)$(GEN_VCPROJ
) \
423 --target
=$(TOOLCHAIN
) \
424 $(if
$(CONFIG_STATIC_MSVCRT
),--static-crt
) \
426 --proj-guid
=EC00E1EC-AF68-4D92-A255-181690D1C9B1 \
427 --ver
=$(CONFIG_VS_VERSION
) \
428 --src-path-bare
="$(SRC_PATH_BARE)" \
430 --out
=gtest.
$(VCPROJ_SFX
) $(SRC_PATH_BARE
)/third_party
/googletest
/src
/src
/gtest-all.
cc \
431 -I.
-I
"$(SRC_PATH_BARE)/third_party/googletest/src/include" -I
"$(SRC_PATH_BARE)/third_party/googletest/src"
433 PROJECTS-
$(CONFIG_MSVS
) += gtest.
$(VCPROJ_SFX
)
435 test_libvpx.
$(VCPROJ_SFX
): $(LIBVPX_TEST_SRCS
) vpx.
$(VCPROJ_SFX
) gtest.
$(VCPROJ_SFX
)
437 $(qexec
)$(GEN_VCPROJ
) \
439 --target
=$(TOOLCHAIN
) \
442 --proj-guid
=CD837F5F-52D8-4314-A370-895D614166A7 \
443 --ver
=$(CONFIG_VS_VERSION
) \
444 $(if
$(CONFIG_STATIC_MSVCRT
),--static-crt
) \
445 --out
=$@
$(INTERNAL_CFLAGS
) $(CFLAGS
) \
446 -I.
-I
"$(SRC_PATH_BARE)/third_party/googletest/src/include" \
447 -L.
-l
$(CODEC_LIB
) -l
$(GTEST_LIB
) $^
449 PROJECTS-
$(CONFIG_MSVS
) += test_libvpx.
$(VCPROJ_SFX
)
451 LIBVPX_TEST_BINS
:= $(addprefix $(TGT_OS
:win64
=x64
)/Release
/,$(notdir $(LIBVPX_TEST_BINS
)))
455 include $(SRC_PATH_BARE
)/third_party
/googletest
/gtest.mk
456 GTEST_SRCS
:= $(addprefix third_party
/googletest
/src
/,$(call enabled
,GTEST_SRCS
))
457 GTEST_OBJS
=$(call objs
,$(GTEST_SRCS
))
458 ifeq ($(filter win
%,$(TGT_OS
)),$(TGT_OS
))
459 # Disabling pthreads globally will cause issues on darwin and possibly elsewhere
460 $(GTEST_OBJS
) $(GTEST_OBJS
:.o
=.d
): CXXFLAGS
+= -DGTEST_HAS_PTHREAD
=0
462 $(GTEST_OBJS
) $(GTEST_OBJS
:.o
=.d
): CXXFLAGS
+= -I
$(SRC_PATH_BARE
)/third_party
/googletest
/src
463 $(GTEST_OBJS
) $(GTEST_OBJS
:.o
=.d
): CXXFLAGS
+= -I
$(SRC_PATH_BARE
)/third_party
/googletest
/src
/include
464 OBJS-
$(BUILD_LIBVPX
) += $(GTEST_OBJS
)
465 LIBS-
$(BUILD_LIBVPX
) += $(BUILD_PFX
)libgtest.a
$(BUILD_PFX
)libgtest_g.a
466 $(BUILD_PFX
)libgtest_g.a
: $(GTEST_OBJS
)
468 LIBVPX_TEST_OBJS
=$(sort $(call objs
,$(LIBVPX_TEST_SRCS
)))
469 $(LIBVPX_TEST_OBJS
) $(LIBVPX_TEST_OBJS
:.o
=.d
): CXXFLAGS
+= -I
$(SRC_PATH_BARE
)/third_party
/googletest
/src
470 $(LIBVPX_TEST_OBJS
) $(LIBVPX_TEST_OBJS
:.o
=.d
): CXXFLAGS
+= -I
$(SRC_PATH_BARE
)/third_party
/googletest
/src
/include
471 OBJS-
$(BUILD_LIBVPX
) += $(LIBVPX_TEST_OBJS
)
472 BINS-
$(BUILD_LIBVPX
) += $(LIBVPX_TEST_BINS
)
474 # Install test sources only if codec source is included
475 INSTALL-SRCS-
$(CONFIG_CODEC_SRCS
) += $(patsubst $(SRC_PATH_BARE
)/%,%,\
476 $(shell find
$(SRC_PATH_BARE
)/third_party
/googletest
-type f
))
477 INSTALL-SRCS-
$(CONFIG_CODEC_SRCS
) += $(LIBVPX_TEST_SRCS
)
479 CODEC_LIB
=$(if
$(CONFIG_DEBUG_LIBS
),vpx_g
,vpx
)
480 CODEC_LIB_SUF
=$(if
$(CONFIG_SHARED
),.so
,.a
)
481 $(foreach bin
,$(LIBVPX_TEST_BINS
),\
482 $(if
$(BUILD_LIBVPX
),$(eval
$(bin
): \
483 lib
$(CODEC_LIB
)$(CODEC_LIB_SUF
) libgtest.a
))\
484 $(if
$(BUILD_LIBVPX
),$(eval
$(call linkerxx_template
,$(bin
),\
485 $(LIBVPX_TEST_OBJS
) \
486 -L.
-lvpx
-lgtest
$(extralibs
) -lm
)\
488 $(if
$(LIPO_LIBS
),$(eval
$(call lipo_bin_template
,$(bin
))))\
492 define test_shard_template
493 test:: test_shard.
$(1)
494 test_shard.
$(1): $(LIBVPX_TEST_BINS
) testdata
496 for t in
$(LIBVPX_TEST_BINS
); do \
497 export GTEST_SHARD_INDEX
=$(1); \
498 export GTEST_TOTAL_SHARDS
=$(2); \
501 .PHONY
: test_shard.
$(1)
505 SHARDS
:= 0 1 2 3 4 5 6 7 8 9
506 $(foreach s
,$(SHARDS
),$(eval
$(call test_shard_template
,$(s
),$(NUM_SHARDS
))))
511 ## documentation directives
513 CLEAN-OBJS
+= libs.doxy
514 DOCS-yes
+= libs.doxy
515 libs.doxy
: $(CODEC_DOC_SRCS
)
518 @echo
"INPUT += $^" >> $@
519 @echo
"PREDEFINED = VPX_CODEC_DISABLE_COMPAT" >> $@
520 @echo
"INCLUDE_PATH += ." >> $@
;
521 @echo
"ENABLED_SECTIONS += $(sort $(CODEC_DOC_SECTIONS))" >> $@
523 ## Generate rtcd.h for all objects
524 $(OBJS-yes
:.o
=.d
): $(RTCD
)
526 ## Update the global src list
527 SRCS
+= $(CODEC_SRCS
) $(LIBVPX_TEST_SRCS
) $(GTEST_SRCS
)