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