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)
22 # Calculate platform- and compiler-specific offsets for hand coded assembly
24 ifeq ($(filter icc gcc,$(TGT_CC)), $(TGT_CC))
25 OFFSET_PATTERN:='^[a-zA-Z0-9_]* EQU'
26 define asm_offsets_template
27 $$(BUILD_PFX)$(1): $$(BUILD_PFX)$(call xform_obj_path,$(2)).S
29 $$(qexec)LC_ALL=C grep $$(OFFSET_PATTERN) $$< | tr -d '$$$$\#' $$(ADS2GAS) > $$@
30 $$(BUILD_PFX)$(call xform_obj_path,$(2)).S: $(2)
31 CLEAN-OBJS += $$(BUILD_PFX)$(1) $(call xform_obj_path,$(2)).S
34 ifeq ($(filter rvct,$(TGT_CC)), $(TGT_CC))
35 define asm_offsets_template
36 $$(BUILD_PFX)$(1): obj_int_extract
37 $$(BUILD_PFX)$(1): $$(BUILD_PFX)$(call xform_obj_path,$(2)).o
39 $$(qexec)./obj_int_extract rvds $$< $$(ADS2GAS) > $$@
40 OBJS-yes += $$(BUILD_PFX)$(call xform_obj_path,$(2)).o
41 CLEAN-OBJS += $$(BUILD_PFX)$(1)
42 $$(filter %$$(ASM).o,$$(OBJS-yes)): $$(BUILD_PFX)$(1)
48 # Rule to generate runtime cpu detection files
50 define rtcd_h_template
51 $$(BUILD_PFX)$(1).h: $$(SRC_PATH_BARE)/$(2)
53 $$(qexec)$$(SRC_PATH_BARE)/build/make/rtcd.sh --arch=$$(TGT_ISA) \
55 --config=$$(target)$$(if $$(FAT_ARCHS),,-$$(TOOLCHAIN)).mk \
56 $$(RTCD_OPTIONS) $$^ > $$@
57 CLEAN-OBJS += $$(BUILD_PFX)$(1).h
58 RTCD += $$(BUILD_PFX)$(1).h
61 CODEC_SRCS-yes += CHANGELOG
62 CODEC_SRCS-yes += libs.mk
64 include $(SRC_PATH_BARE)/vpx/vpx_codec.mk
65 CODEC_SRCS-yes += $(addprefix vpx/,$(call enabled,API_SRCS))
67 include $(SRC_PATH_BARE)/vpx_mem/vpx_mem.mk
68 CODEC_SRCS-yes += $(addprefix vpx_mem/,$(call enabled,MEM_SRCS))
70 include $(SRC_PATH_BARE)/vpx_scale/vpx_scale.mk
71 CODEC_SRCS-yes += $(addprefix vpx_scale/,$(call enabled,SCALE_SRCS))
73 ifneq ($(CONFIG_VP8_ENCODER)$(CONFIG_VP8_DECODER),)
75 include $(SRC_PATH_BARE)/$(VP8_PREFIX)vp8_common.mk
78 ifeq ($(CONFIG_VP8_ENCODER),yes)
79 include $(SRC_PATH_BARE)/$(VP8_PREFIX)vp8cx.mk
80 CODEC_SRCS-yes += $(addprefix $(VP8_PREFIX),$(call enabled,VP8_CX_SRCS))
81 CODEC_EXPORTS-yes += $(addprefix $(VP8_PREFIX),$(VP8_CX_EXPORTS))
82 CODEC_SRCS-yes += $(VP8_PREFIX)vp8cx.mk vpx/vp8.h vpx/vp8cx.h
83 CODEC_SRCS-$(ARCH_ARM) += $(VP8_PREFIX)vp88cx_arm.mk
84 INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8cx.h
85 INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP8_PREFIX)/%
86 CODEC_DOC_SRCS += vpx/vp8.h vpx/vp8cx.h
87 CODEC_DOC_SECTIONS += vp8 vp8_encoder
90 ifeq ($(CONFIG_VP8_DECODER),yes)
91 include $(SRC_PATH_BARE)/$(VP8_PREFIX)vp8dx.mk
92 CODEC_SRCS-yes += $(addprefix $(VP8_PREFIX),$(call enabled,VP8_DX_SRCS))
93 CODEC_EXPORTS-yes += $(addprefix $(VP8_PREFIX),$(VP8_DX_EXPORTS))
94 CODEC_SRCS-yes += $(VP8_PREFIX)vp8dx.mk vpx/vp8.h vpx/vp8dx.h
95 INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8dx.h
96 INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP8_PREFIX)/%
97 CODEC_DOC_SRCS += vpx/vp8.h vpx/vp8dx.h
98 CODEC_DOC_SECTIONS += vp8 vp8_decoder
101 ifneq ($(CONFIG_VP9_ENCODER)$(CONFIG_VP9_DECODER),)
103 include $(SRC_PATH_BARE)/$(VP9_PREFIX)vp9_common.mk
106 ifeq ($(CONFIG_VP9_ENCODER),yes)
108 include $(SRC_PATH_BARE)/$(VP9_PREFIX)vp9cx.mk
109 CODEC_SRCS-yes += $(addprefix $(VP9_PREFIX),$(call enabled,VP9_CX_SRCS))
110 CODEC_EXPORTS-yes += $(addprefix $(VP9_PREFIX),$(VP9_CX_EXPORTS))
111 CODEC_SRCS-yes += $(VP9_PREFIX)vp9cx.mk vpx/vp8.h vpx/vp8cx.h
112 CODEC_SRCS-$(ARCH_ARM) += $(VP9_PREFIX)vp98cx_arm.mk
113 INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8cx.h
114 INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP9_PREFIX)/%
115 CODEC_DOC_SRCS += vpx/vp8.h vpx/vp8cx.h
116 CODEC_DOC_SECTIONS += vp9 vp9_encoder
119 ifeq ($(CONFIG_VP9_DECODER),yes)
121 include $(SRC_PATH_BARE)/$(VP9_PREFIX)vp9dx.mk
122 CODEC_SRCS-yes += $(addprefix $(VP9_PREFIX),$(call enabled,VP9_DX_SRCS))
123 CODEC_EXPORTS-yes += $(addprefix $(VP9_PREFIX),$(VP9_DX_EXPORTS))
124 CODEC_SRCS-yes += $(VP9_PREFIX)vp9dx.mk vpx/vp8.h vpx/vp8dx.h
125 INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8dx.h
126 INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP9_PREFIX)/%
127 CODEC_DOC_SRCS += vpx/vp8.h vpx/vp8dx.h
128 CODEC_DOC_SECTIONS += vp9 vp9_decoder
132 ifeq ($(CONFIG_ENCODERS),yes)
133 CODEC_DOC_SECTIONS += encoder
135 ifeq ($(CONFIG_DECODERS),yes)
136 CODEC_DOC_SECTIONS += decoder
140 ifeq ($(CONFIG_MSVS),yes)
141 CODEC_LIB=$(if $(CONFIG_STATIC_MSVCRT),vpxmt,vpxmd)
142 GTEST_LIB=$(if $(CONFIG_STATIC_MSVCRT),gtestmt,gtestmd)
143 # This variable uses deferred expansion intentionally, since the results of
144 # $(wildcard) may change during the course of the Make.
145 VS_PLATFORMS = $(foreach d,$(wildcard */Release/$(CODEC_LIB).lib),$(word 1,$(subst /, ,$(d))))
148 # The following pairs define a mapping of locations in the distribution
149 # tree to locations in the source/build trees.
150 INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/vpx/%
151 INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/vpx_ports/%
152 INSTALL_MAPS += $(LIBSUBDIR)/% %
153 INSTALL_MAPS += src/% $(SRC_PATH_BARE)/%
154 ifeq ($(CONFIG_MSVS),yes)
155 INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/% $(p)/Release/%)
156 INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/% $(p)/Debug/%)
159 # If this is a universal (fat) binary, then all the subarchitectures have
160 # already been built and our job is to stitch them together. The
161 # BUILD_LIBVPX variable indicates whether we should be building
162 # (compiling, linking) the library. The LIPO_LIBVPX variable indicates
163 # that we're stitching.
164 $(eval $(if $(filter universal%,$(TOOLCHAIN)),LIPO_LIBVPX,BUILD_LIBVPX):=yes)
166 CODEC_SRCS-$(BUILD_LIBVPX) += build/make/version.sh
167 CODEC_SRCS-$(BUILD_LIBVPX) += build/make/rtcd.sh
168 CODEC_SRCS-$(BUILD_LIBVPX) += vpx/vpx_integer.h
169 CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/asm_offsets.h
170 CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/vpx_timer.h
171 CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/mem.h
172 CODEC_SRCS-$(BUILD_LIBVPX) += $(BUILD_PFX)vpx_config.c
173 INSTALL-SRCS-no += $(BUILD_PFX)vpx_config.c
174 ifeq ($(ARCH_X86)$(ARCH_X86_64),yes)
175 CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/emms.asm
176 CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/x86.h
177 CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/x86_abi_support.asm
178 CODEC_SRCS-$(BUILD_LIBVPX) += third_party/x86inc/x86inc.asm
179 CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/x86_cpuid.c
181 CODEC_SRCS-$(ARCH_ARM) += vpx_ports/arm_cpudetect.c
182 CODEC_SRCS-$(ARCH_ARM) += vpx_ports/arm.h
183 CODEC_EXPORTS-$(BUILD_LIBVPX) += vpx/exports_com
184 CODEC_EXPORTS-$(CONFIG_ENCODERS) += vpx/exports_enc
185 CODEC_EXPORTS-$(CONFIG_DECODERS) += vpx/exports_dec
187 INSTALL-LIBS-yes += include/vpx/vpx_codec.h
188 INSTALL-LIBS-yes += include/vpx/vpx_image.h
189 INSTALL-LIBS-yes += include/vpx/vpx_integer.h
190 INSTALL-LIBS-yes += include/vpx/vpx_codec_impl_top.h
191 INSTALL-LIBS-yes += include/vpx/vpx_codec_impl_bottom.h
192 INSTALL-LIBS-$(CONFIG_DECODERS) += include/vpx/vpx_decoder.h
193 INSTALL-LIBS-$(CONFIG_ENCODERS) += include/vpx/vpx_encoder.h
194 ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
195 ifeq ($(CONFIG_MSVS),yes)
196 INSTALL-LIBS-yes += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/$(CODEC_LIB).lib)
197 INSTALL-LIBS-$(CONFIG_DEBUG_LIBS) += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/$(CODEC_LIB)d.lib)
198 INSTALL-LIBS-$(CONFIG_SHARED) += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/vpx.dll)
199 INSTALL-LIBS-$(CONFIG_SHARED) += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/vpx.exp)
202 INSTALL-LIBS-$(CONFIG_STATIC) += $(LIBSUBDIR)/libvpx.a
203 INSTALL-LIBS-$(CONFIG_DEBUG_LIBS) += $(LIBSUBDIR)/libvpx_g.a
206 CODEC_SRCS=$(filter-out %_offsets.c,\
207 $(filter-out %_test.cc,$(call enabled,CODEC_SRCS)))
208 INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(CODEC_SRCS)
209 INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(call enabled,CODEC_EXPORTS)
212 # Generate a list of all enabled sources, in particular for exporting to gyp
213 # based build systems.
216 @echo $(CODEC_SRCS) | xargs -n1 echo | sort -u > $@
219 ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
220 ifeq ($(CONFIG_MSVS),yes)
222 obj_int_extract.vcproj: $(SRC_PATH_BARE)/build/make/obj_int_extract.c
223 @cp $(SRC_PATH_BARE)/build/x86-msvs/obj_int_extract.bat .
225 $(qexec)$(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh \
227 --target=$(TOOLCHAIN) \
228 --name=obj_int_extract \
229 --ver=$(CONFIG_VS_VERSION) \
230 --proj-guid=E1360C65-D375-4335-8057-7ED99CC3F9B2 \
231 $(if $(CONFIG_STATIC_MSVCRT),--static-crt) \
234 -I"$(SRC_PATH_BARE)" \
236 PROJECTS-$(BUILD_LIBVPX) += obj_int_extract.vcproj
237 PROJECTS-$(BUILD_LIBVPX) += obj_int_extract.bat
239 vpx.def: $(call enabled,CODEC_EXPORTS)
241 $(qexec)$(SRC_PATH_BARE)/build/make/gen_msvs_def.sh\
244 CLEAN-OBJS += vpx.def
246 vpx.vcproj: $(CODEC_SRCS) vpx.def
248 $(qexec)$(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh \
249 $(if $(CONFIG_SHARED),--dll,--lib) \
250 --target=$(TOOLCHAIN) \
251 $(if $(CONFIG_STATIC_MSVCRT),--static-crt) \
253 --proj-guid=DCE19DAF-69AC-46DB-B14A-39F0FAA5DB74 \
254 --module-def=vpx.def \
255 --ver=$(CONFIG_VS_VERSION) \
256 --out=$@ $(CFLAGS) $^ \
257 --src-path-bare="$(SRC_PATH_BARE)" \
259 PROJECTS-$(BUILD_LIBVPX) += vpx.vcproj
261 vpx.vcproj: vpx_config.asm
266 LIBVPX_OBJS=$(call objs,$(CODEC_SRCS))
267 OBJS-$(BUILD_LIBVPX) += $(LIBVPX_OBJS)
268 LIBS-$(if $(BUILD_LIBVPX),$(CONFIG_STATIC)) += $(BUILD_PFX)libvpx.a $(BUILD_PFX)libvpx_g.a
269 $(BUILD_PFX)libvpx_g.a: $(LIBVPX_OBJS)
272 BUILD_LIBVPX_SO := $(if $(BUILD_LIBVPX),$(CONFIG_SHARED))
274 ifeq ($(filter darwin%,$(TGT_OS)),$(TGT_OS))
275 LIBVPX_SO := libvpx.$(VERSION_MAJOR).dylib
276 EXPORT_FILE := libvpx.syms
277 LIBVPX_SO_SYMLINKS := $(addprefix $(LIBSUBDIR)/, \
280 LIBVPX_SO := libvpx.so.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)
281 EXPORT_FILE := libvpx.ver
282 SYM_LINK := libvpx.so
283 LIBVPX_SO_SYMLINKS := $(addprefix $(LIBSUBDIR)/, \
284 libvpx.so libvpx.so.$(VERSION_MAJOR) \
285 libvpx.so.$(VERSION_MAJOR).$(VERSION_MINOR))
288 LIBS-$(BUILD_LIBVPX_SO) += $(BUILD_PFX)$(LIBVPX_SO)\
289 $(notdir $(LIBVPX_SO_SYMLINKS))
290 $(BUILD_PFX)$(LIBVPX_SO): $(LIBVPX_OBJS) $(EXPORT_FILE)
291 $(BUILD_PFX)$(LIBVPX_SO): extralibs += -lm
292 $(BUILD_PFX)$(LIBVPX_SO): SONAME = libvpx.so.$(VERSION_MAJOR)
293 $(BUILD_PFX)$(LIBVPX_SO): EXPORTS_FILE = $(EXPORT_FILE)
295 libvpx.ver: $(call enabled,CODEC_EXPORTS)
297 $(qexec)echo "{ global:" > $@
298 $(qexec)for f in $?; do awk '{print $$2";"}' < $$f >>$@; done
299 $(qexec)echo "local: *; };" >> $@
300 CLEAN-OBJS += libvpx.ver
302 libvpx.syms: $(call enabled,CODEC_EXPORTS)
304 $(qexec)awk '{print "_"$$2}' $^ >$@
305 CLEAN-OBJS += libvpx.syms
307 define libvpx_symlink_template
309 @echo " [LN] $(2) $$@"
310 $(qexec)ln -sf $(2) $$@
313 $(eval $(call libvpx_symlink_template,\
314 $(addprefix $(BUILD_PFX),$(notdir $(LIBVPX_SO_SYMLINKS))),\
315 $(BUILD_PFX)$(LIBVPX_SO)))
316 $(eval $(call libvpx_symlink_template,\
317 $(addprefix $(DIST_DIR)/,$(LIBVPX_SO_SYMLINKS)),\
318 $(DIST_DIR)/$(LIBSUBDIR)/$(LIBVPX_SO)))
321 INSTALL-LIBS-$(BUILD_LIBVPX_SO) += $(LIBVPX_SO_SYMLINKS)
322 INSTALL-LIBS-$(BUILD_LIBVPX_SO) += $(LIBSUBDIR)/$(LIBVPX_SO)
325 LIBS-$(BUILD_LIBVPX) += vpx.pc
326 vpx.pc: config.mk libs.mk
328 $(qexec)echo '# pkg-config file from libvpx $(VERSION_STRING)' > $@
329 $(qexec)echo 'prefix=$(PREFIX)' >> $@
330 $(qexec)echo 'exec_prefix=$${prefix}' >> $@
331 $(qexec)echo 'libdir=$${prefix}/$(LIBSUBDIR)' >> $@
332 $(qexec)echo 'includedir=$${prefix}/include' >> $@
333 $(qexec)echo '' >> $@
334 $(qexec)echo 'Name: vpx' >> $@
335 $(qexec)echo 'Description: WebM Project VPx codec implementation' >> $@
336 $(qexec)echo 'Version: $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)' >> $@
337 $(qexec)echo 'Requires:' >> $@
338 $(qexec)echo 'Conflicts:' >> $@
339 $(qexec)echo 'Libs: -L$${libdir} -lvpx -lm' >> $@
340 $(qexec)echo 'Libs.private: -lm -lpthread' >> $@
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
379 CODEC_DOC_SRCS += vpx/vpx_codec.h \
385 ## libvpx test directives
387 ifeq ($(CONFIG_UNIT_TESTS),yes)
388 LIBVPX_TEST_DATA_PATH ?= .
390 include $(SRC_PATH_BARE)/test/test.mk
391 LIBVPX_TEST_SRCS=$(addprefix test/,$(call enabled,LIBVPX_TEST_SRCS))
392 ifeq ($(CONFIG_VP8_DECODER),yes)
393 LIBVPX_TEST_SRCS += md5_utils.h md5_utils.c
395 LIBVPX_TEST_BINS=./test_libvpx
396 LIBVPX_TEST_DATA=$(addprefix $(LIBVPX_TEST_DATA_PATH)/,\
397 $(call enabled,LIBVPX_TEST_DATA))
398 libvpx_test_data_url=http://downloads.webmproject.org/test_data/libvpx/$(1)
401 @echo " [DOWNLOAD] $@"
402 $(qexec)trap 'rm -f $@' INT TERM &&\
403 curl -L -o $@ $(call libvpx_test_data_url,$(@F))
405 testdata:: $(LIBVPX_TEST_DATA)
406 $(qexec)if [ -x "$$(which sha1sum)" ]; then\
407 echo "Checking test data:";\
408 if [ -n "$(LIBVPX_TEST_DATA)" ]; then\
409 for f in $(call enabled,LIBVPX_TEST_DATA); do\
410 grep $$f $(SRC_PATH_BARE)/test/test-data.sha1 |\
411 (cd $(LIBVPX_TEST_DATA_PATH); sha1sum -c);\
415 echo "Skipping test data integrity check, sha1sum not found.";\
418 ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
419 ifeq ($(CONFIG_MSVS),yes)
421 gtest.vcproj: $(SRC_PATH_BARE)/third_party/googletest/src/src/gtest-all.cc
423 $(qexec)$(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh \
425 --target=$(TOOLCHAIN) \
426 $(if $(CONFIG_STATIC_MSVCRT),--static-crt) \
428 --proj-guid=EC00E1EC-AF68-4D92-A255-181690D1C9B1 \
429 --ver=$(CONFIG_VS_VERSION) \
430 --src-path-bare="$(SRC_PATH_BARE)" \
431 --out=gtest.vcproj $(SRC_PATH_BARE)/third_party/googletest/src/src/gtest-all.cc \
432 -I. -I"$(SRC_PATH_BARE)/third_party/googletest/src/include" -I"$(SRC_PATH_BARE)/third_party/googletest/src"
434 PROJECTS-$(CONFIG_MSVS) += gtest.vcproj
436 test_libvpx.vcproj: $(LIBVPX_TEST_SRCS)
438 $(qexec)$(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh \
440 --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) -lwinmm -l$(GTEST_LIB) $^
449 PROJECTS-$(CONFIG_MSVS) += test_libvpx.vcproj
452 @set -e; for t in $(addprefix Win32/Release/,$(notdir $(LIBVPX_TEST_BINS:.cc=.exe))); do $$t; done
456 include $(SRC_PATH_BARE)/third_party/googletest/gtest.mk
457 GTEST_SRCS := $(addprefix third_party/googletest/src/,$(call enabled,GTEST_SRCS))
458 GTEST_OBJS=$(call objs,$(GTEST_SRCS))
459 $(GTEST_OBJS) $(GTEST_OBJS:.o=.d): CXXFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src
460 $(GTEST_OBJS) $(GTEST_OBJS:.o=.d): CXXFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src/include
461 OBJS-$(BUILD_LIBVPX) += $(GTEST_OBJS)
462 LIBS-$(BUILD_LIBVPX) += $(BUILD_PFX)libgtest.a $(BUILD_PFX)libgtest_g.a
463 $(BUILD_PFX)libgtest_g.a: $(GTEST_OBJS)
465 LIBVPX_TEST_OBJS=$(sort $(call objs,$(LIBVPX_TEST_SRCS)))
466 $(LIBVPX_TEST_OBJS) $(LIBVPX_TEST_OBJS:.o=.d): CXXFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src
467 $(LIBVPX_TEST_OBJS) $(LIBVPX_TEST_OBJS:.o=.d): CXXFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src/include
468 OBJS-$(BUILD_LIBVPX) += $(LIBVPX_TEST_OBJS)
469 BINS-$(BUILD_LIBVPX) += $(LIBVPX_TEST_BINS)
471 # Install test sources only if codec source is included
472 INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(patsubst $(SRC_PATH_BARE)/%,%,\
473 $(shell find $(SRC_PATH_BARE)/third_party/googletest -type f))
474 INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(LIBVPX_TEST_SRCS)
476 CODEC_LIB=$(if $(CONFIG_DEBUG_LIBS),vpx_g,vpx)
477 CODEC_LIB_SUF=$(if $(CONFIG_SHARED),.so,.a)
478 $(foreach bin,$(LIBVPX_TEST_BINS),\
479 $(if $(BUILD_LIBVPX),$(eval $(bin): \
480 lib$(CODEC_LIB)$(CODEC_LIB_SUF) libgtest.a ))\
481 $(if $(BUILD_LIBVPX),$(eval $(call linkerxx_template,$(bin),\
482 $(LIBVPX_TEST_OBJS) \
483 -L. -lvpx -lgtest -lpthread -lm)\
485 $(if $(LIPO_LIBS),$(eval $(call lipo_bin_template,$(bin))))\
487 test:: $(LIBVPX_TEST_BINS) testdata
488 @set -e; for t in $(LIBVPX_TEST_BINS); do $$t; done
494 ## documentation directives
496 CLEAN-OBJS += libs.doxy
497 DOCS-yes += libs.doxy
498 libs.doxy: $(CODEC_DOC_SRCS)
501 @echo "INPUT += $^" >> $@
502 @echo "PREDEFINED = VPX_CODEC_DISABLE_COMPAT" >> $@
503 @echo "INCLUDE_PATH += ." >> $@;
504 @echo "ENABLED_SECTIONS += $(sort $(CODEC_DOC_SECTIONS))" >> $@
506 ## Generate rtcd.h for all objects
507 $(OBJS-yes:.o=.d): $(RTCD)
509 ## Update the global src list
510 SRCS += $(CODEC_SRCS) $(LIBVPX_TEST_SRCS) $(GTEST_SRCS)