Merge "Fix an issue in vp9_first_pass for non-mulitple of 16 resolutions"
[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_mips.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_mips.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 ifeq ($(CONFIG_SPATIAL_SVC),yes)
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.GUID        = 4A38598D-627D-4505-9C7B-D4020C84100D
122   vp9_spatial_svc_encoder.DESCRIPTION = VP9 Spatial SVC Encoder
123 endif
124
125 ifneq ($(CONFIG_SHARED),yes)
126 EXAMPLES-$(CONFIG_VP9_ENCODER)    += resize_util.c
127 endif
128
129 EXAMPLES-$(CONFIG_ENCODERS)          += vpx_temporal_svc_encoder.c
130 vpx_temporal_svc_encoder.SRCS        += ivfenc.c ivfenc.h
131 vpx_temporal_svc_encoder.SRCS        += tools_common.c tools_common.h
132 vpx_temporal_svc_encoder.SRCS        += video_common.h
133 vpx_temporal_svc_encoder.SRCS        += video_writer.h video_writer.c
134 vpx_temporal_svc_encoder.SRCS        += vpx_ports/msvc.h
135 vpx_temporal_svc_encoder.GUID        = B18C08F2-A439-4502-A78E-849BE3D60947
136 vpx_temporal_svc_encoder.DESCRIPTION = Temporal SVC Encoder
137 EXAMPLES-$(CONFIG_DECODERS)        += simple_decoder.c
138 simple_decoder.GUID                 = D3BBF1E9-2427-450D-BBFF-B2843C1D44CC
139 simple_decoder.SRCS                += ivfdec.h ivfdec.c
140 simple_decoder.SRCS                += tools_common.h tools_common.c
141 simple_decoder.SRCS                += video_common.h
142 simple_decoder.SRCS                += video_reader.h video_reader.c
143 simple_decoder.SRCS                += vpx_ports/mem_ops.h
144 simple_decoder.SRCS                += vpx_ports/mem_ops_aligned.h
145 simple_decoder.SRCS                += vpx_ports/msvc.h
146 simple_decoder.DESCRIPTION          = Simplified decoder loop
147 EXAMPLES-$(CONFIG_DECODERS)        += postproc.c
148 postproc.SRCS                      += ivfdec.h ivfdec.c
149 postproc.SRCS                      += tools_common.h tools_common.c
150 postproc.SRCS                      += video_common.h
151 postproc.SRCS                      += video_reader.h video_reader.c
152 postproc.SRCS                      += vpx_ports/mem_ops.h
153 postproc.SRCS                      += vpx_ports/mem_ops_aligned.h
154 postproc.SRCS                      += vpx_ports/msvc.h
155 postproc.GUID                       = 65E33355-F35E-4088-884D-3FD4905881D7
156 postproc.DESCRIPTION                = Decoder postprocessor control
157 EXAMPLES-$(CONFIG_DECODERS)        += decode_to_md5.c
158 decode_to_md5.SRCS                 += md5_utils.h md5_utils.c
159 decode_to_md5.SRCS                 += ivfdec.h ivfdec.c
160 decode_to_md5.SRCS                 += tools_common.h tools_common.c
161 decode_to_md5.SRCS                 += video_common.h
162 decode_to_md5.SRCS                 += video_reader.h video_reader.c
163 decode_to_md5.SRCS                 += vpx_ports/mem_ops.h
164 decode_to_md5.SRCS                 += vpx_ports/mem_ops_aligned.h
165 decode_to_md5.SRCS                 += vpx_ports/msvc.h
166 decode_to_md5.GUID                  = 59120B9B-2735-4BFE-B022-146CA340FE42
167 decode_to_md5.DESCRIPTION           = Frame by frame MD5 checksum
168 EXAMPLES-$(CONFIG_ENCODERS)     += simple_encoder.c
169 simple_encoder.SRCS             += ivfenc.h ivfenc.c
170 simple_encoder.SRCS             += tools_common.h tools_common.c
171 simple_encoder.SRCS             += video_common.h
172 simple_encoder.SRCS             += video_writer.h video_writer.c
173 simple_encoder.SRCS             += vpx_ports/msvc.h
174 simple_encoder.GUID              = 4607D299-8A71-4D2C-9B1D-071899B6FBFD
175 simple_encoder.DESCRIPTION       = Simplified encoder loop
176 EXAMPLES-$(CONFIG_VP9_ENCODER)  += vp9_lossless_encoder.c
177 vp9_lossless_encoder.SRCS       += ivfenc.h ivfenc.c
178 vp9_lossless_encoder.SRCS       += tools_common.h tools_common.c
179 vp9_lossless_encoder.SRCS       += video_common.h
180 vp9_lossless_encoder.SRCS       += video_writer.h video_writer.c
181 vp9_lossless_encoder.SRCS       += vpx_ports/msvc.h
182 vp9_lossless_encoder.GUID        = B63C7C88-5348-46DC-A5A6-CC151EF93366
183 vp9_lossless_encoder.DESCRIPTION = Simplified lossless VP9 encoder
184 EXAMPLES-$(CONFIG_ENCODERS)     += twopass_encoder.c
185 twopass_encoder.SRCS            += ivfenc.h ivfenc.c
186 twopass_encoder.SRCS            += tools_common.h tools_common.c
187 twopass_encoder.SRCS            += video_common.h
188 twopass_encoder.SRCS            += video_writer.h video_writer.c
189 twopass_encoder.SRCS            += vpx_ports/msvc.h
190 twopass_encoder.GUID             = 73494FA6-4AF9-4763-8FBB-265C92402FD8
191 twopass_encoder.DESCRIPTION      = Two-pass encoder loop
192 EXAMPLES-$(CONFIG_DECODERS)     += decode_with_drops.c
193 decode_with_drops.SRCS          += ivfdec.h ivfdec.c
194 decode_with_drops.SRCS          += tools_common.h tools_common.c
195 decode_with_drops.SRCS          += video_common.h
196 decode_with_drops.SRCS          += video_reader.h video_reader.c
197 decode_with_drops.SRCS          += vpx_ports/mem_ops.h
198 decode_with_drops.SRCS          += vpx_ports/mem_ops_aligned.h
199 decode_with_drops.SRCS          += vpx_ports/msvc.h
200 decode_with_drops.GUID           = CE5C53C4-8DDA-438A-86ED-0DDD3CDB8D26
201 decode_with_drops.DESCRIPTION    = Drops frames while decoding
202 EXAMPLES-$(CONFIG_ENCODERS)        += set_maps.c
203 set_maps.SRCS                      += ivfenc.h ivfenc.c
204 set_maps.SRCS                      += tools_common.h tools_common.c
205 set_maps.SRCS                      += video_common.h
206 set_maps.SRCS                      += video_writer.h video_writer.c
207 set_maps.SRCS                      += vpx_ports/msvc.h
208 set_maps.GUID                       = ECB2D24D-98B8-4015-A465-A4AF3DCC145F
209 set_maps.DESCRIPTION                = Set active and ROI maps
210 EXAMPLES-$(CONFIG_VP8_ENCODER)     += vp8cx_set_ref.c
211 vp8cx_set_ref.SRCS                 += ivfenc.h ivfenc.c
212 vp8cx_set_ref.SRCS                 += tools_common.h tools_common.c
213 vp8cx_set_ref.SRCS                 += video_common.h
214 vp8cx_set_ref.SRCS                 += video_writer.h video_writer.c
215 vp8cx_set_ref.SRCS                 += vpx_ports/msvc.h
216 vp8cx_set_ref.GUID                  = C5E31F7F-96F6-48BD-BD3E-10EBF6E8057A
217 vp8cx_set_ref.DESCRIPTION           = VP8 set encoder reference frame
218
219 ifeq ($(CONFIG_VP9_ENCODER),yes)
220 ifeq ($(CONFIG_DECODERS),yes)
221 EXAMPLES-yes                       += vp9cx_set_ref.c
222 vp9cx_set_ref.SRCS                 += ivfenc.h ivfenc.c
223 vp9cx_set_ref.SRCS                 += tools_common.h tools_common.c
224 vp9cx_set_ref.SRCS                 += video_common.h
225 vp9cx_set_ref.SRCS                 += video_writer.h video_writer.c
226 vp9cx_set_ref.GUID                  = 65D7F14A-2EE6-4293-B958-AB5107A03B55
227 vp9cx_set_ref.DESCRIPTION           = VP9 set encoder reference frame
228 endif
229 endif
230
231 ifeq ($(CONFIG_MULTI_RES_ENCODING),yes)
232 ifeq ($(CONFIG_LIBYUV),yes)
233 EXAMPLES-$(CONFIG_VP8_ENCODER)          += vp8_multi_resolution_encoder.c
234 vp8_multi_resolution_encoder.SRCS       += ivfenc.h ivfenc.c
235 vp8_multi_resolution_encoder.SRCS       += tools_common.h tools_common.c
236 vp8_multi_resolution_encoder.SRCS       += video_writer.h video_writer.c
237 vp8_multi_resolution_encoder.SRCS       += vpx_ports/msvc.h
238 vp8_multi_resolution_encoder.SRCS       += $(LIBYUV_SRCS)
239 vp8_multi_resolution_encoder.GUID        = 04f8738e-63c8-423b-90fa-7c2703a374de
240 vp8_multi_resolution_encoder.DESCRIPTION = VP8 Multiple-resolution Encoding
241 endif
242 endif
243
244 # Handle extra library flags depending on codec configuration
245
246 # We should not link to math library (libm) on RVCT
247 # when building for bare-metal targets
248 ifeq ($(CONFIG_OS_SUPPORT), yes)
249 CODEC_EXTRA_LIBS-$(CONFIG_VP8)         += m
250 CODEC_EXTRA_LIBS-$(CONFIG_VP9)         += m
251 else
252     ifeq ($(CONFIG_GCC), yes)
253     CODEC_EXTRA_LIBS-$(CONFIG_VP8)         += m
254     CODEC_EXTRA_LIBS-$(CONFIG_VP9)         += m
255     endif
256 endif
257 #
258 # End of specified files. The rest of the build rules should happen
259 # automagically from here.
260 #
261
262
263 # Examples need different flags based on whether we're building
264 # from an installed tree or a version controlled tree. Determine
265 # the proper paths.
266 ifeq ($(HAVE_ALT_TREE_LAYOUT),yes)
267     LIB_PATH-yes := $(SRC_PATH_BARE)/../lib
268     INC_PATH-yes := $(SRC_PATH_BARE)/../include
269 else
270     LIB_PATH-yes                     += $(if $(BUILD_PFX),$(BUILD_PFX),.)
271     INC_PATH-$(CONFIG_VP8_DECODER)   += $(SRC_PATH_BARE)/vp8
272     INC_PATH-$(CONFIG_VP8_ENCODER)   += $(SRC_PATH_BARE)/vp8
273     INC_PATH-$(CONFIG_VP9_DECODER)   += $(SRC_PATH_BARE)/vp9
274     INC_PATH-$(CONFIG_VP9_ENCODER)   += $(SRC_PATH_BARE)/vp9
275 endif
276 INC_PATH-$(CONFIG_LIBYUV) += $(SRC_PATH_BARE)/third_party/libyuv/include
277 LIB_PATH := $(call enabled,LIB_PATH)
278 INC_PATH := $(call enabled,INC_PATH)
279 INTERNAL_CFLAGS = $(addprefix -I,$(INC_PATH))
280 INTERNAL_LDFLAGS += $(addprefix -L,$(LIB_PATH))
281
282
283 # Expand list of selected examples to build (as specified above)
284 UTILS           = $(call enabled,UTILS)
285 EXAMPLES        = $(addprefix examples/,$(call enabled,EXAMPLES))
286 ALL_EXAMPLES    = $(UTILS) $(EXAMPLES)
287 UTIL_SRCS       = $(foreach ex,$(UTILS),$($(ex:.c=).SRCS))
288 ALL_SRCS        = $(foreach ex,$(ALL_EXAMPLES),$($(notdir $(ex:.c=)).SRCS))
289 CODEC_EXTRA_LIBS=$(sort $(call enabled,CODEC_EXTRA_LIBS))
290
291
292 # Expand all example sources into a variable containing all sources
293 # for that example (not just them main one specified in UTILS/EXAMPLES)
294 # and add this file to the list (for MSVS workspace generation)
295 $(foreach ex,$(ALL_EXAMPLES),$(eval $(notdir $(ex:.c=)).SRCS += $(ex) examples.mk))
296
297
298 # Create build/install dependencies for all examples. The common case
299 # is handled here. The MSVS case is handled below.
300 NOT_MSVS = $(if $(CONFIG_MSVS),,yes)
301 DIST-BINS-$(NOT_MSVS)      += $(addprefix bin/,$(ALL_EXAMPLES:.c=$(EXE_SFX)))
302 INSTALL-BINS-$(NOT_MSVS)   += $(addprefix bin/,$(UTILS:.c=$(EXE_SFX)))
303 DIST-SRCS-yes              += $(ALL_SRCS)
304 INSTALL-SRCS-yes           += $(UTIL_SRCS)
305 OBJS-$(NOT_MSVS)           += $(call objs,$(ALL_SRCS))
306 BINS-$(NOT_MSVS)           += $(addprefix $(BUILD_PFX),$(ALL_EXAMPLES:.c=$(EXE_SFX)))
307
308
309 # Instantiate linker template for all examples.
310 CODEC_LIB=$(if $(CONFIG_DEBUG_LIBS),vpx_g,vpx)
311 ifneq ($(filter darwin%,$(TGT_OS)),)
312 SHARED_LIB_SUF=.dylib
313 else
314 ifneq ($(filter os2%,$(TGT_OS)),)
315 SHARED_LIB_SUF=_dll.a
316 else
317 SHARED_LIB_SUF=.so
318 endif
319 endif
320 CODEC_LIB_SUF=$(if $(CONFIG_SHARED),$(SHARED_LIB_SUF),.a)
321 $(foreach bin,$(BINS-yes),\
322     $(eval $(bin):$(LIB_PATH)/lib$(CODEC_LIB)$(CODEC_LIB_SUF))\
323     $(eval $(call linker_template,$(bin),\
324         $(call objs,$($(notdir $(bin:$(EXE_SFX)=)).SRCS)) \
325         -l$(CODEC_LIB) $(addprefix -l,$(CODEC_EXTRA_LIBS))\
326         )))
327
328 # The following pairs define a mapping of locations in the distribution
329 # tree to locations in the source/build trees.
330 INSTALL_MAPS += src/%.c   %.c
331 INSTALL_MAPS += src/%     $(SRC_PATH_BARE)/%
332 INSTALL_MAPS += bin/%     %
333 INSTALL_MAPS += %         %
334
335
336 # Set up additional MSVS environment
337 ifeq ($(CONFIG_MSVS),yes)
338 CODEC_LIB=$(if $(CONFIG_SHARED),vpx,$(if $(CONFIG_STATIC_MSVCRT),vpxmt,vpxmd))
339 # This variable uses deferred expansion intentionally, since the results of
340 # $(wildcard) may change during the course of the Make.
341 VS_PLATFORMS = $(foreach d,$(wildcard */Release/$(CODEC_LIB).lib),$(word 1,$(subst /, ,$(d))))
342 INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),bin/$(p)/%  $(p)/Release/%)
343 endif
344
345 # Build Visual Studio Projects. We use a template here to instantiate
346 # explicit rules rather than using an implicit rule because we want to
347 # leverage make's VPATH searching rather than specifying the paths on
348 # each file in ALL_EXAMPLES. This has the unfortunate side effect that
349 # touching the source files trigger a rebuild of the project files
350 # even though there is no real dependency there (the dependency is on
351 # the makefiles). We may want to revisit this.
352 define vcproj_template
353 $(1): $($(1:.$(VCPROJ_SFX)=).SRCS) vpx.$(VCPROJ_SFX)
354         $(if $(quiet),@echo "    [vcproj] $$@")
355         $(qexec)$$(GEN_VCPROJ)\
356             --exe\
357             --target=$$(TOOLCHAIN)\
358             --name=$$(@:.$(VCPROJ_SFX)=)\
359             --ver=$$(CONFIG_VS_VERSION)\
360             --proj-guid=$$($$(@:.$(VCPROJ_SFX)=).GUID)\
361             --src-path-bare="$(SRC_PATH_BARE)" \
362             $$(if $$(CONFIG_STATIC_MSVCRT),--static-crt) \
363             --out=$$@ $$(INTERNAL_CFLAGS) $$(CFLAGS) \
364             $$(INTERNAL_LDFLAGS) $$(LDFLAGS) -l$$(CODEC_LIB) $$^
365 endef
366 ALL_EXAMPLES_BASENAME := $(notdir $(ALL_EXAMPLES))
367 PROJECTS-$(CONFIG_MSVS) += $(ALL_EXAMPLES_BASENAME:.c=.$(VCPROJ_SFX))
368 INSTALL-BINS-$(CONFIG_MSVS) += $(foreach p,$(VS_PLATFORMS),\
369                                $(addprefix bin/$(p)/,$(ALL_EXAMPLES_BASENAME:.c=.exe)))
370 $(foreach proj,$(call enabled,PROJECTS),\
371     $(eval $(call vcproj_template,$(proj))))
372
373 #
374 # Documentation Rules
375 #
376 %.dox: %.c
377         @echo "    [DOXY] $@"
378         @mkdir -p $(dir $@)
379         @echo "/*!\page example_$(@F:.dox=) $(@F:.dox=)" > $@
380         @echo "   \includelineno $(<F)" >> $@
381         @echo "*/" >> $@
382
383 samples.dox: examples.mk
384         @echo "    [DOXY] $@"
385         @echo "/*!\page samples Sample Code" > $@
386         @echo "    This SDK includes a number of sample applications."\
387               "Each sample documents a feature of the SDK in both prose"\
388               "and the associated C code."\
389               "The following samples are included: ">>$@
390         @$(foreach ex,$(sort $(notdir $(EXAMPLES:.c=))),\
391            echo "     - \subpage example_$(ex) $($(ex).DESCRIPTION)" >> $@;)
392         @echo >> $@
393         @echo "    In addition, the SDK contains a number of utilities."\
394               "Since these utilities are built upon the concepts described"\
395               "in the sample code listed above, they are not documented in"\
396               "pieces like the samples are. Their source is included here"\
397               "for reference. The following utilities are included:" >> $@
398         @$(foreach ex,$(sort $(UTILS:.c=)),\
399            echo "     - \subpage example_$(ex) $($(ex).DESCRIPTION)" >> $@;)
400         @echo "*/" >> $@
401
402 CLEAN-OBJS += examples.doxy samples.dox $(ALL_EXAMPLES:.c=.dox)
403 DOCS-yes += examples.doxy samples.dox
404 examples.doxy: samples.dox $(ALL_EXAMPLES:.c=.dox)
405         @echo "INPUT += $^" > $@