2
0

examples.mk 20 KB

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