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 += CHANGELOG
21 CODEC_SRCS-yes += libs.mk
23 include $(SRC_PATH_BARE)/vpx/vpx_codec.mk
24 CODEC_SRCS-yes += $(addprefix vpx/,$(call enabled,API_SRCS))
26 include $(SRC_PATH_BARE)/vpx_mem/vpx_mem.mk
27 CODEC_SRCS-yes += $(addprefix vpx_mem/,$(call enabled,MEM_SRCS))
29 include $(SRC_PATH_BARE)/vpx_scale/vpx_scale.mk
30 CODEC_SRCS-yes += $(addprefix vpx_scale/,$(call enabled,SCALE_SRCS))
33 ifeq ($(CONFIG_VP8_ENCODER),yes)
35 include $(SRC_PATH_BARE)/$(VP8_PREFIX)vp8cx.mk
36 CODEC_SRCS-yes += $(addprefix $(VP8_PREFIX),$(call enabled,VP8_CX_SRCS))
37 CODEC_EXPORTS-yes += $(addprefix $(VP8_PREFIX),$(VP8_CX_EXPORTS))
38 CODEC_SRCS-yes += $(VP8_PREFIX)vp8cx.mk vpx/vp8.h vpx/vp8cx.h
39 CODEC_SRCS-$(ARCH_ARM) += $(VP8_PREFIX)vp8cx_arm.mk
40 INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8cx.h
41 INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP8_PREFIX)/%
42 CODEC_DOC_SRCS += vpx/vp8.h vpx/vp8cx.h
43 CODEC_DOC_SECTIONS += vp8 vp8_encoder
46 ifeq ($(CONFIG_VP8_DECODER),yes)
48 include $(SRC_PATH_BARE)/$(VP8_PREFIX)vp8dx.mk
49 CODEC_SRCS-yes += $(addprefix $(VP8_PREFIX),$(call enabled,VP8_DX_SRCS))
50 CODEC_EXPORTS-yes += $(addprefix $(VP8_PREFIX),$(VP8_DX_EXPORTS))
51 CODEC_SRCS-yes += $(VP8_PREFIX)vp8dx.mk vpx/vp8.h vpx/vp8dx.h
52 INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8dx.h
53 INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP8_PREFIX)/%
54 CODEC_DOC_SRCS += vpx/vp8.h vpx/vp8dx.h
55 CODEC_DOC_SECTIONS += vp8 vp8_decoder
59 ifeq ($(CONFIG_ENCODERS),yes)
60 CODEC_DOC_SECTIONS += encoder
62 ifeq ($(CONFIG_DECODERS),yes)
63 CODEC_DOC_SECTIONS += decoder
67 ifeq ($(CONFIG_MSVS),yes)
68 CODEC_LIB=$(if $(CONFIG_STATIC_MSVCRT),vpxmt,vpxmd)
69 GTEST_LIB=$(if $(CONFIG_STATIC_MSVCRT),gtestmt,gtestmd)
70 # This variable uses deferred expansion intentionally, since the results of
71 # $(wildcard) may change during the course of the Make.
72 VS_PLATFORMS = $(foreach d,$(wildcard */Release/$(CODEC_LIB).lib),$(word 1,$(subst /, ,$(d))))
75 # The following pairs define a mapping of locations in the distribution
76 # tree to locations in the source/build trees.
77 INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/vpx/%
78 INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/vpx_ports/%
79 INSTALL_MAPS += $(LIBSUBDIR)/% %
80 INSTALL_MAPS += src/% $(SRC_PATH_BARE)/%
81 ifeq ($(CONFIG_MSVS),yes)
82 INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/% $(p)/Release/%)
83 INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/% $(p)/Debug/%)
86 # If this is a universal (fat) binary, then all the subarchitectures have
87 # already been built and our job is to stitch them together. The
88 # BUILD_LIBVPX variable indicates whether we should be building
89 # (compiling, linking) the library. The LIPO_LIBVPX variable indicates
90 # that we're stitching.
91 $(eval $(if $(filter universal%,$(TOOLCHAIN)),LIPO_LIBVPX,BUILD_LIBVPX):=yes)
93 CODEC_SRCS-$(BUILD_LIBVPX) += build/make/version.sh
94 CODEC_SRCS-$(BUILD_LIBVPX) += build/make/rtcd.sh
95 CODEC_SRCS-$(BUILD_LIBVPX) += vpx/vpx_integer.h
96 CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/asm_offsets.h
97 CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/vpx_timer.h
98 CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/mem.h
99 CODEC_SRCS-$(BUILD_LIBVPX) += $(BUILD_PFX)vpx_config.c
100 INSTALL-SRCS-no += $(BUILD_PFX)vpx_config.c
101 ifeq ($(ARCH_X86)$(ARCH_X86_64),yes)
102 CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/emms.asm
103 CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/x86.h
104 CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/x86_abi_support.asm
105 CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/x86_cpuid.c
107 CODEC_SRCS-$(ARCH_ARM) += vpx_ports/arm_cpudetect.c
108 CODEC_SRCS-$(ARCH_ARM) += vpx_ports/arm.h
109 CODEC_EXPORTS-$(BUILD_LIBVPX) += vpx/exports_com
110 CODEC_EXPORTS-$(CONFIG_ENCODERS) += vpx/exports_enc
111 CODEC_EXPORTS-$(CONFIG_DECODERS) += vpx/exports_dec
113 INSTALL-LIBS-yes += include/vpx/vpx_codec.h
114 INSTALL-LIBS-yes += include/vpx/vpx_image.h
115 INSTALL-LIBS-yes += include/vpx/vpx_integer.h
116 INSTALL-LIBS-yes += include/vpx/vpx_codec_impl_top.h
117 INSTALL-LIBS-yes += include/vpx/vpx_codec_impl_bottom.h
118 INSTALL-LIBS-$(CONFIG_DECODERS) += include/vpx/vpx_decoder.h
119 INSTALL-LIBS-$(CONFIG_ENCODERS) += include/vpx/vpx_encoder.h
120 ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
121 ifeq ($(CONFIG_MSVS),yes)
122 INSTALL-LIBS-yes += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/$(CODEC_LIB).lib)
123 INSTALL-LIBS-$(CONFIG_DEBUG_LIBS) += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/$(CODEC_LIB)d.lib)
124 INSTALL-LIBS-$(CONFIG_SHARED) += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/vpx.dll)
125 INSTALL-LIBS-$(CONFIG_SHARED) += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/vpx.exp)
128 INSTALL-LIBS-$(CONFIG_STATIC) += $(LIBSUBDIR)/libvpx.a
129 INSTALL-LIBS-$(CONFIG_DEBUG_LIBS) += $(LIBSUBDIR)/libvpx_g.a
132 CODEC_SRCS=$(filter-out %_test.cc,$(call enabled,CODEC_SRCS))
133 INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(CODEC_SRCS)
134 INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(call enabled,CODEC_EXPORTS)
137 # Generate a list of all enabled sources, in particular for exporting to gyp
138 # based build systems.
141 @echo $(CODEC_SRCS) | xargs -n1 echo | sort -u > $@
144 ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
145 ifeq ($(CONFIG_MSVS),yes)
147 obj_int_extract.vcproj: $(SRC_PATH_BARE)/build/make/obj_int_extract.c
148 @cp $(SRC_PATH_BARE)/build/x86-msvs/obj_int_extract.bat .
150 $(qexec)$(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh \
152 --target=$(TOOLCHAIN) \
153 --name=obj_int_extract \
154 --ver=$(CONFIG_VS_VERSION) \
155 --proj-guid=E1360C65-D375-4335-8057-7ED99CC3F9B2 \
156 $(if $(CONFIG_STATIC_MSVCRT),--static-crt) \
159 -I"$(SRC_PATH_BARE)" \
161 PROJECTS-$(BUILD_LIBVPX) += obj_int_extract.vcproj
162 PROJECTS-$(BUILD_LIBVPX) += obj_int_extract.bat
164 vpx.def: $(call enabled,CODEC_EXPORTS)
166 $(qexec)$(SRC_PATH_BARE)/build/make/gen_msvs_def.sh\
169 CLEAN-OBJS += vpx.def
171 vpx.vcproj: $(CODEC_SRCS) vpx.def
173 $(qexec)$(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh \
175 --target=$(TOOLCHAIN) \
176 $(if $(CONFIG_STATIC_MSVCRT),--static-crt) \
178 --proj-guid=DCE19DAF-69AC-46DB-B14A-39F0FAA5DB74 \
179 --module-def=vpx.def \
180 --ver=$(CONFIG_VS_VERSION) \
181 --out=$@ $(CFLAGS) $^ \
182 --src-path-bare="$(SRC_PATH_BARE)" \
184 PROJECTS-$(BUILD_LIBVPX) += vpx.vcproj
186 vpx.vcproj: vpx_config.asm
187 vpx.vcproj: vpx_rtcd.h
191 LIBVPX_OBJS=$(call objs,$(CODEC_SRCS))
192 OBJS-$(BUILD_LIBVPX) += $(LIBVPX_OBJS)
193 LIBS-$(if $(BUILD_LIBVPX),$(CONFIG_STATIC)) += $(BUILD_PFX)libvpx.a $(BUILD_PFX)libvpx_g.a
194 $(BUILD_PFX)libvpx_g.a: $(LIBVPX_OBJS)
196 BUILD_LIBVPX_SO := $(if $(BUILD_LIBVPX),$(CONFIG_SHARED))
197 LIBVPX_SO := libvpx.so.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)
198 LIBS-$(BUILD_LIBVPX_SO) += $(BUILD_PFX)$(LIBVPX_SO)\
199 $(notdir $(LIBVPX_SO_SYMLINKS))
200 $(BUILD_PFX)$(LIBVPX_SO): $(LIBVPX_OBJS) libvpx.ver
201 $(BUILD_PFX)$(LIBVPX_SO): extralibs += -lm
202 $(BUILD_PFX)$(LIBVPX_SO): SONAME = libvpx.so.$(VERSION_MAJOR)
203 $(BUILD_PFX)$(LIBVPX_SO): SO_VERSION_SCRIPT = libvpx.ver
204 LIBVPX_SO_SYMLINKS := $(addprefix $(LIBSUBDIR)/, \
205 libvpx.so libvpx.so.$(VERSION_MAJOR) \
206 libvpx.so.$(VERSION_MAJOR).$(VERSION_MINOR))
208 libvpx.ver: $(call enabled,CODEC_EXPORTS)
210 $(qexec)echo "{ global:" > $@
211 $(qexec)for f in $?; do awk '{print $$2";"}' < $$f >>$@; done
212 $(qexec)echo "local: *; };" >> $@
213 CLEAN-OBJS += libvpx.ver
215 define libvpx_symlink_template
218 $(qexec)ln -sf $(LIBVPX_SO) $$@
221 $(eval $(call libvpx_symlink_template,\
222 $(addprefix $(BUILD_PFX),$(notdir $(LIBVPX_SO_SYMLINKS))),\
223 $(BUILD_PFX)$(LIBVPX_SO)))
224 $(eval $(call libvpx_symlink_template,\
225 $(addprefix $(DIST_DIR)/,$(LIBVPX_SO_SYMLINKS)),\
226 $(DIST_DIR)/$(LIBSUBDIR)/$(LIBVPX_SO)))
228 INSTALL-LIBS-$(CONFIG_SHARED) += $(LIBVPX_SO_SYMLINKS)
229 INSTALL-LIBS-$(CONFIG_SHARED) += $(LIBSUBDIR)/$(LIBVPX_SO)
231 LIBS-$(BUILD_LIBVPX) += vpx.pc
232 vpx.pc: config.mk libs.mk
234 $(qexec)echo '# pkg-config file from libvpx $(VERSION_STRING)' > $@
235 $(qexec)echo 'prefix=$(PREFIX)' >> $@
236 $(qexec)echo 'exec_prefix=$${prefix}' >> $@
237 $(qexec)echo 'libdir=$${prefix}/$(LIBSUBDIR)' >> $@
238 $(qexec)echo 'includedir=$${prefix}/include' >> $@
239 $(qexec)echo '' >> $@
240 $(qexec)echo 'Name: vpx' >> $@
241 $(qexec)echo 'Description: WebM Project VPx codec implementation' >> $@
242 $(qexec)echo 'Version: $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)' >> $@
243 $(qexec)echo 'Requires:' >> $@
244 $(qexec)echo 'Conflicts:' >> $@
245 $(qexec)echo 'Libs: -L$${libdir} -lvpx' >> $@
246 $(qexec)echo 'Libs.private: -lm -lpthread' >> $@
247 $(qexec)echo 'Cflags: -I$${includedir}' >> $@
248 INSTALL-LIBS-yes += $(LIBSUBDIR)/pkgconfig/vpx.pc
249 INSTALL_MAPS += $(LIBSUBDIR)/pkgconfig/%.pc %.pc
253 LIBS-$(LIPO_LIBVPX) += libvpx.a
254 $(eval $(if $(LIPO_LIBVPX),$(call lipo_lib_template,libvpx.a)))
257 # Rule to make assembler configuration file from C configuration file
259 ifeq ($(ARCH_X86)$(ARCH_X86_64),yes)
261 $(BUILD_PFX)vpx_config.asm: $(BUILD_PFX)vpx_config.h
263 @egrep "#define [A-Z0-9_]+ [01]" $< \
264 | awk '{print $$2 " equ " $$3}' > $@
266 ADS2GAS=$(if $(filter yes,$(CONFIG_GCC)),| $(ASM_CONVERSION))
267 $(BUILD_PFX)vpx_config.asm: $(BUILD_PFX)vpx_config.h
269 @egrep "#define [A-Z0-9_]+ [01]" $< \
270 | awk '{print $$2 " EQU " $$3}' $(ADS2GAS) > $@
271 @echo " END" $(ADS2GAS) >> $@
272 CLEAN-OBJS += $(BUILD_PFX)vpx_config.asm
276 # Add assembler dependencies for configuration and offsets
278 $(filter %.s.o,$(OBJS-yes)): $(BUILD_PFX)vpx_config.asm
279 $(filter %$(ASM).o,$(OBJS-yes)): $(BUILD_PFX)vpx_config.asm
282 # Calculate platform- and compiler-specific offsets for hand coded assembly
285 OFFSET_PATTERN:='^[a-zA-Z0-9_]* EQU'
287 ifeq ($(filter icc gcc,$(TGT_CC)), $(TGT_CC))
288 $(BUILD_PFX)asm_com_offsets.asm: $(BUILD_PFX)$(VP8_PREFIX)common/asm_com_offsets.c.S
290 $(qexec)LC_ALL=C grep $(OFFSET_PATTERN) $< | tr -d '$$\#' $(ADS2GAS) > $@
291 $(BUILD_PFX)$(VP8_PREFIX)common/asm_com_offsets.c.S: $(VP8_PREFIX)common/asm_com_offsets.c
292 CLEAN-OBJS += $(BUILD_PFX)asm_com_offsets.asm $(BUILD_PFX)$(VP8_PREFIX)common/asm_com_offsets.c.S
294 $(BUILD_PFX)asm_enc_offsets.asm: $(BUILD_PFX)$(VP8_PREFIX)encoder/asm_enc_offsets.c.S
296 $(qexec)LC_ALL=C grep $(OFFSET_PATTERN) $< | tr -d '$$\#' $(ADS2GAS) > $@
297 $(BUILD_PFX)$(VP8_PREFIX)encoder/asm_enc_offsets.c.S: $(VP8_PREFIX)encoder/asm_enc_offsets.c
298 CLEAN-OBJS += $(BUILD_PFX)asm_enc_offsets.asm $(BUILD_PFX)$(VP8_PREFIX)encoder/asm_enc_offsets.c.S
300 $(BUILD_PFX)asm_dec_offsets.asm: $(BUILD_PFX)$(VP8_PREFIX)decoder/asm_dec_offsets.c.S
302 $(qexec)LC_ALL=C grep $(OFFSET_PATTERN) $< | tr -d '$$\#' $(ADS2GAS) > $@
303 $(BUILD_PFX)$(VP8_PREFIX)decoder/asm_dec_offsets.c.S: $(VP8_PREFIX)decoder/asm_dec_offsets.c
304 CLEAN-OBJS += $(BUILD_PFX)asm_dec_offsets.asm $(BUILD_PFX)$(VP8_PREFIX)decoder/asm_dec_offsets.c.S
306 ifeq ($(filter rvct,$(TGT_CC)), $(TGT_CC))
307 asm_com_offsets.asm: obj_int_extract
308 asm_com_offsets.asm: $(VP8_PREFIX)common/asm_com_offsets.c.o
310 $(qexec)./obj_int_extract rvds $< $(ADS2GAS) > $@
311 OBJS-yes += $(VP8_PREFIX)common/asm_com_offsets.c.o
312 CLEAN-OBJS += asm_com_offsets.asm
313 $(filter %$(ASM).o,$(OBJS-yes)): $(BUILD_PFX)asm_com_offsets.asm
315 asm_enc_offsets.asm: obj_int_extract
316 asm_enc_offsets.asm: $(VP8_PREFIX)encoder/asm_enc_offsets.c.o
318 $(qexec)./obj_int_extract rvds $< $(ADS2GAS) > $@
319 OBJS-yes += $(VP8_PREFIX)encoder/asm_enc_offsets.c.o
320 CLEAN-OBJS += asm_enc_offsets.asm
321 $(filter %$(ASM).o,$(OBJS-yes)): $(BUILD_PFX)asm_enc_offsets.asm
323 asm_dec_offsets.asm: obj_int_extract
324 asm_dec_offsets.asm: $(VP8_PREFIX)decoder/asm_dec_offsets.c.o
326 $(qexec)./obj_int_extract rvds $< $(ADS2GAS) > $@
327 OBJS-yes += $(VP8_PREFIX)decoder/asm_dec_offsets.c.o
328 CLEAN-OBJS += asm_dec_offsets.asm
329 $(filter %$(ASM).o,$(OBJS-yes)): $(BUILD_PFX)asm_dec_offsets.asm
333 $(shell $(SRC_PATH_BARE)/build/make/version.sh "$(SRC_PATH_BARE)" $(BUILD_PFX)vpx_version.h)
334 CLEAN-OBJS += $(BUILD_PFX)vpx_version.h
337 # Rule to generate runtime cpu detection files
339 $(BUILD_PFX)vpx_rtcd.h: $(SRC_PATH_BARE)/$(sort $(filter %rtcd_defs.sh,$(CODEC_SRCS)))
341 $(qexec)$(SRC_PATH_BARE)/build/make/rtcd.sh --arch=$(TGT_ISA) \
343 --config=$(target)$(if $(FAT_ARCHS),,-$(TOOLCHAIN)).mk \
344 $(RTCD_OPTIONS) $^ > $@
345 CLEAN-OBJS += $(BUILD_PFX)vpx_rtcd.h
347 CODEC_DOC_SRCS += vpx/vpx_codec.h \
353 ## libvpx test directives
355 ifeq ($(CONFIG_UNIT_TESTS),yes)
356 LIBVPX_TEST_DATA_PATH ?= .
358 include $(SRC_PATH_BARE)/test/test.mk
359 LIBVPX_TEST_SRCS=$(addprefix test/,$(call enabled,LIBVPX_TEST_SRCS))
360 LIBVPX_TEST_BINS=./test_libvpx
361 LIBVPX_TEST_DATA=$(addprefix $(LIBVPX_TEST_DATA_PATH)/,\
362 $(call enabled,LIBVPX_TEST_DATA))
363 libvpx_test_data_url=http://downloads.webmproject.org/test_data/libvpx/$(1)
366 @echo " [DOWNLOAD] $@"
367 $(qexec)trap 'rm -f $@' INT TERM &&\
368 curl -L -o $@ $(call libvpx_test_data_url,$(@F))
370 testdata:: $(LIBVPX_TEST_DATA)
371 $(qexec)if [ -x "$$(which sha1sum)" ]; then\
372 echo "Checking test data:";\
373 if [ -n "$(LIBVPX_TEST_DATA)" ]; then\
374 for f in $(call enabled,LIBVPX_TEST_DATA); do\
375 grep $$f $(SRC_PATH_BARE)/test/test-data.sha1 |\
376 (cd $(LIBVPX_TEST_DATA_PATH); sha1sum -c);\
380 echo "Skipping test data integrity check, sha1sum not found.";\
383 ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
384 ifeq ($(CONFIG_MSVS),yes)
386 gtest.vcproj: $(SRC_PATH_BARE)/third_party/googletest/src/src/gtest-all.cc
388 $(qexec)$(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh \
390 --target=$(TOOLCHAIN) \
391 $(if $(CONFIG_STATIC_MSVCRT),--static-crt) \
393 --proj-guid=EC00E1EC-AF68-4D92-A255-181690D1C9B1 \
394 --ver=$(CONFIG_VS_VERSION) \
395 --src-path-bare="$(SRC_PATH_BARE)" \
396 --out=gtest.vcproj $(SRC_PATH_BARE)/third_party/googletest/src/src/gtest-all.cc \
397 -I. -I"$(SRC_PATH_BARE)/third_party/googletest/src/include" -I"$(SRC_PATH_BARE)/third_party/googletest/src"
399 PROJECTS-$(CONFIG_MSVS) += gtest.vcproj
401 test_libvpx.vcproj: $(LIBVPX_TEST_SRCS)
403 $(qexec)$(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh \
405 --target=$(TOOLCHAIN) \
407 --proj-guid=CD837F5F-52D8-4314-A370-895D614166A7 \
408 --ver=$(CONFIG_VS_VERSION) \
409 $(if $(CONFIG_STATIC_MSVCRT),--static-crt) \
410 --out=$@ $(INTERNAL_CFLAGS) $(CFLAGS) \
411 -I. -I"$(SRC_PATH_BARE)/third_party/googletest/src/include" \
412 -L. -l$(CODEC_LIB) -lwinmm -l$(GTEST_LIB) $^
414 PROJECTS-$(CONFIG_MSVS) += test_libvpx.vcproj
417 @set -e; for t in $(addprefix Win32/Release/,$(notdir $(LIBVPX_TEST_BINS:.cc=.exe))); do $$t; done
421 include $(SRC_PATH_BARE)/third_party/googletest/gtest.mk
422 GTEST_SRCS := $(addprefix third_party/googletest/src/,$(call enabled,GTEST_SRCS))
423 GTEST_OBJS=$(call objs,$(GTEST_SRCS))
424 $(GTEST_OBJS) $(GTEST_OBJS:.o=.d): CXXFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src
425 $(GTEST_OBJS) $(GTEST_OBJS:.o=.d): CXXFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src/include
426 OBJS-$(BUILD_LIBVPX) += $(GTEST_OBJS)
427 LIBS-$(BUILD_LIBVPX) += $(BUILD_PFX)libgtest.a $(BUILD_PFX)libgtest_g.a
428 $(BUILD_PFX)libgtest_g.a: $(GTEST_OBJS)
430 LIBVPX_TEST_OBJS=$(sort $(call objs,$(LIBVPX_TEST_SRCS)))
431 $(LIBVPX_TEST_OBJS) $(LIBVPX_TEST_OBJS:.o=.d): CXXFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src
432 $(LIBVPX_TEST_OBJS) $(LIBVPX_TEST_OBJS:.o=.d): CXXFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src/include
433 OBJS-$(BUILD_LIBVPX) += $(LIBVPX_TEST_OBJS)
434 BINS-$(BUILD_LIBVPX) += $(LIBVPX_TEST_BINS)
436 # Install test sources only if codec source is included
437 INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(patsubst $(SRC_PATH_BARE)/%,%,\
438 $(shell find $(SRC_PATH_BARE)/third_party/googletest -type f))
439 INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(LIBVPX_TEST_SRCS)
441 CODEC_LIB=$(if $(CONFIG_DEBUG_LIBS),vpx_g,vpx)
442 CODEC_LIB_SUF=$(if $(CONFIG_SHARED),.so,.a)
443 $(foreach bin,$(LIBVPX_TEST_BINS),\
444 $(if $(BUILD_LIBVPX),$(eval $(bin): \
445 lib$(CODEC_LIB)$(CODEC_LIB_SUF) libgtest.a ))\
446 $(if $(BUILD_LIBVPX),$(eval $(call linkerxx_template,$(bin),\
447 $(LIBVPX_TEST_OBJS) \
448 -L. -lvpx -lgtest -lpthread -lm)\
450 $(if $(LIPO_LIBS),$(eval $(call lipo_bin_template,$(bin))))\
452 test:: $(LIBVPX_TEST_BINS) testdata
453 @set -e; for t in $(LIBVPX_TEST_BINS); do $$t; done
459 ## documentation directives
461 CLEAN-OBJS += libs.doxy
462 DOCS-yes += libs.doxy
463 libs.doxy: $(CODEC_DOC_SRCS)
466 @echo "INPUT += $^" >> $@
467 @echo "PREDEFINED = VPX_CODEC_DISABLE_COMPAT" >> $@
468 @echo "INCLUDE_PATH += ." >> $@;
469 @echo "ENABLED_SECTIONS += $(sort $(CODEC_DOC_SECTIONS))" >> $@
471 ## Generate vpx_rtcd.h for all objects
472 $(OBJS-yes:.o=.d): $(BUILD_PFX)vpx_rtcd.h