examples.mk revision 1184aebb761cbeac9124c37189a80a1a58f04b6b
1ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann##
2ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann##  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann##
4ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann##  Use of this source code is governed by a BSD-style license
5ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann##  that can be found in the LICENSE file in the root of the source
6ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann##  tree. An additional intellectual property rights grant can be found
7ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann##  in the file PATENTS.  All contributing project authors may
8ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann##  be found in the AUTHORS file in the root of the source tree.
9ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann##
10ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann
11ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannLIBYUV_SRCS +=  third_party/libyuv/include/libyuv/basic_types.h  \
12ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann                third_party/libyuv/include/libyuv/cpu_id.h  \
13ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann                third_party/libyuv/include/libyuv/scale.h  \
14ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann                third_party/libyuv/source/row.h \
15ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann                third_party/libyuv/source/scale.c  \
16ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann                third_party/libyuv/source/cpu_id.c
17ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann
18ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann# List of examples to build. UTILS are files that are taken from the source
19ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann# tree directly, and GEN_EXAMPLES are files that are created from the
20ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann# examples folder.
21ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannUTILS-$(CONFIG_DECODERS)    += vpxdec.c
22ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannvpxdec.SRCS                 += md5_utils.c md5_utils.h
23ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannvpxdec.SRCS                 += vpx_ports/vpx_timer.h
24ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannvpxdec.SRCS                 += vpx/vpx_integer.h
25ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannvpxdec.SRCS                 += args.c args.h
26ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannvpxdec.SRCS                 += tools_common.c tools_common.h
27ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannvpxdec.SRCS                 += nestegg/halloc/halloc.h
28ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannvpxdec.SRCS                 += nestegg/halloc/src/align.h
29ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannvpxdec.SRCS                 += nestegg/halloc/src/halloc.c
30ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannvpxdec.SRCS                 += nestegg/halloc/src/hlist.h
31ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannvpxdec.SRCS                 += nestegg/halloc/src/macros.h
32ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannvpxdec.SRCS                 += nestegg/include/nestegg/nestegg.h
33ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannvpxdec.SRCS                 += nestegg/src/nestegg.c
34ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannvpxdec.SRCS                 += $(LIBYUV_SRCS)
35ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannvpxdec.GUID                  = BA5FE66F-38DD-E034-F542-B1578C5FB950
36ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannvpxdec.DESCRIPTION           = Full featured decoder
37ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannUTILS-$(CONFIG_ENCODERS)    += vpxenc.c
38ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannvpxenc.SRCS                 += args.c args.h y4minput.c y4minput.h
39ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannvpxenc.SRCS                 += tools_common.c tools_common.h
40ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannvpxenc.SRCS                 += vpx_ports/mem_ops.h
41ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannvpxenc.SRCS                 += vpx_ports/mem_ops_aligned.h
42ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannvpxenc.SRCS                 += vpx_ports/vpx_timer.h
43ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannvpxenc.SRCS                 += libmkv/EbmlIDs.h
44ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannvpxenc.SRCS                 += libmkv/EbmlWriter.c
45ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannvpxenc.SRCS                 += libmkv/EbmlWriter.h
46ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannvpxenc.SRCS                 += $(LIBYUV_SRCS)
47ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannvpxenc.GUID                  = 548DEC74-7A15-4B2B-AFC3-AA102E7C25C1
48ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannvpxenc.DESCRIPTION           = Full featured encoder
49ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannUTILS-$(CONFIG_VP8_ENCODER)    += vp8_scalable_patterns.c
50ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannvp8_scalable_patterns.GUID   = 0D6A210B-F482-4D6F-8570-4A9C01ACC88C
51ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannvp8_scalable_patterns.DESCRIPTION = Temporal Scalability Encoder
52ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannUTILS-$(CONFIG_VP8_ENCODER)    += vp9_spatial_scalable_encoder.c
53ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannvp8_scalable_patterns.GUID   = 4A38598D-627D-4505-9C7B-D4020C84100D
54ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannvp8_scalable_patterns.DESCRIPTION = Spatial Scalable Encoder
55ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann
56ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann# Clean up old ivfenc, ivfdec binaries.
57ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannifeq ($(CONFIG_MSVS),yes)
58ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannCLEAN-OBJS += $(foreach p,$(VS_PLATFORMS),$(p)/Release/ivfenc.exe)
59ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannCLEAN-OBJS += $(foreach p,$(VS_PLATFORMS),$(p)/Release/ivfdec.exe)
60ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannelse
61ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannCLEAN-OBJS += ivfenc{.c.o,.c.d,.dox,.exe,}
62ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannCLEAN-OBJS += ivfdec{.c.o,.c.d,.dox,.exe,}
63ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannendif
64ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann
65ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann# XMA example disabled for now, not used in VP8
66ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#UTILS-$(CONFIG_DECODERS)    += example_xma.c
67ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#example_xma.GUID             = A955FC4A-73F1-44F7-135E-30D84D32F022
68ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#example_xma.DESCRIPTION      = External Memory Allocation mode usage
69ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann
70ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannGEN_EXAMPLES-$(CONFIG_VP8_DECODER) += simple_decoder.c
71ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannsimple_decoder.GUID              = D3BBF1E9-2427-450D-BBFF-B2843C1D44CC
72ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannsimple_decoder.DESCRIPTION       = Simplified decoder loop
73ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannGEN_EXAMPLES-$(CONFIG_VP8_DECODER) += postproc.c
74ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannpostproc.GUID                    = 65E33355-F35E-4088-884D-3FD4905881D7
75ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannpostproc.DESCRIPTION             = Decoder postprocessor control
76ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannGEN_EXAMPLES-$(CONFIG_VP8_DECODER) += decode_to_md5.c
77ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanndecode_to_md5.SRCS              += md5_utils.h md5_utils.c
78ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanndecode_to_md5.GUID               = 59120B9B-2735-4BFE-B022-146CA340FE42
79ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanndecode_to_md5.DESCRIPTION        = Frame by frame MD5 checksum
80ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann
81ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannGEN_EXAMPLES-$(CONFIG_VP8_ENCODER) += simple_encoder.c
82ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannsimple_encoder.GUID              = 4607D299-8A71-4D2C-9B1D-071899B6FBFD
83ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannsimple_encoder.DESCRIPTION       = Simplified encoder loop
84ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannGEN_EXAMPLES-$(CONFIG_VP8_ENCODER) += twopass_encoder.c
85ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntwopass_encoder.GUID             = 73494FA6-4AF9-4763-8FBB-265C92402FD8
86ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntwopass_encoder.DESCRIPTION      = Two-pass encoder loop
87ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannGEN_EXAMPLES-$(CONFIG_VP8_ENCODER) += force_keyframe.c
88ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannforce_keyframe.GUID              = 3C67CADF-029F-4C86-81F5-D6D4F51177F0
89ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannforce_keyframe.DESCRIPTION       = Force generation of keyframes
90ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannifeq ($(CONFIG_DECODERS),yes)
91ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannGEN_EXAMPLES-$(CONFIG_VP8_ENCODER) += decode_with_drops.c
92ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannendif
93ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanndecode_with_drops.GUID           = CE5C53C4-8DDA-438A-86ED-0DDD3CDB8D26
94ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanndecode_with_drops.DESCRIPTION    = Drops frames while decoding
95ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannifeq ($(CONFIG_VP8_DECODER),yes)
96ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannGEN_EXAMPLES-$(CONFIG_ERROR_CONCEALMENT) += decode_with_partial_drops.c
97ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannendif
98ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanndecode_with_partial_drops.GUID           = 61C2D026-5754-46AC-916F-1343ECC5537E
99ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanndecode_with_partial_drops.DESCRIPTION    = Drops parts of frames while decoding
100ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannGEN_EXAMPLES-$(CONFIG_VP8_ENCODER) += error_resilient.c
101ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannerror_resilient.GUID             = DF5837B9-4145-4F92-A031-44E4F832E00C
102ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannerror_resilient.DESCRIPTION      = Error Resiliency Feature
103ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann
104ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannGEN_EXAMPLES-$(CONFIG_VP8_ENCODER) += vp8_set_maps.c
105ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannvp8_set_maps.GUID                   = ECB2D24D-98B8-4015-A465-A4AF3DCC145F
106ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannvp8_set_maps.DESCRIPTION            = VP8 set active and ROI maps
107ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannGEN_EXAMPLES-$(CONFIG_VP8_ENCODER) += vp8cx_set_ref.c
108ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannvp8cx_set_ref.GUID                  = C5E31F7F-96F6-48BD-BD3E-10EBF6E8057A
109ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannvp8cx_set_ref.DESCRIPTION           = VP8 set encoder reference frame
110ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann
111ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann# C file is provided, not generated automatically.
112UTILS-$(CONFIG_MULTI_RES_ENCODING) += vp8_multi_resolution_encoder.c
113vp8_multi_resolution_encoder.SRCS         += $(LIBYUV_SRCS)
114vp8_multi_resolution_encoder.GUID         = 04f8738e-63c8-423b-90fa-7c2703a374de
115vp8_multi_resolution_encoder.DESCRIPTION  = VP8 Multiple-resolution Encoding
116
117# Handle extra library flags depending on codec configuration
118
119# We should not link to math library (libm) on RVCT
120# when building for bare-metal targets
121ifeq ($(CONFIG_OS_SUPPORT), yes)
122CODEC_EXTRA_LIBS-$(CONFIG_VP8)         += m
123CODEC_EXTRA_LIBS-$(CONFIG_VP9)         += m
124else
125    ifeq ($(CONFIG_GCC), yes)
126    CODEC_EXTRA_LIBS-$(CONFIG_VP8)         += m
127    CODEC_EXTRA_LIBS-$(CONFIG_VP9)         += m
128    endif
129endif
130#
131# End of specified files. The rest of the build rules should happen
132# automagically from here.
133#
134
135
136# Examples need different flags based on whether we're building
137# from an installed tree or a version controlled tree. Determine
138# the proper paths.
139ifeq ($(HAVE_ALT_TREE_LAYOUT),yes)
140    LIB_PATH := $(SRC_PATH_BARE)/../lib
141    INC_PATH := $(SRC_PATH_BARE)/../include
142else
143    LIB_PATH-yes                     += $(if $(BUILD_PFX),$(BUILD_PFX),.)
144    INC_PATH-$(CONFIG_VP8_DECODER)   += $(SRC_PATH_BARE)/vp8
145    INC_PATH-$(CONFIG_VP8_ENCODER)   += $(SRC_PATH_BARE)/vp8
146    INC_PATH-$(CONFIG_VP9_DECODER)   += $(SRC_PATH_BARE)/vp9
147    INC_PATH-$(CONFIG_VP9_ENCODER)   += $(SRC_PATH_BARE)/vp9
148    LIB_PATH := $(call enabled,LIB_PATH)
149    INC_PATH := $(call enabled,INC_PATH)
150endif
151INTERNAL_CFLAGS = $(addprefix -I,$(INC_PATH))
152INTERNAL_LDFLAGS += $(addprefix -L,$(LIB_PATH))
153
154
155# Expand list of selected examples to build (as specified above)
156UTILS           = $(call enabled,UTILS)
157GEN_EXAMPLES    = $(call enabled,GEN_EXAMPLES)
158ALL_EXAMPLES    = $(UTILS) $(GEN_EXAMPLES)
159UTIL_SRCS       = $(foreach ex,$(UTILS),$($(ex:.c=).SRCS))
160ALL_SRCS        = $(foreach ex,$(ALL_EXAMPLES),$($(ex:.c=).SRCS))
161CODEC_EXTRA_LIBS=$(sort $(call enabled,CODEC_EXTRA_LIBS))
162
163
164# Expand all example sources into a variable containing all sources
165# for that example (not just them main one specified in UTILS/GEN_EXAMPLES)
166# and add this file to the list (for MSVS workspace generation)
167$(foreach ex,$(ALL_EXAMPLES),$(eval $(ex:.c=).SRCS += $(ex) examples.mk))
168
169
170# If this is a universal (fat) binary, then all the subarchitectures have
171# already been built and our job is to stitch them together. The
172# BUILD_OBJS variable indicates whether we should be building
173# (compiling, linking) the library. The LIPO_OBJS variable indicates
174# that we're stitching.
175$(eval $(if $(filter universal%,$(TOOLCHAIN)),LIPO_OBJS,BUILD_OBJS):=yes)
176
177
178# Create build/install dependencies for all examples. The common case
179# is handled here. The MSVS case is handled below.
180NOT_MSVS = $(if $(CONFIG_MSVS),,yes)
181DIST-BINS-$(NOT_MSVS)      += $(addprefix bin/,$(ALL_EXAMPLES:.c=$(EXE_SFX)))
182INSTALL-BINS-$(NOT_MSVS)   += $(addprefix bin/,$(UTILS:.c=$(EXE_SFX)))
183DIST-SRCS-yes              += $(ALL_SRCS)
184INSTALL-SRCS-yes           += $(UTIL_SRCS)
185OBJS-$(NOT_MSVS)           += $(if $(BUILD_OBJS),$(call objs,$(ALL_SRCS)))
186BINS-$(NOT_MSVS)           += $(addprefix $(BUILD_PFX),$(ALL_EXAMPLES:.c=$(EXE_SFX)))
187
188
189# Instantiate linker template for all examples.
190CODEC_LIB=$(if $(CONFIG_DEBUG_LIBS),vpx_g,vpx)
191SHARED_LIB_SUF=$(if $(filter darwin%,$(TGT_OS)),.dylib,.so)
192CODEC_LIB_SUF=$(if $(CONFIG_SHARED),$(SHARED_LIB_SUF),.a)
193$(foreach bin,$(BINS-yes),\
194    $(if $(BUILD_OBJS),$(eval $(bin):\
195        $(LIB_PATH)/lib$(CODEC_LIB)$(CODEC_LIB_SUF)))\
196    $(if $(BUILD_OBJS),$(eval $(call linker_template,$(bin),\
197        $(call objs,$($(notdir $(bin:$(EXE_SFX)=)).SRCS)) \
198        -l$(CODEC_LIB) $(addprefix -l,$(CODEC_EXTRA_LIBS))\
199        )))\
200    $(if $(LIPO_OBJS),$(eval $(call lipo_bin_template,$(bin))))\
201    )
202
203
204# Rules to generate the GEN_EXAMPLES sources
205.PRECIOUS: %.c
206CLEAN-OBJS += $(GEN_EXAMPLES)
207%.c: examples/%.txt
208	@echo "    [EXAMPLE] $@"
209	@$(SRC_PATH_BARE)/examples/gen_example_code.sh $< > $@
210
211
212# The following pairs define a mapping of locations in the distribution
213# tree to locations in the source/build trees.
214INSTALL_MAPS += src/%.c   %.c
215INSTALL_MAPS += src/%     $(SRC_PATH_BARE)/%
216INSTALL_MAPS += bin/%     %
217INSTALL_MAPS += %         %
218
219
220# Set up additional MSVS environment
221ifeq ($(CONFIG_MSVS),yes)
222CODEC_LIB=$(if $(CONFIG_SHARED),vpx,$(if $(CONFIG_STATIC_MSVCRT),vpxmt,vpxmd))
223# This variable uses deferred expansion intentionally, since the results of
224# $(wildcard) may change during the course of the Make.
225VS_PLATFORMS = $(foreach d,$(wildcard */Release/$(CODEC_LIB).lib),$(word 1,$(subst /, ,$(d))))
226INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),bin/$(p)/%  $(p)/Release/%)
227endif
228
229# Build Visual Studio Projects. We use a template here to instantiate
230# explicit rules rather than using an implicit rule because we want to
231# leverage make's VPATH searching rather than specifying the paths on
232# each file in ALL_EXAMPLES. This has the unfortunate side effect that
233# touching the source files trigger a rebuild of the project files
234# even though there is no real dependency there (the dependency is on
235# the makefiles). We may want to revisit this.
236define vcproj_template
237$(1): $($(1:.$(VCPROJ_SFX)=).SRCS) vpx.$(VCPROJ_SFX)
238	@echo "    [vcproj] $$@"
239	$$(GEN_VCPROJ)\
240            --exe\
241            --target=$$(TOOLCHAIN)\
242            --name=$$(@:.$(VCPROJ_SFX)=)\
243            --ver=$$(CONFIG_VS_VERSION)\
244            --proj-guid=$$($$(@:.$(VCPROJ_SFX)=).GUID)\
245            $$(if $$(CONFIG_STATIC_MSVCRT),--static-crt) \
246            --out=$$@ $$(INTERNAL_CFLAGS) $$(CFLAGS) \
247            $$(INTERNAL_LDFLAGS) $$(LDFLAGS) -l$$(CODEC_LIB) $$^
248endef
249PROJECTS-$(CONFIG_MSVS) += $(ALL_EXAMPLES:.c=.$(VCPROJ_SFX))
250INSTALL-BINS-$(CONFIG_MSVS) += $(foreach p,$(VS_PLATFORMS),\
251                               $(addprefix bin/$(p)/,$(ALL_EXAMPLES:.c=.exe)))
252$(foreach proj,$(call enabled,PROJECTS),\
253    $(eval $(call vcproj_template,$(proj))))
254
255
256
257#
258# Documentation Rules
259#
260%.dox: examples/%.txt
261	@echo "    [DOXY] $@"
262	@$(SRC_PATH_BARE)/examples/gen_example_text.sh $< | \
263         $(SRC_PATH_BARE)/examples/gen_example_doxy.php \
264             example_$(@:.dox=)  $(@:.dox=.c) > $@
265
266%.dox: %.c
267	@echo "    [DOXY] $@"
268	@echo "/*!\page example_$(@:.dox=) $(@:.dox=)" > $@
269	@echo "   \includelineno $(notdir $<)" >> $@
270	@echo "*/" >> $@
271
272samples.dox: examples.mk
273	@echo "    [DOXY] $@"
274	@echo "/*!\page samples Sample Code" > $@
275	@echo "    This SDK includes a number of sample applications."\
276	      "each sample documents a feature of the SDK in both prose"\
277	      "and the associated C code. In general, later samples"\
278	      "build upon prior samples, so it is best to work through the"\
279	      "list in order. The following samples are included: ">>$@
280	@$(foreach ex,$(GEN_EXAMPLES:.c=),\
281	   echo "     - \subpage example_$(ex) $($(ex).DESCRIPTION)" >> $@;)
282	@echo >> $@
283	@echo "    In addition, the SDK contains a number of utilities."\
284              "Since these utilities are built upon the concepts described"\
285              "in the sample code listed above, they are not documented in"\
286              "pieces like the samples are. Thir sourcre is included here"\
287              "for reference. The following utilities are included:" >> $@
288	@$(foreach ex,$(UTILS:.c=),\
289	   echo "     - \subpage example_$(ex) $($(ex).DESCRIPTION)" >> $@;)
290	@echo "*/" >> $@
291
292CLEAN-OBJS += examples.doxy samples.dox $(ALL_EXAMPLES:.c=.dox)
293DOCS-yes += examples.doxy samples.dox $(ALL_EXAMPLES:.c=.dox)
294examples.doxy: samples.dox $(ALL_EXAMPLES:.c=.dox)
295	@echo "INPUT += $^" > $@
296