Merge "Improve rd_variance_adjustment() for low variance blocks."
[platform/upstream/libvpx.git] / examples.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 LIBYUV_SRCS +=  third_party/libyuv/include/libyuv/basic_types.h  \
12                 third_party/libyuv/include/libyuv/convert.h \
13                 third_party/libyuv/include/libyuv/convert_argb.h \
14                 third_party/libyuv/include/libyuv/convert_from.h \
15                 third_party/libyuv/include/libyuv/cpu_id.h  \
16                 third_party/libyuv/include/libyuv/planar_functions.h  \
17                 third_party/libyuv/include/libyuv/rotate.h  \
18                 third_party/libyuv/include/libyuv/row.h  \
19                 third_party/libyuv/include/libyuv/scale.h  \
20                 third_party/libyuv/include/libyuv/scale_row.h  \
21                 third_party/libyuv/source/cpu_id.cc \
22                 third_party/libyuv/source/planar_functions.cc \
23                 third_party/libyuv/source/row_any.cc \
24                 third_party/libyuv/source/row_common.cc \
25                 third_party/libyuv/source/row_gcc.cc \
26                 third_party/libyuv/source/row_msa.cc \
27                 third_party/libyuv/source/row_neon.cc \
28                 third_party/libyuv/source/row_neon64.cc \
29                 third_party/libyuv/source/row_win.cc \
30                 third_party/libyuv/source/scale.cc \
31                 third_party/libyuv/source/scale_any.cc \
32                 third_party/libyuv/source/scale_common.cc \
33                 third_party/libyuv/source/scale_gcc.cc \
34                 third_party/libyuv/source/scale_msa.cc \
35                 third_party/libyuv/source/scale_neon.cc \
36                 third_party/libyuv/source/scale_neon64.cc \
37                 third_party/libyuv/source/scale_win.cc \
38
39 LIBWEBM_COMMON_SRCS += third_party/libwebm/common/hdr_util.cc \
40                        third_party/libwebm/common/hdr_util.h \
41                        third_party/libwebm/common/webmids.h
42
43 LIBWEBM_MUXER_SRCS += third_party/libwebm/mkvmuxer/mkvmuxer.cc \
44                       third_party/libwebm/mkvmuxer/mkvmuxerutil.cc \
45                       third_party/libwebm/mkvmuxer/mkvwriter.cc \
46                       third_party/libwebm/mkvmuxer/mkvmuxer.h \
47                       third_party/libwebm/mkvmuxer/mkvmuxertypes.h \
48                       third_party/libwebm/mkvmuxer/mkvmuxerutil.h \
49                       third_party/libwebm/mkvparser/mkvparser.h \
50                       third_party/libwebm/mkvmuxer/mkvwriter.h
51
52 LIBWEBM_PARSER_SRCS = third_party/libwebm/mkvparser/mkvparser.cc \
53                       third_party/libwebm/mkvparser/mkvreader.cc \
54                       third_party/libwebm/mkvparser/mkvparser.h \
55                       third_party/libwebm/mkvparser/mkvreader.h
56
57 # Add compile flags and include path for libwebm sources.
58 ifeq ($(CONFIG_WEBM_IO),yes)
59   CXXFLAGS     += -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS
60   INC_PATH-yes += $(SRC_PATH_BARE)/third_party/libwebm
61 endif
62
63
64 # List of examples to build. UTILS are tools meant for distribution
65 # while EXAMPLES demonstrate specific portions of the API.
66 UTILS-$(CONFIG_DECODERS)    += vpxdec.c
67 vpxdec.SRCS                 += md5_utils.c md5_utils.h
68 vpxdec.SRCS                 += vpx_ports/mem_ops.h
69 vpxdec.SRCS                 += vpx_ports/mem_ops_aligned.h
70 vpxdec.SRCS                 += vpx_ports/msvc.h
71 vpxdec.SRCS                 += vpx_ports/vpx_timer.h
72 vpxdec.SRCS                 += vpx/vpx_integer.h
73 vpxdec.SRCS                 += args.c args.h
74 vpxdec.SRCS                 += ivfdec.c ivfdec.h
75 vpxdec.SRCS                 += tools_common.c tools_common.h
76 vpxdec.SRCS                 += y4menc.c y4menc.h
77 ifeq ($(CONFIG_LIBYUV),yes)
78   vpxdec.SRCS                 += $(LIBYUV_SRCS)
79   $(BUILD_PFX)third_party/libyuv/%.cc.o: CXXFLAGS += -Wno-unused-parameter
80 endif
81 ifeq ($(CONFIG_WEBM_IO),yes)
82   vpxdec.SRCS                 += $(LIBWEBM_COMMON_SRCS)
83   vpxdec.SRCS                 += $(LIBWEBM_MUXER_SRCS)
84   vpxdec.SRCS                 += $(LIBWEBM_PARSER_SRCS)
85   vpxdec.SRCS                 += webmdec.cc webmdec.h
86 endif
87 vpxdec.GUID                  = BA5FE66F-38DD-E034-F542-B1578C5FB950
88 vpxdec.DESCRIPTION           = Full featured decoder
89 UTILS-$(CONFIG_ENCODERS)    += vpxenc.c
90 vpxenc.SRCS                 += args.c args.h y4minput.c y4minput.h vpxenc.h
91 vpxenc.SRCS                 += ivfdec.c ivfdec.h
92 vpxenc.SRCS                 += ivfenc.c ivfenc.h
93 vpxenc.SRCS                 += rate_hist.c rate_hist.h
94 vpxenc.SRCS                 += tools_common.c tools_common.h
95 vpxenc.SRCS                 += warnings.c warnings.h
96 vpxenc.SRCS                 += vpx_ports/mem_ops.h
97 vpxenc.SRCS                 += vpx_ports/mem_ops_aligned.h
98 vpxenc.SRCS                 += vpx_ports/msvc.h
99 vpxenc.SRCS                 += vpx_ports/vpx_timer.h
100 vpxenc.SRCS                 += vpxstats.c vpxstats.h
101 ifeq ($(CONFIG_LIBYUV),yes)
102   vpxenc.SRCS                 += $(LIBYUV_SRCS)
103 endif
104 ifeq ($(CONFIG_WEBM_IO),yes)
105   vpxenc.SRCS                 += $(LIBWEBM_COMMON_SRCS)
106   vpxenc.SRCS                 += $(LIBWEBM_MUXER_SRCS)
107   vpxenc.SRCS                 += $(LIBWEBM_PARSER_SRCS)
108   vpxenc.SRCS                 += webmenc.cc webmenc.h
109 endif
110 vpxenc.GUID                  = 548DEC74-7A15-4B2B-AFC3-AA102E7C25C1
111 vpxenc.DESCRIPTION           = Full featured encoder
112
113 EXAMPLES-$(CONFIG_VP9_ENCODER)      += vp9_spatial_svc_encoder.c
114 vp9_spatial_svc_encoder.SRCS        += args.c args.h
115 vp9_spatial_svc_encoder.SRCS        += ivfenc.c ivfenc.h
116 vp9_spatial_svc_encoder.SRCS        += tools_common.c tools_common.h
117 vp9_spatial_svc_encoder.SRCS        += video_common.h
118 vp9_spatial_svc_encoder.SRCS        += video_writer.h video_writer.c
119 vp9_spatial_svc_encoder.SRCS        += vpx_ports/msvc.h
120 vp9_spatial_svc_encoder.SRCS        += vpxstats.c vpxstats.h
121 vp9_spatial_svc_encoder.SRCS        += examples/svc_encodeframe.c
122 vp9_spatial_svc_encoder.SRCS        += examples/svc_context.h
123 vp9_spatial_svc_encoder.GUID        = 4A38598D-627D-4505-9C7B-D4020C84100D
124 vp9_spatial_svc_encoder.DESCRIPTION = VP9 Spatial SVC Encoder
125
126 ifneq ($(CONFIG_SHARED),yes)
127 EXAMPLES-$(CONFIG_VP9_ENCODER)    += resize_util.c
128 endif
129
130 EXAMPLES-$(CONFIG_ENCODERS)          += vpx_temporal_svc_encoder.c
131 vpx_temporal_svc_encoder.SRCS        += ivfenc.c ivfenc.h
132 vpx_temporal_svc_encoder.SRCS        += tools_common.c tools_common.h
133 vpx_temporal_svc_encoder.SRCS        += video_common.h
134 vpx_temporal_svc_encoder.SRCS        += video_writer.h video_writer.c
135 vpx_temporal_svc_encoder.SRCS        += vpx_ports/msvc.h
136 vpx_temporal_svc_encoder.GUID        = B18C08F2-A439-4502-A78E-849BE3D60947
137 vpx_temporal_svc_encoder.DESCRIPTION = Temporal SVC Encoder
138 EXAMPLES-$(CONFIG_DECODERS)        += simple_decoder.c
139 simple_decoder.GUID                 = D3BBF1E9-2427-450D-BBFF-B2843C1D44CC
140 simple_decoder.SRCS                += ivfdec.h ivfdec.c
141 simple_decoder.SRCS                += tools_common.h tools_common.c
142 simple_decoder.SRCS                += video_common.h
143 simple_decoder.SRCS                += video_reader.h video_reader.c
144 simple_decoder.SRCS                += vpx_ports/mem_ops.h
145 simple_decoder.SRCS                += vpx_ports/mem_ops_aligned.h
146 simple_decoder.SRCS                += vpx_ports/msvc.h
147 simple_decoder.DESCRIPTION          = Simplified decoder loop
148 EXAMPLES-$(CONFIG_DECODERS)        += postproc.c
149 postproc.SRCS                      += ivfdec.h ivfdec.c
150 postproc.SRCS                      += tools_common.h tools_common.c
151 postproc.SRCS                      += video_common.h
152 postproc.SRCS                      += video_reader.h video_reader.c
153 postproc.SRCS                      += vpx_ports/mem_ops.h
154 postproc.SRCS                      += vpx_ports/mem_ops_aligned.h
155 postproc.SRCS                      += vpx_ports/msvc.h
156 postproc.GUID                       = 65E33355-F35E-4088-884D-3FD4905881D7
157 postproc.DESCRIPTION                = Decoder postprocessor control
158 EXAMPLES-$(CONFIG_DECODERS)        += decode_to_md5.c
159 decode_to_md5.SRCS                 += md5_utils.h md5_utils.c
160 decode_to_md5.SRCS                 += ivfdec.h ivfdec.c
161 decode_to_md5.SRCS                 += tools_common.h tools_common.c
162 decode_to_md5.SRCS                 += video_common.h
163 decode_to_md5.SRCS                 += video_reader.h video_reader.c
164 decode_to_md5.SRCS                 += vpx_ports/mem_ops.h
165 decode_to_md5.SRCS                 += vpx_ports/mem_ops_aligned.h
166 decode_to_md5.SRCS                 += vpx_ports/msvc.h
167 decode_to_md5.GUID                  = 59120B9B-2735-4BFE-B022-146CA340FE42
168 decode_to_md5.DESCRIPTION           = Frame by frame MD5 checksum
169 EXAMPLES-$(CONFIG_ENCODERS)     += simple_encoder.c
170 simple_encoder.SRCS             += ivfenc.h ivfenc.c
171 simple_encoder.SRCS             += tools_common.h tools_common.c
172 simple_encoder.SRCS             += video_common.h
173 simple_encoder.SRCS             += video_writer.h video_writer.c
174 simple_encoder.SRCS             += vpx_ports/msvc.h
175 simple_encoder.GUID              = 4607D299-8A71-4D2C-9B1D-071899B6FBFD
176 simple_encoder.DESCRIPTION       = Simplified encoder loop
177 EXAMPLES-$(CONFIG_VP9_ENCODER)  += vp9_lossless_encoder.c
178 vp9_lossless_encoder.SRCS       += ivfenc.h ivfenc.c
179 vp9_lossless_encoder.SRCS       += tools_common.h tools_common.c
180 vp9_lossless_encoder.SRCS       += video_common.h
181 vp9_lossless_encoder.SRCS       += video_writer.h video_writer.c
182 vp9_lossless_encoder.SRCS       += vpx_ports/msvc.h
183 vp9_lossless_encoder.GUID        = B63C7C88-5348-46DC-A5A6-CC151EF93366
184 vp9_lossless_encoder.DESCRIPTION = Simplified lossless VP9 encoder
185 EXAMPLES-$(CONFIG_ENCODERS)     += twopass_encoder.c
186 twopass_encoder.SRCS            += ivfenc.h ivfenc.c
187 twopass_encoder.SRCS            += tools_common.h tools_common.c
188 twopass_encoder.SRCS            += video_common.h
189 twopass_encoder.SRCS            += video_writer.h video_writer.c
190 twopass_encoder.SRCS            += vpx_ports/msvc.h
191 twopass_encoder.GUID             = 73494FA6-4AF9-4763-8FBB-265C92402FD8
192 twopass_encoder.DESCRIPTION      = Two-pass encoder loop
193 EXAMPLES-$(CONFIG_DECODERS)     += decode_with_drops.c
194 decode_with_drops.SRCS          += ivfdec.h ivfdec.c
195 decode_with_drops.SRCS          += tools_common.h tools_common.c
196 decode_with_drops.SRCS          += video_common.h
197 decode_with_drops.SRCS          += video_reader.h video_reader.c
198 decode_with_drops.SRCS          += vpx_ports/mem_ops.h
199 decode_with_drops.SRCS          += vpx_ports/mem_ops_aligned.h
200 decode_with_drops.SRCS          += vpx_ports/msvc.h
201 decode_with_drops.GUID           = CE5C53C4-8DDA-438A-86ED-0DDD3CDB8D26
202 decode_with_drops.DESCRIPTION    = Drops frames while decoding
203 EXAMPLES-$(CONFIG_ENCODERS)        += set_maps.c
204 set_maps.SRCS                      += ivfenc.h ivfenc.c
205 set_maps.SRCS                      += tools_common.h tools_common.c
206 set_maps.SRCS                      += video_common.h
207 set_maps.SRCS                      += video_writer.h video_writer.c
208 set_maps.SRCS                      += vpx_ports/msvc.h
209 set_maps.GUID                       = ECB2D24D-98B8-4015-A465-A4AF3DCC145F
210 set_maps.DESCRIPTION                = Set active and ROI maps
211 EXAMPLES-$(CONFIG_VP8_ENCODER)     += vp8cx_set_ref.c
212 vp8cx_set_ref.SRCS                 += ivfenc.h ivfenc.c
213 vp8cx_set_ref.SRCS                 += tools_common.h tools_common.c
214 vp8cx_set_ref.SRCS                 += video_common.h
215 vp8cx_set_ref.SRCS                 += video_writer.h video_writer.c
216 vp8cx_set_ref.SRCS                 += vpx_ports/msvc.h
217 vp8cx_set_ref.GUID                  = C5E31F7F-96F6-48BD-BD3E-10EBF6E8057A
218 vp8cx_set_ref.DESCRIPTION           = VP8 set encoder reference frame
219
220 ifeq ($(CONFIG_VP9_ENCODER),yes)
221 ifeq ($(CONFIG_DECODERS),yes)
222 EXAMPLES-yes                       += vp9cx_set_ref.c
223 vp9cx_set_ref.SRCS                 += ivfenc.h ivfenc.c
224 vp9cx_set_ref.SRCS                 += tools_common.h tools_common.c
225 vp9cx_set_ref.SRCS                 += video_common.h
226 vp9cx_set_ref.SRCS                 += video_writer.h video_writer.c
227 vp9cx_set_ref.GUID                  = 65D7F14A-2EE6-4293-B958-AB5107A03B55
228 vp9cx_set_ref.DESCRIPTION           = VP9 set encoder reference frame
229 endif
230 endif
231
232 ifeq ($(CONFIG_MULTI_RES_ENCODING),yes)
233 ifeq ($(CONFIG_LIBYUV),yes)
234 EXAMPLES-$(CONFIG_VP8_ENCODER)          += vp8_multi_resolution_encoder.c
235 vp8_multi_resolution_encoder.SRCS       += ivfenc.h ivfenc.c
236 vp8_multi_resolution_encoder.SRCS       += tools_common.h tools_common.c
237 vp8_multi_resolution_encoder.SRCS       += video_writer.h video_writer.c
238 vp8_multi_resolution_encoder.SRCS       += vpx_ports/msvc.h
239 vp8_multi_resolution_encoder.SRCS       += $(LIBYUV_SRCS)
240 vp8_multi_resolution_encoder.GUID        = 04f8738e-63c8-423b-90fa-7c2703a374de
241 vp8_multi_resolution_encoder.DESCRIPTION = VP8 Multiple-resolution Encoding
242 endif
243 endif
244
245 # Handle extra library flags depending on codec configuration
246
247 # We should not link to math library (libm) on RVCT
248 # when building for bare-metal targets
249 ifeq ($(CONFIG_OS_SUPPORT), yes)
250 CODEC_EXTRA_LIBS-$(CONFIG_VP8)         += m
251 CODEC_EXTRA_LIBS-$(CONFIG_VP9)         += m
252 else
253     ifeq ($(CONFIG_GCC), yes)
254     CODEC_EXTRA_LIBS-$(CONFIG_VP8)         += m
255     CODEC_EXTRA_LIBS-$(CONFIG_VP9)         += m
256     endif
257 endif
258 #
259 # End of specified files. The rest of the build rules should happen
260 # automagically from here.
261 #
262
263
264 # Examples need different flags based on whether we're building
265 # from an installed tree or a version controlled tree. Determine
266 # the proper paths.
267 ifeq ($(HAVE_ALT_TREE_LAYOUT),yes)
268     LIB_PATH-yes := $(SRC_PATH_BARE)/../lib
269     INC_PATH-yes := $(SRC_PATH_BARE)/../include
270 else
271     LIB_PATH-yes                     += $(if $(BUILD_PFX),$(BUILD_PFX),.)
272     INC_PATH-$(CONFIG_VP8_DECODER)   += $(SRC_PATH_BARE)/vp8
273     INC_PATH-$(CONFIG_VP8_ENCODER)   += $(SRC_PATH_BARE)/vp8
274     INC_PATH-$(CONFIG_VP9_DECODER)   += $(SRC_PATH_BARE)/vp9
275     INC_PATH-$(CONFIG_VP9_ENCODER)   += $(SRC_PATH_BARE)/vp9
276 endif
277 INC_PATH-$(CONFIG_LIBYUV) += $(SRC_PATH_BARE)/third_party/libyuv/include
278 LIB_PATH := $(call enabled,LIB_PATH)
279 INC_PATH := $(call enabled,INC_PATH)
280 INTERNAL_CFLAGS = $(addprefix -I,$(INC_PATH))
281 INTERNAL_LDFLAGS += $(addprefix -L,$(LIB_PATH))
282
283
284 # Expand list of selected examples to build (as specified above)
285 UTILS           = $(call enabled,UTILS)
286 EXAMPLES        = $(addprefix examples/,$(call enabled,EXAMPLES))
287 ALL_EXAMPLES    = $(UTILS) $(EXAMPLES)
288 UTIL_SRCS       = $(foreach ex,$(UTILS),$($(ex:.c=).SRCS))
289 ALL_SRCS        = $(foreach ex,$(ALL_EXAMPLES),$($(notdir $(ex:.c=)).SRCS))
290 CODEC_EXTRA_LIBS=$(sort $(call enabled,CODEC_EXTRA_LIBS))
291
292
293 # Expand all example sources into a variable containing all sources
294 # for that example (not just them main one specified in UTILS/EXAMPLES)
295 # and add this file to the list (for MSVS workspace generation)
296 $(foreach ex,$(ALL_EXAMPLES),$(eval $(notdir $(ex:.c=)).SRCS += $(ex) examples.mk))
297
298
299 # Create build/install dependencies for all examples. The common case
300 # is handled here. The MSVS case is handled below.
301 NOT_MSVS = $(if $(CONFIG_MSVS),,yes)
302 DIST-BINS-$(NOT_MSVS)      += $(addprefix bin/,$(ALL_EXAMPLES:.c=$(EXE_SFX)))
303 INSTALL-BINS-$(NOT_MSVS)   += $(addprefix bin/,$(UTILS:.c=$(EXE_SFX)))
304 DIST-SRCS-yes              += $(ALL_SRCS)
305 INSTALL-SRCS-yes           += $(UTIL_SRCS)
306 OBJS-$(NOT_MSVS)           += $(call objs,$(ALL_SRCS))
307 BINS-$(NOT_MSVS)           += $(addprefix $(BUILD_PFX),$(ALL_EXAMPLES:.c=$(EXE_SFX)))
308
309
310 # Instantiate linker template for all examples.
311 CODEC_LIB=$(if $(CONFIG_DEBUG_LIBS),vpx_g,vpx)
312 ifneq ($(filter darwin%,$(TGT_OS)),)
313 SHARED_LIB_SUF=.dylib
314 else
315 ifneq ($(filter os2%,$(TGT_OS)),)
316 SHARED_LIB_SUF=_dll.a
317 else
318 SHARED_LIB_SUF=.so
319 endif
320 endif
321 CODEC_LIB_SUF=$(if $(CONFIG_SHARED),$(SHARED_LIB_SUF),.a)
322 $(foreach bin,$(BINS-yes),\
323     $(eval $(bin):$(LIB_PATH)/lib$(CODEC_LIB)$(CODEC_LIB_SUF))\
324     $(eval $(call linker_template,$(bin),\
325         $(call objs,$($(notdir $(bin:$(EXE_SFX)=)).SRCS)) \
326         -l$(CODEC_LIB) $(addprefix -l,$(CODEC_EXTRA_LIBS))\
327         )))
328
329 # The following pairs define a mapping of locations in the distribution
330 # tree to locations in the source/build trees.
331 INSTALL_MAPS += src/%.c   %.c
332 INSTALL_MAPS += src/%     $(SRC_PATH_BARE)/%
333 INSTALL_MAPS += bin/%     %
334 INSTALL_MAPS += %         %
335
336
337 # Set up additional MSVS environment
338 ifeq ($(CONFIG_MSVS),yes)
339 CODEC_LIB=$(if $(CONFIG_SHARED),vpx,$(if $(CONFIG_STATIC_MSVCRT),vpxmt,vpxmd))
340 # This variable uses deferred expansion intentionally, since the results of
341 # $(wildcard) may change during the course of the Make.
342 VS_PLATFORMS = $(foreach d,$(wildcard */Release/$(CODEC_LIB).lib),$(word 1,$(subst /, ,$(d))))
343 INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),bin/$(p)/%  $(p)/Release/%)
344 endif
345
346 # Build Visual Studio Projects. We use a template here to instantiate
347 # explicit rules rather than using an implicit rule because we want to
348 # leverage make's VPATH searching rather than specifying the paths on
349 # each file in ALL_EXAMPLES. This has the unfortunate side effect that
350 # touching the source files trigger a rebuild of the project files
351 # even though there is no real dependency there (the dependency is on
352 # the makefiles). We may want to revisit this.
353 define vcproj_template
354 $(1): $($(1:.$(VCPROJ_SFX)=).SRCS) vpx.$(VCPROJ_SFX)
355         $(if $(quiet),@echo "    [vcproj] $$@")
356         $(qexec)$$(GEN_VCPROJ)\
357             --exe\
358             --target=$$(TOOLCHAIN)\
359             --name=$$(@:.$(VCPROJ_SFX)=)\
360             --ver=$$(CONFIG_VS_VERSION)\
361             --proj-guid=$$($$(@:.$(VCPROJ_SFX)=).GUID)\
362             --src-path-bare="$(SRC_PATH_BARE)" \
363             $$(if $$(CONFIG_STATIC_MSVCRT),--static-crt) \
364             --out=$$@ $$(INTERNAL_CFLAGS) $$(CFLAGS) \
365             $$(INTERNAL_LDFLAGS) $$(LDFLAGS) -l$$(CODEC_LIB) $$^
366 endef
367 ALL_EXAMPLES_BASENAME := $(notdir $(ALL_EXAMPLES))
368 PROJECTS-$(CONFIG_MSVS) += $(ALL_EXAMPLES_BASENAME:.c=.$(VCPROJ_SFX))
369 INSTALL-BINS-$(CONFIG_MSVS) += $(foreach p,$(VS_PLATFORMS),\
370                                $(addprefix bin/$(p)/,$(ALL_EXAMPLES_BASENAME:.c=.exe)))
371 $(foreach proj,$(call enabled,PROJECTS),\
372     $(eval $(call vcproj_template,$(proj))))
373
374 #
375 # Documentation Rules
376 #
377 %.dox: %.c
378         @echo "    [DOXY] $@"
379         @mkdir -p $(dir $@)
380         @echo "/*!\page example_$(@F:.dox=) $(@F:.dox=)" > $@
381         @echo "   \includelineno $(<F)" >> $@
382         @echo "*/" >> $@
383
384 samples.dox: examples.mk
385         @echo "    [DOXY] $@"
386         @echo "/*!\page samples Sample Code" > $@
387         @echo "    This SDK includes a number of sample applications."\
388               "Each sample documents a feature of the SDK in both prose"\
389               "and the associated C code."\
390               "The following samples are included: ">>$@
391         @$(foreach ex,$(sort $(notdir $(EXAMPLES:.c=))),\
392            echo "     - \subpage example_$(ex) $($(ex).DESCRIPTION)" >> $@;)
393         @echo >> $@
394         @echo "    In addition, the SDK contains a number of utilities."\
395               "Since these utilities are built upon the concepts described"\
396               "in the sample code listed above, they are not documented in"\
397               "pieces like the samples are. Their source is included here"\
398               "for reference. The following utilities are included:" >> $@
399         @$(foreach ex,$(sort $(UTILS:.c=)),\
400            echo "     - \subpage example_$(ex) $($(ex).DESCRIPTION)" >> $@;)
401         @echo "*/" >> $@
402
403 CLEAN-OBJS += examples.doxy samples.dox $(ALL_EXAMPLES:.c=.dox)
404 DOCS-yes += examples.doxy samples.dox
405 examples.doxy: samples.dox $(ALL_EXAMPLES:.c=.dox)
406         @echo "INPUT += $^" > $@
407         @echo "ENABLED_SECTIONS += samples" >> $@