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)
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=$$(target)$$(if $$(FAT_ARCHS),,-$$(TOOLCHAIN)).mk \
55 $$(RTCD_OPTIONS) $$^ > $$@
56 CLEAN-OBJS += $$(BUILD_PFX)$(1).h
57 RTCD += $$(BUILD_PFX)$(1).h
60 CODEC_SRCS-yes += CHANGELOG
61 CODEC_SRCS-yes += libs.mk
63 # If this is a universal (fat) binary, then all the subarchitectures have
64 # already been built and our job is to stitch them together. The
65 # BUILD_LIBVPX variable indicates whether we should be building
66 # (compiling, linking) the library. The LIPO_LIBVPX variable indicates
67 # that we're stitching.
68 $(eval $(if $(filter universal%,$(TOOLCHAIN)),LIPO_LIBVPX,BUILD_LIBVPX):=yes)
70 include $(SRC_PATH_BARE)/vpx/vpx_codec.mk
71 CODEC_SRCS-yes += $(addprefix vpx/,$(call enabled,API_SRCS))
72 CODEC_DOC_SRCS += $(addprefix vpx/,$(call enabled,API_DOC_SRCS))
74 include $(SRC_PATH_BARE)/vpx_mem/vpx_mem.mk
75 CODEC_SRCS-yes += $(addprefix vpx_mem/,$(call enabled,MEM_SRCS))
77 include $(SRC_PATH_BARE)/vpx_scale/vpx_scale.mk
78 CODEC_SRCS-yes += $(addprefix vpx_scale/,$(call enabled,SCALE_SRCS))
80 include $(SRC_PATH_BARE)/vpx_ports/vpx_ports.mk
81 CODEC_SRCS-yes += $(addprefix vpx_ports/,$(call enabled,PORTS_SRCS))
83 ifneq ($(CONFIG_VP8_ENCODER)$(CONFIG_VP8_DECODER),)
85 include $(SRC_PATH_BARE)/$(VP8_PREFIX)vp8_common.mk
88 ifeq ($(CONFIG_VP8_ENCODER),yes)
89 include $(SRC_PATH_BARE)/$(VP8_PREFIX)vp8cx.mk
90 CODEC_SRCS-yes += $(addprefix $(VP8_PREFIX),$(call enabled,VP8_CX_SRCS))
91 CODEC_EXPORTS-yes += $(addprefix $(VP8_PREFIX),$(VP8_CX_EXPORTS))
92 INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8cx.h
93 INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP8_PREFIX)/%
94 CODEC_DOC_SECTIONS += vp8 vp8_encoder
97 ifeq ($(CONFIG_VP8_DECODER),yes)
98 include $(SRC_PATH_BARE)/$(VP8_PREFIX)vp8dx.mk
99 CODEC_SRCS-yes += $(addprefix $(VP8_PREFIX),$(call enabled,VP8_DX_SRCS))
100 CODEC_EXPORTS-yes += $(addprefix $(VP8_PREFIX),$(VP8_DX_EXPORTS))
101 INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8dx.h
102 INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP8_PREFIX)/%
103 CODEC_DOC_SECTIONS += vp8 vp8_decoder
106 ifneq ($(CONFIG_VP9_ENCODER)$(CONFIG_VP9_DECODER),)
108 include $(SRC_PATH_BARE)/$(VP9_PREFIX)vp9_common.mk
111 ifeq ($(CONFIG_VP9_ENCODER),yes)
113 include $(SRC_PATH_BARE)/$(VP9_PREFIX)vp9cx.mk
114 CODEC_SRCS-yes += $(addprefix $(VP9_PREFIX),$(call enabled,VP9_CX_SRCS))
115 CODEC_EXPORTS-yes += $(addprefix $(VP9_PREFIX),$(VP9_CX_EXPORTS))
116 CODEC_SRCS-yes += $(VP9_PREFIX)vp9cx.mk vpx/vp8.h vpx/vp8cx.h
117 INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8cx.h
118 INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP9_PREFIX)/%
119 CODEC_DOC_SRCS += vpx/vp8.h vpx/vp8cx.h
120 CODEC_DOC_SECTIONS += vp9 vp9_encoder
123 ifeq ($(CONFIG_VP9_DECODER),yes)
125 include $(SRC_PATH_BARE)/$(VP9_PREFIX)vp9dx.mk
126 CODEC_SRCS-yes += $(addprefix $(VP9_PREFIX),$(call enabled,VP9_DX_SRCS))
127 CODEC_EXPORTS-yes += $(addprefix $(VP9_PREFIX),$(VP9_DX_EXPORTS))
128 CODEC_SRCS-yes += $(VP9_PREFIX)vp9dx.mk vpx/vp8.h vpx/vp8dx.h
129 INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8dx.h
130 INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP9_PREFIX)/%
131 CODEC_DOC_SRCS += vpx/vp8.h vpx/vp8dx.h
132 CODEC_DOC_SECTIONS += vp9 vp9_decoder
136 ifeq ($(CONFIG_ENCODERS),yes)
137 CODEC_DOC_SECTIONS += encoder
139 ifeq ($(CONFIG_DECODERS),yes)
140 CODEC_DOC_SECTIONS += decoder
144 ifeq ($(CONFIG_MSVS),yes)
145 CODEC_LIB=$(if $(CONFIG_STATIC_MSVCRT),vpxmt,vpxmd)
146 GTEST_LIB=$(if $(CONFIG_STATIC_MSVCRT),gtestmt,gtestmd)
147 # This variable uses deferred expansion intentionally, since the results of
148 # $(wildcard) may change during the course of the Make.
149 VS_PLATFORMS = $(foreach d,$(wildcard */Release/$(CODEC_LIB).lib),$(word 1,$(subst /, ,$(d))))
152 # The following pairs define a mapping of locations in the distribution
153 # tree to locations in the source/build trees.
154 INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/vpx/%
155 INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/vpx_ports/%
156 INSTALL_MAPS += $(LIBSUBDIR)/% %
157 INSTALL_MAPS += src/% $(SRC_PATH_BARE)/%
158 ifeq ($(CONFIG_MSVS),yes)
159 INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/% $(p)/Release/%)
160 INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/% $(p)/Debug/%)
163 CODEC_SRCS-$(BUILD_LIBVPX) += build/make/version.sh
164 CODEC_SRCS-$(BUILD_LIBVPX) += build/make/rtcd.sh
165 CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/emmintrin_compat.h
166 CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/vpx_once.h
167 CODEC_SRCS-$(BUILD_LIBVPX) += $(BUILD_PFX)vpx_config.c
168 INSTALL-SRCS-no += $(BUILD_PFX)vpx_config.c
169 ifeq ($(ARCH_X86)$(ARCH_X86_64),yes)
170 CODEC_SRCS-$(BUILD_LIBVPX) += third_party/x86inc/x86inc.asm
172 CODEC_EXPORTS-$(BUILD_LIBVPX) += vpx/exports_com
173 CODEC_EXPORTS-$(CONFIG_ENCODERS) += vpx/exports_enc
174 CODEC_EXPORTS-$(CONFIG_DECODERS) += vpx/exports_dec
176 INSTALL-LIBS-yes += include/vpx/vpx_codec.h
177 INSTALL-LIBS-yes += include/vpx/vpx_image.h
178 INSTALL-LIBS-yes += include/vpx/vpx_integer.h
179 INSTALL-LIBS-yes += include/vpx/vpx_codec_impl_top.h
180 INSTALL-LIBS-yes += include/vpx/vpx_codec_impl_bottom.h
181 INSTALL-LIBS-$(CONFIG_DECODERS) += include/vpx/vpx_decoder.h
182 INSTALL-LIBS-$(CONFIG_ENCODERS) += include/vpx/vpx_encoder.h
183 ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
184 ifeq ($(CONFIG_MSVS),yes)
185 INSTALL-LIBS-yes += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/$(CODEC_LIB).lib)
186 INSTALL-LIBS-$(CONFIG_DEBUG_LIBS) += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/$(CODEC_LIB)d.lib)
187 INSTALL-LIBS-$(CONFIG_SHARED) += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/vpx.dll)
188 INSTALL-LIBS-$(CONFIG_SHARED) += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/vpx.exp)
191 INSTALL-LIBS-$(CONFIG_STATIC) += $(LIBSUBDIR)/libvpx.a
192 INSTALL-LIBS-$(CONFIG_DEBUG_LIBS) += $(LIBSUBDIR)/libvpx_g.a
195 CODEC_SRCS=$(call enabled,CODEC_SRCS)
196 INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(CODEC_SRCS)
197 INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(call enabled,CODEC_EXPORTS)
200 # Generate a list of all enabled sources, in particular for exporting to gyp
201 # based build systems.
204 @echo $(CODEC_SRCS) | xargs -n1 echo | sort -u > $@
207 ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
208 ifeq ($(CONFIG_MSVS),yes)
210 obj_int_extract.vcproj: $(SRC_PATH_BARE)/build/make/obj_int_extract.c
211 @cp $(SRC_PATH_BARE)/build/x86-msvs/obj_int_extract.bat .
213 $(qexec)$(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh \
215 --target=$(TOOLCHAIN) \
216 --name=obj_int_extract \
217 --ver=$(CONFIG_VS_VERSION) \
218 --proj-guid=E1360C65-D375-4335-8057-7ED99CC3F9B2 \
219 $(if $(CONFIG_STATIC_MSVCRT),--static-crt) \
222 -I"$(SRC_PATH_BARE)" \
224 PROJECTS-$(BUILD_LIBVPX) += obj_int_extract.vcproj
225 PROJECTS-$(BUILD_LIBVPX) += obj_int_extract.bat
227 vpx.def: $(call enabled,CODEC_EXPORTS)
229 $(qexec)$(SRC_PATH_BARE)/build/make/gen_msvs_def.sh\
232 CLEAN-OBJS += vpx.def
234 vpx.vcproj: $(CODEC_SRCS) vpx.def
236 $(qexec)$(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh \
237 $(if $(CONFIG_SHARED),--dll,--lib) \
238 --target=$(TOOLCHAIN) \
239 $(if $(CONFIG_STATIC_MSVCRT),--static-crt) \
241 --proj-guid=DCE19DAF-69AC-46DB-B14A-39F0FAA5DB74 \
242 --module-def=vpx.def \
243 --ver=$(CONFIG_VS_VERSION) \
244 --out=$@ $(CFLAGS) $^ \
245 --src-path-bare="$(SRC_PATH_BARE)" \
247 PROJECTS-$(BUILD_LIBVPX) += vpx.vcproj
249 vpx.vcproj: vpx_config.asm
254 LIBVPX_OBJS=$(call objs,$(CODEC_SRCS))
255 OBJS-$(BUILD_LIBVPX) += $(LIBVPX_OBJS)
256 LIBS-$(if $(BUILD_LIBVPX),$(CONFIG_STATIC)) += $(BUILD_PFX)libvpx.a $(BUILD_PFX)libvpx_g.a
257 $(BUILD_PFX)libvpx_g.a: $(LIBVPX_OBJS)
260 BUILD_LIBVPX_SO := $(if $(BUILD_LIBVPX),$(CONFIG_SHARED))
262 ifeq ($(filter darwin%,$(TGT_OS)),$(TGT_OS))
263 LIBVPX_SO := libvpx.$(VERSION_MAJOR).dylib
264 EXPORT_FILE := libvpx.syms
265 LIBVPX_SO_SYMLINKS := $(addprefix $(LIBSUBDIR)/, \
268 LIBVPX_SO := libvpx.so.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)
269 EXPORT_FILE := libvpx.ver
270 SYM_LINK := libvpx.so
271 LIBVPX_SO_SYMLINKS := $(addprefix $(LIBSUBDIR)/, \
272 libvpx.so libvpx.so.$(VERSION_MAJOR) \
273 libvpx.so.$(VERSION_MAJOR).$(VERSION_MINOR))
276 LIBS-$(BUILD_LIBVPX_SO) += $(BUILD_PFX)$(LIBVPX_SO)\
277 $(notdir $(LIBVPX_SO_SYMLINKS))
278 $(BUILD_PFX)$(LIBVPX_SO): $(LIBVPX_OBJS) $(EXPORT_FILE)
279 $(BUILD_PFX)$(LIBVPX_SO): extralibs += -lm
280 $(BUILD_PFX)$(LIBVPX_SO): SONAME = libvpx.so.$(VERSION_MAJOR)
281 $(BUILD_PFX)$(LIBVPX_SO): EXPORTS_FILE = $(EXPORT_FILE)
283 libvpx.ver: $(call enabled,CODEC_EXPORTS)
285 $(qexec)echo "{ global:" > $@
286 $(qexec)for f in $?; do awk '{print $$2";"}' < $$f >>$@; done
287 $(qexec)echo "local: *; };" >> $@
288 CLEAN-OBJS += libvpx.ver
290 libvpx.syms: $(call enabled,CODEC_EXPORTS)
292 $(qexec)awk '{print "_"$$2}' $^ >$@
293 CLEAN-OBJS += libvpx.syms
295 define libvpx_symlink_template
297 @echo " [LN] $(2) $$@"
298 $(qexec)mkdir -p $$(dir $$@)
299 $(qexec)ln -sf $(2) $$@
302 $(eval $(call libvpx_symlink_template,\
303 $(addprefix $(BUILD_PFX),$(notdir $(LIBVPX_SO_SYMLINKS))),\
304 $(BUILD_PFX)$(LIBVPX_SO)))
305 $(eval $(call libvpx_symlink_template,\
306 $(addprefix $(DIST_DIR)/,$(LIBVPX_SO_SYMLINKS)),\
310 INSTALL-LIBS-$(BUILD_LIBVPX_SO) += $(LIBVPX_SO_SYMLINKS)
311 INSTALL-LIBS-$(BUILD_LIBVPX_SO) += $(LIBSUBDIR)/$(LIBVPX_SO)
314 LIBS-$(BUILD_LIBVPX) += vpx.pc
315 vpx.pc: config.mk libs.mk
317 $(qexec)echo '# pkg-config file from libvpx $(VERSION_STRING)' > $@
318 $(qexec)echo 'prefix=$(PREFIX)' >> $@
319 $(qexec)echo 'exec_prefix=$${prefix}' >> $@
320 $(qexec)echo 'libdir=$${prefix}/$(LIBSUBDIR)' >> $@
321 $(qexec)echo 'includedir=$${prefix}/include' >> $@
322 $(qexec)echo '' >> $@
323 $(qexec)echo 'Name: vpx' >> $@
324 $(qexec)echo 'Description: WebM Project VPx codec implementation' >> $@
325 $(qexec)echo 'Version: $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)' >> $@
326 $(qexec)echo 'Requires:' >> $@
327 $(qexec)echo 'Conflicts:' >> $@
328 $(qexec)echo 'Libs: -L$${libdir} -lvpx -lm' >> $@
329 ifeq ($(HAVE_PTHREAD_H),yes)
330 $(qexec)echo 'Libs.private: -lm -lpthread' >> $@
332 $(qexec)echo 'Libs.private: -lm' >> $@
334 $(qexec)echo 'Cflags: -I$${includedir}' >> $@
335 INSTALL-LIBS-yes += $(LIBSUBDIR)/pkgconfig/vpx.pc
336 INSTALL_MAPS += $(LIBSUBDIR)/pkgconfig/%.pc %.pc
340 LIBS-$(LIPO_LIBVPX) += libvpx.a
341 $(eval $(if $(LIPO_LIBVPX),$(call lipo_lib_template,libvpx.a)))
344 # Rule to make assembler configuration file from C configuration file
346 ifeq ($(ARCH_X86)$(ARCH_X86_64),yes)
348 $(BUILD_PFX)vpx_config.asm: $(BUILD_PFX)vpx_config.h
350 @egrep "#define [A-Z0-9_]+ [01]" $< \
351 | awk '{print $$2 " equ " $$3}' > $@
353 ADS2GAS=$(if $(filter yes,$(CONFIG_GCC)),| $(ASM_CONVERSION))
354 $(BUILD_PFX)vpx_config.asm: $(BUILD_PFX)vpx_config.h
356 @egrep "#define [A-Z0-9_]+ [01]" $< \
357 | awk '{print $$2 " EQU " $$3}' $(ADS2GAS) > $@
358 @echo " END" $(ADS2GAS) >> $@
359 CLEAN-OBJS += $(BUILD_PFX)vpx_config.asm
363 # Add assembler dependencies for configuration and offsets
365 $(filter %.s.o,$(OBJS-yes)): $(BUILD_PFX)vpx_config.asm
366 $(filter %$(ASM).o,$(OBJS-yes)): $(BUILD_PFX)vpx_config.asm
369 $(shell $(SRC_PATH_BARE)/build/make/version.sh "$(SRC_PATH_BARE)" $(BUILD_PFX)vpx_version.h)
370 CLEAN-OBJS += $(BUILD_PFX)vpx_version.h
374 ## libvpx test directives
376 ifeq ($(CONFIG_UNIT_TESTS),yes)
377 LIBVPX_TEST_DATA_PATH ?= .
379 include $(SRC_PATH_BARE)/test/test.mk
380 LIBVPX_TEST_SRCS=$(addprefix test/,$(call enabled,LIBVPX_TEST_SRCS))
381 LIBVPX_TEST_BINS=./test_libvpx
382 LIBVPX_TEST_DATA=$(addprefix $(LIBVPX_TEST_DATA_PATH)/,\
383 $(call enabled,LIBVPX_TEST_DATA))
384 libvpx_test_data_url=http://downloads.webmproject.org/test_data/libvpx/$(1)
387 @echo " [DOWNLOAD] $@"
388 $(qexec)trap 'rm -f $@' INT TERM &&\
389 curl -L -o $@ $(call libvpx_test_data_url,$(@F))
391 testdata:: $(LIBVPX_TEST_DATA)
392 $(qexec)if [ -x "$$(which sha1sum)" ]; then\
393 echo "Checking test data:";\
394 if [ -n "$(LIBVPX_TEST_DATA)" ]; then\
395 for f in $(call enabled,LIBVPX_TEST_DATA); do\
396 grep $$f $(SRC_PATH_BARE)/test/test-data.sha1 |\
397 (cd $(LIBVPX_TEST_DATA_PATH); sha1sum -c);\
401 echo "Skipping test data integrity check, sha1sum not found.";\
404 ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
405 ifeq ($(CONFIG_MSVS),yes)
407 gtest.vcproj: $(SRC_PATH_BARE)/third_party/googletest/src/src/gtest-all.cc
409 $(qexec)$(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh \
411 --target=$(TOOLCHAIN) \
412 $(if $(CONFIG_STATIC_MSVCRT),--static-crt) \
414 --proj-guid=EC00E1EC-AF68-4D92-A255-181690D1C9B1 \
415 --ver=$(CONFIG_VS_VERSION) \
416 --src-path-bare="$(SRC_PATH_BARE)" \
418 --out=gtest.vcproj $(SRC_PATH_BARE)/third_party/googletest/src/src/gtest-all.cc \
419 -I. -I"$(SRC_PATH_BARE)/third_party/googletest/src/include" -I"$(SRC_PATH_BARE)/third_party/googletest/src"
421 PROJECTS-$(CONFIG_MSVS) += gtest.vcproj
423 test_libvpx.vcproj: $(LIBVPX_TEST_SRCS)
425 $(qexec)$(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh \
427 --target=$(TOOLCHAIN) \
430 --proj-guid=CD837F5F-52D8-4314-A370-895D614166A7 \
431 --ver=$(CONFIG_VS_VERSION) \
432 $(if $(CONFIG_STATIC_MSVCRT),--static-crt) \
433 --out=$@ $(INTERNAL_CFLAGS) $(CFLAGS) \
434 -I. -I"$(SRC_PATH_BARE)/third_party/googletest/src/include" \
435 -L. -l$(CODEC_LIB) -lwinmm -l$(GTEST_LIB) $^
437 PROJECTS-$(CONFIG_MSVS) += test_libvpx.vcproj
440 @set -e; for t in $(addprefix Win32/Release/,$(notdir $(LIBVPX_TEST_BINS:.cc=.exe))); do $$t; done
444 include $(SRC_PATH_BARE)/third_party/googletest/gtest.mk
445 GTEST_SRCS := $(addprefix third_party/googletest/src/,$(call enabled,GTEST_SRCS))
446 GTEST_OBJS=$(call objs,$(GTEST_SRCS))
447 $(GTEST_OBJS) $(GTEST_OBJS:.o=.d): CXXFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src
448 $(GTEST_OBJS) $(GTEST_OBJS:.o=.d): CXXFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src/include
449 OBJS-$(BUILD_LIBVPX) += $(GTEST_OBJS)
450 LIBS-$(BUILD_LIBVPX) += $(BUILD_PFX)libgtest.a $(BUILD_PFX)libgtest_g.a
451 $(BUILD_PFX)libgtest_g.a: $(GTEST_OBJS)
453 LIBVPX_TEST_OBJS=$(sort $(call objs,$(LIBVPX_TEST_SRCS)))
454 $(LIBVPX_TEST_OBJS) $(LIBVPX_TEST_OBJS:.o=.d): CXXFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src
455 $(LIBVPX_TEST_OBJS) $(LIBVPX_TEST_OBJS:.o=.d): CXXFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src/include
456 OBJS-$(BUILD_LIBVPX) += $(LIBVPX_TEST_OBJS)
457 BINS-$(BUILD_LIBVPX) += $(LIBVPX_TEST_BINS)
459 # Install test sources only if codec source is included
460 INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(patsubst $(SRC_PATH_BARE)/%,%,\
461 $(shell find $(SRC_PATH_BARE)/third_party/googletest -type f))
462 INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(LIBVPX_TEST_SRCS)
464 CODEC_LIB=$(if $(CONFIG_DEBUG_LIBS),vpx_g,vpx)
465 CODEC_LIB_SUF=$(if $(CONFIG_SHARED),.so,.a)
466 $(foreach bin,$(LIBVPX_TEST_BINS),\
467 $(if $(BUILD_LIBVPX),$(eval $(bin): \
468 lib$(CODEC_LIB)$(CODEC_LIB_SUF) libgtest.a ))\
469 $(if $(BUILD_LIBVPX),$(eval $(call linkerxx_template,$(bin),\
470 $(LIBVPX_TEST_OBJS) \
471 -L. -lvpx -lgtest -lpthread -lm)\
473 $(if $(LIPO_LIBS),$(eval $(call lipo_bin_template,$(bin))))\
475 test:: $(LIBVPX_TEST_BINS) testdata
476 @set -e; for t in $(LIBVPX_TEST_BINS); do $$t; done
482 ## documentation directives
484 CLEAN-OBJS += libs.doxy
485 DOCS-yes += libs.doxy
486 libs.doxy: $(CODEC_DOC_SRCS)
489 @echo "INPUT += $^" >> $@
490 @echo "PREDEFINED = VPX_CODEC_DISABLE_COMPAT" >> $@
491 @echo "INCLUDE_PATH += ." >> $@;
492 @echo "ENABLED_SECTIONS += $(sort $(CODEC_DOC_SECTIONS))" >> $@
494 ## Generate rtcd.h for all objects
495 $(OBJS-yes:.o=.d): $(RTCD)
497 ## Update the global src list
498 SRCS += $(CODEC_SRCS) $(LIBVPX_TEST_SRCS) $(GTEST_SRCS)