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