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