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