blob: 602b2a207badfef81f0ad916e5be1d654199fe3a [file] [log] [blame]
John Koleszar0ea50ce2010-05-18 11:58:33 -04001##
Yaowu Xufe24b952016-09-08 09:57:21 -07002## Copyright (c) 2016, Alliance for Open Media. All rights reserved
John Koleszar0ea50ce2010-05-18 11:58:33 -04003##
Yaowu Xufe24b952016-09-08 09:57:21 -07004## This source code is subject to the terms of the BSD 2 Clause License and
5## the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6## was not distributed with this source code in the LICENSE file, you can
7## obtain it at www.aomedia.org/license/software. If the Alliance for Open
8## Media Patent License 1.0 was not distributed with this source code in the
9## PATENTS file, you can obtain it at www.aomedia.org/license/patent.
John Koleszar0ea50ce2010-05-18 11:58:33 -040010##
11
Yaowu Xufe24b952016-09-08 09:57:21 -070012
John Koleszar7dfec962012-03-01 12:50:40 -080013LIBYUV_SRCS += third_party/libyuv/include/libyuv/basic_types.h \
James Zern3a7d4672014-08-10 16:15:18 -070014 third_party/libyuv/include/libyuv/convert.h \
15 third_party/libyuv/include/libyuv/convert_argb.h \
16 third_party/libyuv/include/libyuv/convert_from.h \
John Koleszar7dfec962012-03-01 12:50:40 -080017 third_party/libyuv/include/libyuv/cpu_id.h \
Deb Mukherjee47031c02014-05-16 18:52:01 -070018 third_party/libyuv/include/libyuv/planar_functions.h \
James Zern3a7d4672014-08-10 16:15:18 -070019 third_party/libyuv/include/libyuv/rotate.h \
Deb Mukherjee47031c02014-05-16 18:52:01 -070020 third_party/libyuv/include/libyuv/row.h \
John Koleszar7dfec962012-03-01 12:50:40 -080021 third_party/libyuv/include/libyuv/scale.h \
Deb Mukherjee47031c02014-05-16 18:52:01 -070022 third_party/libyuv/include/libyuv/scale_row.h \
23 third_party/libyuv/source/cpu_id.cc \
24 third_party/libyuv/source/planar_functions.cc \
25 third_party/libyuv/source/row_any.cc \
26 third_party/libyuv/source/row_common.cc \
James Zernfcb42532015-07-24 16:54:51 -070027 third_party/libyuv/source/row_gcc.cc \
Deb Mukherjee47031c02014-05-16 18:52:01 -070028 third_party/libyuv/source/row_mips.cc \
29 third_party/libyuv/source/row_neon.cc \
James Zern3a7d4672014-08-10 16:15:18 -070030 third_party/libyuv/source/row_neon64.cc \
Deb Mukherjee47031c02014-05-16 18:52:01 -070031 third_party/libyuv/source/row_win.cc \
James Zern3a7d4672014-08-10 16:15:18 -070032 third_party/libyuv/source/scale.cc \
James Zernfcb42532015-07-24 16:54:51 -070033 third_party/libyuv/source/scale_any.cc \
Deb Mukherjee47031c02014-05-16 18:52:01 -070034 third_party/libyuv/source/scale_common.cc \
James Zernfcb42532015-07-24 16:54:51 -070035 third_party/libyuv/source/scale_gcc.cc \
Deb Mukherjee47031c02014-05-16 18:52:01 -070036 third_party/libyuv/source/scale_mips.cc \
37 third_party/libyuv/source/scale_neon.cc \
James Zern2f5e0fa2014-08-22 18:16:44 -070038 third_party/libyuv/source/scale_neon64.cc \
James Zern3a7d4672014-08-10 16:15:18 -070039 third_party/libyuv/source/scale_win.cc \
John Koleszar0ea50ce2010-05-18 11:58:33 -040040
Tom Finegan4317ba52016-03-24 13:12:51 -070041LIBWEBM_COMMON_SRCS += third_party/libwebm/common/hdr_util.cc \
42 third_party/libwebm/common/hdr_util.h \
43 third_party/libwebm/common/webmids.h
Vignesh Venkatasubramaniandd551072015-09-10 11:02:40 -070044
Tom Finegan4317ba52016-03-24 13:12:51 -070045LIBWEBM_MUXER_SRCS += third_party/libwebm/mkvmuxer/mkvmuxer.cc \
46 third_party/libwebm/mkvmuxer/mkvmuxerutil.cc \
47 third_party/libwebm/mkvmuxer/mkvwriter.cc \
48 third_party/libwebm/mkvmuxer/mkvmuxer.h \
49 third_party/libwebm/mkvmuxer/mkvmuxertypes.h \
50 third_party/libwebm/mkvmuxer/mkvmuxerutil.h \
51 third_party/libwebm/mkvparser/mkvparser.h \
52 third_party/libwebm/mkvmuxer/mkvwriter.h
Vignesh Venkatasubramanian2dcbf8c2014-03-19 11:56:02 -070053
Tom Finegan4317ba52016-03-24 13:12:51 -070054LIBWEBM_PARSER_SRCS = third_party/libwebm/mkvparser/mkvparser.cc \
55 third_party/libwebm/mkvparser/mkvreader.cc \
56 third_party/libwebm/mkvparser/mkvparser.h \
57 third_party/libwebm/mkvparser/mkvreader.h
58
59# Add compile flags and include path for libwebm sources.
60ifeq ($(CONFIG_WEBM_IO),yes)
61 CXXFLAGS += -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS
62 INC_PATH-yes += $(SRC_PATH_BARE)/third_party/libwebm
63endif
64
Vignesh Venkatasubramaniandbd24712014-04-03 00:41:14 -070065
James Zern77bbcab2014-02-05 16:55:01 -080066# List of examples to build. UTILS are tools meant for distribution
67# while EXAMPLES demonstrate specific portions of the API.
Yaowu Xuf883b422016-08-30 14:01:10 -070068UTILS-$(CONFIG_DECODERS) += aomdec.c
69aomdec.SRCS += md5_utils.c md5_utils.h
70aomdec.SRCS += aom_ports/mem_ops.h
71aomdec.SRCS += aom_ports/mem_ops_aligned.h
72aomdec.SRCS += aom_ports/msvc.h
73aomdec.SRCS += aom_ports/aom_timer.h
74aomdec.SRCS += aom/aom_integer.h
75aomdec.SRCS += args.c args.h
76aomdec.SRCS += ivfdec.c ivfdec.h
77aomdec.SRCS += tools_common.c tools_common.h
78aomdec.SRCS += y4menc.c y4menc.h
Deb Mukherjee47031c02014-05-16 18:52:01 -070079ifeq ($(CONFIG_LIBYUV),yes)
Yaowu Xuf883b422016-08-30 14:01:10 -070080 aomdec.SRCS += $(LIBYUV_SRCS)
Deb Mukherjee47031c02014-05-16 18:52:01 -070081endif
Vignesh Venkatasubramanian0ffa3832014-03-14 08:10:35 -070082ifeq ($(CONFIG_WEBM_IO),yes)
Yaowu Xuf883b422016-08-30 14:01:10 -070083 aomdec.SRCS += $(LIBWEBM_COMMON_SRCS)
84 aomdec.SRCS += $(LIBWEBM_MUXER_SRCS)
85 aomdec.SRCS += $(LIBWEBM_PARSER_SRCS)
86 aomdec.SRCS += webmdec.cc webmdec.h
Vignesh Venkatasubramanian0ffa3832014-03-14 08:10:35 -070087endif
Yaowu Xuf883b422016-08-30 14:01:10 -070088aomdec.GUID = BA5FE66F-38DD-E034-F542-B1578C5FB950
89aomdec.DESCRIPTION = Full featured decoder
90UTILS-$(CONFIG_ENCODERS) += aomenc.c
91aomenc.SRCS += args.c args.h y4minput.c y4minput.h aomenc.h
92aomenc.SRCS += ivfdec.c ivfdec.h
93aomenc.SRCS += ivfenc.c ivfenc.h
94aomenc.SRCS += rate_hist.c rate_hist.h
95aomenc.SRCS += tools_common.c tools_common.h
96aomenc.SRCS += warnings.c warnings.h
97aomenc.SRCS += aom_ports/mem_ops.h
98aomenc.SRCS += aom_ports/mem_ops_aligned.h
99aomenc.SRCS += aom_ports/msvc.h
100aomenc.SRCS += aom_ports/aom_timer.h
101aomenc.SRCS += aomstats.c aomstats.h
Deb Mukherjee47031c02014-05-16 18:52:01 -0700102ifeq ($(CONFIG_LIBYUV),yes)
Yaowu Xuf883b422016-08-30 14:01:10 -0700103 aomenc.SRCS += $(LIBYUV_SRCS)
Deb Mukherjee47031c02014-05-16 18:52:01 -0700104endif
Vignesh Venkatasubramanian0ffa3832014-03-14 08:10:35 -0700105ifeq ($(CONFIG_WEBM_IO),yes)
Yaowu Xuf883b422016-08-30 14:01:10 -0700106 aomenc.SRCS += $(LIBWEBM_COMMON_SRCS)
107 aomenc.SRCS += $(LIBWEBM_MUXER_SRCS)
108 aomenc.SRCS += $(LIBWEBM_PARSER_SRCS)
109 aomenc.SRCS += webmenc.cc webmenc.h
Vignesh Venkatasubramanian0ffa3832014-03-14 08:10:35 -0700110endif
Yaowu Xuf883b422016-08-30 14:01:10 -0700111aomenc.GUID = 548DEC74-7A15-4B2B-AFC3-AA102E7C25C1
112aomenc.DESCRIPTION = Full featured encoder
John Koleszarea68ee02010-10-21 15:02:10 -0400113
Dmitry Kovalev5ba8c792014-09-11 15:46:37 -0700114EXAMPLES-$(CONFIG_DECODERS) += simple_decoder.c
James Zern77bbcab2014-02-05 16:55:01 -0800115simple_decoder.GUID = D3BBF1E9-2427-450D-BBFF-B2843C1D44CC
Dmitry Kovalev7ec27692014-01-27 13:40:29 -0800116simple_decoder.SRCS += ivfdec.h ivfdec.c
117simple_decoder.SRCS += tools_common.h tools_common.c
Dmitry Kovalev37e6fd32014-02-05 18:34:46 -0800118simple_decoder.SRCS += video_common.h
119simple_decoder.SRCS += video_reader.h video_reader.c
Yaowu Xuc27fc142016-08-22 16:08:15 -0700120simple_decoder.SRCS += aom_ports/mem_ops.h
121simple_decoder.SRCS += aom_ports/mem_ops_aligned.h
122simple_decoder.SRCS += aom_ports/msvc.h
James Zern77bbcab2014-02-05 16:55:01 -0800123simple_decoder.DESCRIPTION = Simplified decoder loop
Dmitry Kovalev5ba8c792014-09-11 15:46:37 -0700124EXAMPLES-$(CONFIG_DECODERS) += decode_to_md5.c
Dmitry Kovalevc2b33682014-01-24 11:20:09 -0800125decode_to_md5.SRCS += md5_utils.h md5_utils.c
126decode_to_md5.SRCS += ivfdec.h ivfdec.c
127decode_to_md5.SRCS += tools_common.h tools_common.c
Dmitry Kovalev37e6fd32014-02-05 18:34:46 -0800128decode_to_md5.SRCS += video_common.h
129decode_to_md5.SRCS += video_reader.h video_reader.c
Yaowu Xuc27fc142016-08-22 16:08:15 -0700130decode_to_md5.SRCS += aom_ports/mem_ops.h
131decode_to_md5.SRCS += aom_ports/mem_ops_aligned.h
132decode_to_md5.SRCS += aom_ports/msvc.h
James Zern77bbcab2014-02-05 16:55:01 -0800133decode_to_md5.GUID = 59120B9B-2735-4BFE-B022-146CA340FE42
134decode_to_md5.DESCRIPTION = Frame by frame MD5 checksum
Dmitry Kovalev5ba8c792014-09-11 15:46:37 -0700135EXAMPLES-$(CONFIG_ENCODERS) += simple_encoder.c
Dmitry Kovalev37e6fd32014-02-05 18:34:46 -0800136simple_encoder.SRCS += ivfenc.h ivfenc.c
137simple_encoder.SRCS += tools_common.h tools_common.c
138simple_encoder.SRCS += video_common.h
139simple_encoder.SRCS += video_writer.h video_writer.c
Yaowu Xuc27fc142016-08-22 16:08:15 -0700140simple_encoder.SRCS += aom_ports/msvc.h
John Koleszar0ea50ce2010-05-18 11:58:33 -0400141simple_encoder.GUID = 4607D299-8A71-4D2C-9B1D-071899B6FBFD
142simple_encoder.DESCRIPTION = Simplified encoder loop
Yaowu Xudef1a3d2016-09-23 15:37:46 -0700143EXAMPLES-$(CONFIG_AV1_ENCODER) += lossless_encoder.c
Yaowu Xu5eee9072016-07-28 11:51:48 -0700144lossless_encoder.SRCS += ivfenc.h ivfenc.c
145lossless_encoder.SRCS += tools_common.h tools_common.c
146lossless_encoder.SRCS += video_common.h
147lossless_encoder.SRCS += video_writer.h video_writer.c
Yaowu Xuc27fc142016-08-22 16:08:15 -0700148lossless_encoder.SRCS += aom_ports/msvc.h
Yaowu Xu5eee9072016-07-28 11:51:48 -0700149lossless_encoder.GUID = B63C7C88-5348-46DC-A5A6-CC151EF93366
Yaowu Xua3cff082016-08-03 11:33:39 -0700150lossless_encoder.DESCRIPTION = Simplified lossless encoder
Dmitry Kovalev5ba8c792014-09-11 15:46:37 -0700151EXAMPLES-$(CONFIG_ENCODERS) += twopass_encoder.c
Dmitry Kovalev592936b2014-02-07 11:37:39 -0800152twopass_encoder.SRCS += ivfenc.h ivfenc.c
153twopass_encoder.SRCS += tools_common.h tools_common.c
154twopass_encoder.SRCS += video_common.h
155twopass_encoder.SRCS += video_writer.h video_writer.c
Yaowu Xuc27fc142016-08-22 16:08:15 -0700156twopass_encoder.SRCS += aom_ports/msvc.h
John Koleszar0ea50ce2010-05-18 11:58:33 -0400157twopass_encoder.GUID = 73494FA6-4AF9-4763-8FBB-265C92402FD8
158twopass_encoder.DESCRIPTION = Two-pass encoder loop
Dmitry Kovalev5ba8c792014-09-11 15:46:37 -0700159EXAMPLES-$(CONFIG_DECODERS) += decode_with_drops.c
James Zern77bbcab2014-02-05 16:55:01 -0800160decode_with_drops.SRCS += ivfdec.h ivfdec.c
161decode_with_drops.SRCS += tools_common.h tools_common.c
Dmitry Kovalev37e6fd32014-02-05 18:34:46 -0800162decode_with_drops.SRCS += video_common.h
163decode_with_drops.SRCS += video_reader.h video_reader.c
Yaowu Xuc27fc142016-08-22 16:08:15 -0700164decode_with_drops.SRCS += aom_ports/mem_ops.h
165decode_with_drops.SRCS += aom_ports/mem_ops_aligned.h
166decode_with_drops.SRCS += aom_ports/msvc.h
John Koleszar0ea50ce2010-05-18 11:58:33 -0400167decode_with_drops.GUID = CE5C53C4-8DDA-438A-86ED-0DDD3CDB8D26
168decode_with_drops.DESCRIPTION = Drops frames while decoding
Alex Converse61ecd7f2014-03-10 16:13:49 -0700169EXAMPLES-$(CONFIG_ENCODERS) += set_maps.c
170set_maps.SRCS += ivfenc.h ivfenc.c
171set_maps.SRCS += tools_common.h tools_common.c
172set_maps.SRCS += video_common.h
173set_maps.SRCS += video_writer.h video_writer.c
Yaowu Xuc27fc142016-08-22 16:08:15 -0700174set_maps.SRCS += aom_ports/msvc.h
Alex Converse61ecd7f2014-03-10 16:13:49 -0700175set_maps.GUID = ECB2D24D-98B8-4015-A465-A4AF3DCC145F
176set_maps.DESCRIPTION = Set active and ROI maps
Yaowu Xufe24b952016-09-08 09:57:21 -0700177ifeq ($(CONFIG_ENCODERS),yes)
Yunqing Wang9aaa3c92016-03-25 11:57:20 -0700178ifeq ($(CONFIG_DECODERS),yes)
Yaowu Xufe24b952016-09-08 09:57:21 -0700179EXAMPLES-$(CONFIG_ENCODERS) += aom_cx_set_ref.c
180aom_cx_set_ref.SRCS += ivfenc.h ivfenc.c
181aom_cx_set_ref.SRCS += tools_common.h tools_common.c
182aom_cx_set_ref.SRCS += video_common.h
183aom_cx_set_ref.SRCS += video_writer.h video_writer.c
184aom_cx_set_ref.SRCS += aom_ports/msvc.h
185aom_cx_set_ref.GUID = C5E31F7F-96F6-48BD-BD3E-10EBF6E8057A
186aom_cx_set_ref.DESCRIPTION = AV1 set encoder reference frame
Yunqing Wang9aaa3c92016-03-25 11:57:20 -0700187endif
188endif
Dmitry Kovalev98254a42014-01-17 16:56:04 -0800189
John Koleszar0ea50ce2010-05-18 11:58:33 -0400190# Handle extra library flags depending on codec configuration
John Koleszar0ea50ce2010-05-18 11:58:33 -0400191
Tero Rintaluoma11a222f2011-01-24 11:21:40 +0200192# We should not link to math library (libm) on RVCT
193# when building for bare-metal targets
194ifeq ($(CONFIG_OS_SUPPORT), yes)
Yaowu Xufe24b952016-09-08 09:57:21 -0700195CODEC_EXTRA_LIBS-$(CONFIG_AV1) += m
Tero Rintaluoma11a222f2011-01-24 11:21:40 +0200196else
197 ifeq ($(CONFIG_GCC), yes)
Yaowu Xuf883b422016-08-30 14:01:10 -0700198 CODEC_EXTRA_LIBS-$(CONFIG_AV1) += m
Tero Rintaluoma11a222f2011-01-24 11:21:40 +0200199 endif
200endif
John Koleszar0ea50ce2010-05-18 11:58:33 -0400201#
202# End of specified files. The rest of the build rules should happen
203# automagically from here.
204#
205
206
207# Examples need different flags based on whether we're building
208# from an installed tree or a version controlled tree. Determine
209# the proper paths.
210ifeq ($(HAVE_ALT_TREE_LAYOUT),yes)
James Zern3a7d4672014-08-10 16:15:18 -0700211 LIB_PATH-yes := $(SRC_PATH_BARE)/../lib
212 INC_PATH-yes := $(SRC_PATH_BARE)/../include
John Koleszar0ea50ce2010-05-18 11:58:33 -0400213else
214 LIB_PATH-yes += $(if $(BUILD_PFX),$(BUILD_PFX),.)
Yaowu Xuf883b422016-08-30 14:01:10 -0700215 INC_PATH-$(CONFIG_AV1_DECODER) += $(SRC_PATH_BARE)/av1
216 INC_PATH-$(CONFIG_AV1_ENCODER) += $(SRC_PATH_BARE)/av1
John Koleszar0ea50ce2010-05-18 11:58:33 -0400217endif
James Zern3a7d4672014-08-10 16:15:18 -0700218INC_PATH-$(CONFIG_LIBYUV) += $(SRC_PATH_BARE)/third_party/libyuv/include
219LIB_PATH := $(call enabled,LIB_PATH)
220INC_PATH := $(call enabled,INC_PATH)
Ronald S. Bultjebbf890f2011-05-02 13:56:41 -0400221INTERNAL_CFLAGS = $(addprefix -I,$(INC_PATH))
222INTERNAL_LDFLAGS += $(addprefix -L,$(LIB_PATH))
John Koleszar0ea50ce2010-05-18 11:58:33 -0400223
224
225# Expand list of selected examples to build (as specified above)
226UTILS = $(call enabled,UTILS)
James Zern77bbcab2014-02-05 16:55:01 -0800227EXAMPLES = $(addprefix examples/,$(call enabled,EXAMPLES))
228ALL_EXAMPLES = $(UTILS) $(EXAMPLES)
John Koleszaree8bcb12010-05-24 10:16:44 -0400229UTIL_SRCS = $(foreach ex,$(UTILS),$($(ex:.c=).SRCS))
James Zern77bbcab2014-02-05 16:55:01 -0800230ALL_SRCS = $(foreach ex,$(ALL_EXAMPLES),$($(notdir $(ex:.c=)).SRCS))
John Koleszar0ea50ce2010-05-18 11:58:33 -0400231CODEC_EXTRA_LIBS=$(sort $(call enabled,CODEC_EXTRA_LIBS))
232
233
234# Expand all example sources into a variable containing all sources
James Zern77bbcab2014-02-05 16:55:01 -0800235# for that example (not just them main one specified in UTILS/EXAMPLES)
John Koleszar0ea50ce2010-05-18 11:58:33 -0400236# and add this file to the list (for MSVS workspace generation)
James Zern77bbcab2014-02-05 16:55:01 -0800237$(foreach ex,$(ALL_EXAMPLES),$(eval $(notdir $(ex:.c=)).SRCS += $(ex) examples.mk))
John Koleszar0ea50ce2010-05-18 11:58:33 -0400238
239
John Koleszar0ea50ce2010-05-18 11:58:33 -0400240# Create build/install dependencies for all examples. The common case
241# is handled here. The MSVS case is handled below.
242NOT_MSVS = $(if $(CONFIG_MSVS),,yes)
KO Myung-Hun2dad8d62012-02-03 13:31:11 +0900243DIST-BINS-$(NOT_MSVS) += $(addprefix bin/,$(ALL_EXAMPLES:.c=$(EXE_SFX)))
244INSTALL-BINS-$(NOT_MSVS) += $(addprefix bin/,$(UTILS:.c=$(EXE_SFX)))
John Koleszaree8bcb12010-05-24 10:16:44 -0400245DIST-SRCS-yes += $(ALL_SRCS)
246INSTALL-SRCS-yes += $(UTIL_SRCS)
Tom Finegan3d7063d2015-05-12 15:33:40 -0700247OBJS-$(NOT_MSVS) += $(call objs,$(ALL_SRCS))
KO Myung-Hun2dad8d62012-02-03 13:31:11 +0900248BINS-$(NOT_MSVS) += $(addprefix $(BUILD_PFX),$(ALL_EXAMPLES:.c=$(EXE_SFX)))
John Koleszar0ea50ce2010-05-18 11:58:33 -0400249
250
251# Instantiate linker template for all examples.
Yaowu Xuc27fc142016-08-22 16:08:15 -0700252CODEC_LIB=$(if $(CONFIG_DEBUG_LIBS),aom_g,aom)
KO Myung-Hun6d52fe22014-08-08 13:13:02 +0900253ifneq ($(filter darwin%,$(TGT_OS)),)
254SHARED_LIB_SUF=.dylib
255else
256ifneq ($(filter os2%,$(TGT_OS)),)
257SHARED_LIB_SUF=_dll.a
258else
259SHARED_LIB_SUF=.so
260endif
261endif
jimbankoski45e551b2012-07-25 19:39:33 -0700262CODEC_LIB_SUF=$(if $(CONFIG_SHARED),$(SHARED_LIB_SUF),.a)
John Koleszar0ea50ce2010-05-18 11:58:33 -0400263$(foreach bin,$(BINS-yes),\
Tom Finegan3d7063d2015-05-12 15:33:40 -0700264 $(eval $(bin):$(LIB_PATH)/lib$(CODEC_LIB)$(CODEC_LIB_SUF))\
265 $(eval $(call linker_template,$(bin),\
KO Myung-Hun2dad8d62012-02-03 13:31:11 +0900266 $(call objs,$($(notdir $(bin:$(EXE_SFX)=)).SRCS)) \
John Koleszar0ea50ce2010-05-18 11:58:33 -0400267 -l$(CODEC_LIB) $(addprefix -l,$(CODEC_EXTRA_LIBS))\
Tom Finegan3d7063d2015-05-12 15:33:40 -0700268 )))
John Koleszar0ea50ce2010-05-18 11:58:33 -0400269
John Koleszar0ea50ce2010-05-18 11:58:33 -0400270# The following pairs define a mapping of locations in the distribution
271# tree to locations in the source/build trees.
272INSTALL_MAPS += src/%.c %.c
273INSTALL_MAPS += src/% $(SRC_PATH_BARE)/%
274INSTALL_MAPS += bin/% %
275INSTALL_MAPS += % %
276
277
278# Set up additional MSVS environment
279ifeq ($(CONFIG_MSVS),yes)
Yaowu Xuf883b422016-08-30 14:01:10 -0700280CODEC_LIB=$(if $(CONFIG_SHARED),aom,$(if $(CONFIG_STATIC_MSVCRT),aommt,aommd))
John Koleszar0ea50ce2010-05-18 11:58:33 -0400281# This variable uses deferred expansion intentionally, since the results of
282# $(wildcard) may change during the course of the Make.
283VS_PLATFORMS = $(foreach d,$(wildcard */Release/$(CODEC_LIB).lib),$(word 1,$(subst /, ,$(d))))
284INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),bin/$(p)/% $(p)/Release/%)
285endif
286
287# Build Visual Studio Projects. We use a template here to instantiate
288# explicit rules rather than using an implicit rule because we want to
289# leverage make's VPATH searching rather than specifying the paths on
290# each file in ALL_EXAMPLES. This has the unfortunate side effect that
291# touching the source files trigger a rebuild of the project files
292# even though there is no real dependency there (the dependency is on
293# the makefiles). We may want to revisit this.
294define vcproj_template
Yaowu Xuf883b422016-08-30 14:01:10 -0700295$(1): $($(1:.$(VCPROJ_SFX)=).SRCS) aom.$(VCPROJ_SFX)
James Zerna2746d72015-08-03 16:24:24 -0700296 $(if $(quiet),@echo " [vcproj] $$@")
297 $(qexec)$$(GEN_VCPROJ)\
John Koleszar0ea50ce2010-05-18 11:58:33 -0400298 --exe\
299 --target=$$(TOOLCHAIN)\
Martin Storsjo0b4637e2013-05-17 00:56:46 +0300300 --name=$$(@:.$(VCPROJ_SFX)=)\
John Koleszar0ea50ce2010-05-18 11:58:33 -0400301 --ver=$$(CONFIG_VS_VERSION)\
Martin Storsjo0b4637e2013-05-17 00:56:46 +0300302 --proj-guid=$$($$(@:.$(VCPROJ_SFX)=).GUID)\
James Zernf66590c2014-06-02 16:42:14 -0700303 --src-path-bare="$(SRC_PATH_BARE)" \
John Koleszar0ea50ce2010-05-18 11:58:33 -0400304 $$(if $$(CONFIG_STATIC_MSVCRT),--static-crt) \
Ronald S. Bultjebbf890f2011-05-02 13:56:41 -0400305 --out=$$@ $$(INTERNAL_CFLAGS) $$(CFLAGS) \
Martin Storsjoa37e84d2013-05-19 12:21:29 +0300306 $$(INTERNAL_LDFLAGS) $$(LDFLAGS) -l$$(CODEC_LIB) $$^
John Koleszar0ea50ce2010-05-18 11:58:33 -0400307endef
James Zern77bbcab2014-02-05 16:55:01 -0800308ALL_EXAMPLES_BASENAME := $(notdir $(ALL_EXAMPLES))
309PROJECTS-$(CONFIG_MSVS) += $(ALL_EXAMPLES_BASENAME:.c=.$(VCPROJ_SFX))
John Koleszar0ea50ce2010-05-18 11:58:33 -0400310INSTALL-BINS-$(CONFIG_MSVS) += $(foreach p,$(VS_PLATFORMS),\
James Zern77bbcab2014-02-05 16:55:01 -0800311 $(addprefix bin/$(p)/,$(ALL_EXAMPLES_BASENAME:.c=.exe)))
John Koleszar0ea50ce2010-05-18 11:58:33 -0400312$(foreach proj,$(call enabled,PROJECTS),\
313 $(eval $(call vcproj_template,$(proj))))
James Zern354c5662014-02-14 19:38:20 -0800314
315#
316# Documentation Rules
317#
318%.dox: %.c
319 @echo " [DOXY] $@"
James Zernaaccf652015-02-05 19:31:38 -0800320 @mkdir -p $(dir $@)
James Zern354c5662014-02-14 19:38:20 -0800321 @echo "/*!\page example_$(@F:.dox=) $(@F:.dox=)" > $@
322 @echo " \includelineno $(<F)" >> $@
323 @echo "*/" >> $@
324
325samples.dox: examples.mk
326 @echo " [DOXY] $@"
327 @echo "/*!\page samples Sample Code" > $@
328 @echo " This SDK includes a number of sample applications."\
329 "Each sample documents a feature of the SDK in both prose"\
330 "and the associated C code."\
331 "The following samples are included: ">>$@
332 @$(foreach ex,$(sort $(notdir $(EXAMPLES:.c=))),\
333 echo " - \subpage example_$(ex) $($(ex).DESCRIPTION)" >> $@;)
334 @echo >> $@
335 @echo " In addition, the SDK contains a number of utilities."\
336 "Since these utilities are built upon the concepts described"\
337 "in the sample code listed above, they are not documented in"\
338 "pieces like the samples are. Their source is included here"\
339 "for reference. The following utilities are included:" >> $@
340 @$(foreach ex,$(sort $(UTILS:.c=)),\
341 echo " - \subpage example_$(ex) $($(ex).DESCRIPTION)" >> $@;)
342 @echo "*/" >> $@
343
344CLEAN-OBJS += examples.doxy samples.dox $(ALL_EXAMPLES:.c=.dox)
345DOCS-yes += examples.doxy samples.dox
346examples.doxy: samples.dox $(ALL_EXAMPLES:.c=.dox)
347 @echo "INPUT += $^" > $@