blob: 2aa4c35925da8b432433a3258b08dfc0d31afd09 [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
James Zern77bbcab2014-02-05 16:55:01 -080065# List of examples to build. UTILS are tools meant for distribution
66# while EXAMPLES demonstrate specific portions of the API.
Tom Finegan378d6522017-05-22 13:04:56 -070067UTILS-$(CONFIG_AV1_DECODER) += aomdec.c
Yaowu Xuf883b422016-08-30 14:01:10 -070068aomdec.SRCS += md5_utils.c md5_utils.h
69aomdec.SRCS += aom_ports/mem_ops.h
70aomdec.SRCS += aom_ports/mem_ops_aligned.h
71aomdec.SRCS += aom_ports/msvc.h
72aomdec.SRCS += aom_ports/aom_timer.h
73aomdec.SRCS += aom/aom_integer.h
74aomdec.SRCS += args.c args.h
75aomdec.SRCS += ivfdec.c ivfdec.h
76aomdec.SRCS += tools_common.c tools_common.h
77aomdec.SRCS += y4menc.c y4menc.h
Deb Mukherjee47031c02014-05-16 18:52:01 -070078ifeq ($(CONFIG_LIBYUV),yes)
Yaowu Xuf883b422016-08-30 14:01:10 -070079 aomdec.SRCS += $(LIBYUV_SRCS)
Deb Mukherjee47031c02014-05-16 18:52:01 -070080endif
Vignesh Venkatasubramanian0ffa3832014-03-14 08:10:35 -070081ifeq ($(CONFIG_WEBM_IO),yes)
Yaowu Xuf883b422016-08-30 14:01:10 -070082 aomdec.SRCS += $(LIBWEBM_COMMON_SRCS)
83 aomdec.SRCS += $(LIBWEBM_MUXER_SRCS)
84 aomdec.SRCS += $(LIBWEBM_PARSER_SRCS)
85 aomdec.SRCS += webmdec.cc webmdec.h
Vignesh Venkatasubramanian0ffa3832014-03-14 08:10:35 -070086endif
Yaowu Xuf883b422016-08-30 14:01:10 -070087aomdec.GUID = BA5FE66F-38DD-E034-F542-B1578C5FB950
88aomdec.DESCRIPTION = Full featured decoder
Tom Finegan378d6522017-05-22 13:04:56 -070089UTILS-$(CONFIG_AV1_ENCODER) += aomenc.c
Yaowu Xuf883b422016-08-30 14:01:10 -070090aomenc.SRCS += args.c args.h y4minput.c y4minput.h aomenc.h
91aomenc.SRCS += ivfdec.c ivfdec.h
92aomenc.SRCS += ivfenc.c ivfenc.h
93aomenc.SRCS += rate_hist.c rate_hist.h
94aomenc.SRCS += tools_common.c tools_common.h
Urvang Joshi09c293e2017-04-20 17:56:27 -070095aomenc.SRCS += examples/encoder_util.h examples/encoder_util.c
Yaowu Xuf883b422016-08-30 14:01:10 -070096aomenc.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
Nathan E. Egge1a0d5ea2017-02-22 11:17:00 -0500114ifeq ($(CONFIG_ANALYZER),yes)
Tom Finegan378d6522017-05-22 13:04:56 -0700115 EXAMPLES-$(CONFIG_AV1_DECODER) += analyzer.cc
Nathan E. Egge1a0d5ea2017-02-22 11:17:00 -0500116 analyzer.GUID = 83827a8c-e3c3-4b19-8832-0cfc206c4496
117 analyzer.SRCS += ivfdec.h ivfdec.c
118 analyzer.SRCS += av1/decoder/inspection.h
119 analyzer.SRCS += av1/decoder/inspection.c
120 analyzer.SRCS += video_reader.h video_reader.c
121 analyzer.SRCS += tools_common.h tools_common.c
122 analyzer.DESCRIPTION = Bitstream analyzer
123endif
124
Michael Bebenitaf4f27fe2017-03-02 17:40:44 -0800125ifeq ($(CONFIG_INSPECTION),yes)
Tom Finegan378d6522017-05-22 13:04:56 -0700126EXAMPLES-$(CONFIG_AV1_DECODER) += inspect.c
127inspect.GUID = FA46A420-3356-441F-B0FD-60AA1345C181
128inspect.SRCS += ivfdec.h ivfdec.c
129inspect.SRCS += args.c args.h
130inspect.SRCS += tools_common.h tools_common.c
131inspect.SRCS += video_common.h
132inspect.SRCS += video_reader.h video_reader.c
133inspect.SRCS += aom_ports/mem_ops.h
134inspect.SRCS += aom_ports/mem_ops_aligned.h
135inspect.SRCS += aom_ports/msvc.h
136inspect.DESCRIPTION = Dump inspection data
Michael Bebenitaf4f27fe2017-03-02 17:40:44 -0800137endif
138
Tom Finegan378d6522017-05-22 13:04:56 -0700139EXAMPLES-$(CONFIG_AV1_DECODER) += simple_decoder.c
James Zern77bbcab2014-02-05 16:55:01 -0800140simple_decoder.GUID = D3BBF1E9-2427-450D-BBFF-B2843C1D44CC
Dmitry Kovalev7ec27692014-01-27 13:40:29 -0800141simple_decoder.SRCS += ivfdec.h ivfdec.c
142simple_decoder.SRCS += tools_common.h tools_common.c
Dmitry Kovalev37e6fd32014-02-05 18:34:46 -0800143simple_decoder.SRCS += video_common.h
144simple_decoder.SRCS += video_reader.h video_reader.c
Yaowu Xuc27fc142016-08-22 16:08:15 -0700145simple_decoder.SRCS += aom_ports/mem_ops.h
146simple_decoder.SRCS += aom_ports/mem_ops_aligned.h
147simple_decoder.SRCS += aom_ports/msvc.h
James Zern77bbcab2014-02-05 16:55:01 -0800148simple_decoder.DESCRIPTION = Simplified decoder loop
Tom Finegan378d6522017-05-22 13:04:56 -0700149EXAMPLES-$(CONFIG_AV1_DECODER) += decode_to_md5.c
Dmitry Kovalevc2b33682014-01-24 11:20:09 -0800150decode_to_md5.SRCS += md5_utils.h md5_utils.c
151decode_to_md5.SRCS += ivfdec.h ivfdec.c
152decode_to_md5.SRCS += tools_common.h tools_common.c
Dmitry Kovalev37e6fd32014-02-05 18:34:46 -0800153decode_to_md5.SRCS += video_common.h
154decode_to_md5.SRCS += video_reader.h video_reader.c
Yaowu Xuc27fc142016-08-22 16:08:15 -0700155decode_to_md5.SRCS += aom_ports/mem_ops.h
156decode_to_md5.SRCS += aom_ports/mem_ops_aligned.h
157decode_to_md5.SRCS += aom_ports/msvc.h
James Zern77bbcab2014-02-05 16:55:01 -0800158decode_to_md5.GUID = 59120B9B-2735-4BFE-B022-146CA340FE42
159decode_to_md5.DESCRIPTION = Frame by frame MD5 checksum
Tom Finegan378d6522017-05-22 13:04:56 -0700160EXAMPLES-$(CONFIG_AV1_ENCODER) += simple_encoder.c
Dmitry Kovalev37e6fd32014-02-05 18:34:46 -0800161simple_encoder.SRCS += ivfenc.h ivfenc.c
162simple_encoder.SRCS += tools_common.h tools_common.c
163simple_encoder.SRCS += video_common.h
164simple_encoder.SRCS += video_writer.h video_writer.c
Yaowu Xuc27fc142016-08-22 16:08:15 -0700165simple_encoder.SRCS += aom_ports/msvc.h
John Koleszar0ea50ce2010-05-18 11:58:33 -0400166simple_encoder.GUID = 4607D299-8A71-4D2C-9B1D-071899B6FBFD
167simple_encoder.DESCRIPTION = Simplified encoder loop
Yaowu Xudef1a3d2016-09-23 15:37:46 -0700168EXAMPLES-$(CONFIG_AV1_ENCODER) += lossless_encoder.c
Yaowu Xu5eee9072016-07-28 11:51:48 -0700169lossless_encoder.SRCS += ivfenc.h ivfenc.c
170lossless_encoder.SRCS += tools_common.h tools_common.c
171lossless_encoder.SRCS += video_common.h
172lossless_encoder.SRCS += video_writer.h video_writer.c
Yaowu Xuc27fc142016-08-22 16:08:15 -0700173lossless_encoder.SRCS += aom_ports/msvc.h
Yaowu Xu5eee9072016-07-28 11:51:48 -0700174lossless_encoder.GUID = B63C7C88-5348-46DC-A5A6-CC151EF93366
Yaowu Xua3cff082016-08-03 11:33:39 -0700175lossless_encoder.DESCRIPTION = Simplified lossless encoder
Tom Finegan378d6522017-05-22 13:04:56 -0700176EXAMPLES-$(CONFIG_AV1_ENCODER) += twopass_encoder.c
Dmitry Kovalev592936b2014-02-07 11:37:39 -0800177twopass_encoder.SRCS += ivfenc.h ivfenc.c
178twopass_encoder.SRCS += tools_common.h tools_common.c
179twopass_encoder.SRCS += video_common.h
180twopass_encoder.SRCS += video_writer.h video_writer.c
Yaowu Xuc27fc142016-08-22 16:08:15 -0700181twopass_encoder.SRCS += aom_ports/msvc.h
John Koleszar0ea50ce2010-05-18 11:58:33 -0400182twopass_encoder.GUID = 73494FA6-4AF9-4763-8FBB-265C92402FD8
183twopass_encoder.DESCRIPTION = Two-pass encoder loop
Tom Finegan378d6522017-05-22 13:04:56 -0700184EXAMPLES-$(CONFIG_AV1_DECODER) += decode_with_drops.c
James Zern77bbcab2014-02-05 16:55:01 -0800185decode_with_drops.SRCS += ivfdec.h ivfdec.c
186decode_with_drops.SRCS += tools_common.h tools_common.c
Dmitry Kovalev37e6fd32014-02-05 18:34:46 -0800187decode_with_drops.SRCS += video_common.h
188decode_with_drops.SRCS += video_reader.h video_reader.c
Yaowu Xuc27fc142016-08-22 16:08:15 -0700189decode_with_drops.SRCS += aom_ports/mem_ops.h
190decode_with_drops.SRCS += aom_ports/mem_ops_aligned.h
191decode_with_drops.SRCS += aom_ports/msvc.h
John Koleszar0ea50ce2010-05-18 11:58:33 -0400192decode_with_drops.GUID = CE5C53C4-8DDA-438A-86ED-0DDD3CDB8D26
193decode_with_drops.DESCRIPTION = Drops frames while decoding
Tom Finegan378d6522017-05-22 13:04:56 -0700194EXAMPLES-$(CONFIG_AV1_ENCODER) += set_maps.c
Alex Converse61ecd7f2014-03-10 16:13:49 -0700195set_maps.SRCS += ivfenc.h ivfenc.c
196set_maps.SRCS += tools_common.h tools_common.c
197set_maps.SRCS += video_common.h
198set_maps.SRCS += video_writer.h video_writer.c
Yaowu Xuc27fc142016-08-22 16:08:15 -0700199set_maps.SRCS += aom_ports/msvc.h
Alex Converse61ecd7f2014-03-10 16:13:49 -0700200set_maps.GUID = ECB2D24D-98B8-4015-A465-A4AF3DCC145F
201set_maps.DESCRIPTION = Set active and ROI maps
Tom Finegan378d6522017-05-22 13:04:56 -0700202ifeq ($(CONFIG_AV1_ENCODER),yes)
203ifeq ($(CONFIG_AV1_DECODER),yes)
204EXAMPLES-$(CONFIG_AV1_ENCODER) += aom_cx_set_ref.c
Yaowu Xufe24b952016-09-08 09:57:21 -0700205aom_cx_set_ref.SRCS += ivfenc.h ivfenc.c
206aom_cx_set_ref.SRCS += tools_common.h tools_common.c
Urvang Joshi09c293e2017-04-20 17:56:27 -0700207aom_cx_set_ref.SRCS += examples/encoder_util.h
208aom_cx_set_ref.SRCS += examples/encoder_util.c
Yaowu Xufe24b952016-09-08 09:57:21 -0700209aom_cx_set_ref.SRCS += video_common.h
210aom_cx_set_ref.SRCS += video_writer.h video_writer.c
211aom_cx_set_ref.SRCS += aom_ports/msvc.h
212aom_cx_set_ref.GUID = C5E31F7F-96F6-48BD-BD3E-10EBF6E8057A
213aom_cx_set_ref.DESCRIPTION = AV1 set encoder reference frame
Yunqing Wang9aaa3c92016-03-25 11:57:20 -0700214endif
215endif
Dmitry Kovalev98254a42014-01-17 16:56:04 -0800216
John Koleszar0ea50ce2010-05-18 11:58:33 -0400217# Handle extra library flags depending on codec configuration
John Koleszar0ea50ce2010-05-18 11:58:33 -0400218
Tero Rintaluoma11a222f2011-01-24 11:21:40 +0200219# We should not link to math library (libm) on RVCT
220# when building for bare-metal targets
221ifeq ($(CONFIG_OS_SUPPORT), yes)
Yaowu Xufe24b952016-09-08 09:57:21 -0700222CODEC_EXTRA_LIBS-$(CONFIG_AV1) += m
Tero Rintaluoma11a222f2011-01-24 11:21:40 +0200223else
224 ifeq ($(CONFIG_GCC), yes)
Yaowu Xuf883b422016-08-30 14:01:10 -0700225 CODEC_EXTRA_LIBS-$(CONFIG_AV1) += m
Tero Rintaluoma11a222f2011-01-24 11:21:40 +0200226 endif
227endif
John Koleszar0ea50ce2010-05-18 11:58:33 -0400228#
229# End of specified files. The rest of the build rules should happen
230# automagically from here.
231#
232
233
234# Examples need different flags based on whether we're building
235# from an installed tree or a version controlled tree. Determine
236# the proper paths.
237ifeq ($(HAVE_ALT_TREE_LAYOUT),yes)
James Zern3a7d4672014-08-10 16:15:18 -0700238 LIB_PATH-yes := $(SRC_PATH_BARE)/../lib
239 INC_PATH-yes := $(SRC_PATH_BARE)/../include
John Koleszar0ea50ce2010-05-18 11:58:33 -0400240else
241 LIB_PATH-yes += $(if $(BUILD_PFX),$(BUILD_PFX),.)
Yaowu Xuf883b422016-08-30 14:01:10 -0700242 INC_PATH-$(CONFIG_AV1_DECODER) += $(SRC_PATH_BARE)/av1
243 INC_PATH-$(CONFIG_AV1_ENCODER) += $(SRC_PATH_BARE)/av1
John Koleszar0ea50ce2010-05-18 11:58:33 -0400244endif
James Zern3a7d4672014-08-10 16:15:18 -0700245INC_PATH-$(CONFIG_LIBYUV) += $(SRC_PATH_BARE)/third_party/libyuv/include
246LIB_PATH := $(call enabled,LIB_PATH)
247INC_PATH := $(call enabled,INC_PATH)
Ronald S. Bultjebbf890f2011-05-02 13:56:41 -0400248INTERNAL_CFLAGS = $(addprefix -I,$(INC_PATH))
249INTERNAL_LDFLAGS += $(addprefix -L,$(LIB_PATH))
John Koleszar0ea50ce2010-05-18 11:58:33 -0400250
251
252# Expand list of selected examples to build (as specified above)
253UTILS = $(call enabled,UTILS)
James Zern77bbcab2014-02-05 16:55:01 -0800254EXAMPLES = $(addprefix examples/,$(call enabled,EXAMPLES))
255ALL_EXAMPLES = $(UTILS) $(EXAMPLES)
Tom Finegan252453b2017-03-07 14:20:11 -0800256UTIL_SRCS = $(foreach ex,$(UTILS),$($(ex:.c=).SRCS) $($(ex:.cc=).SRCS))
257ALL_SRCS = $(foreach ex, $(ALL_EXAMPLES), \
258 $($(notdir $(ex:.c=)).SRCS) \
259 $($(notdir $(ex:.cc=)).SRCS))
John Koleszar0ea50ce2010-05-18 11:58:33 -0400260CODEC_EXTRA_LIBS=$(sort $(call enabled,CODEC_EXTRA_LIBS))
261
262
263# Expand all example sources into a variable containing all sources
James Zern77bbcab2014-02-05 16:55:01 -0800264# for that example (not just them main one specified in UTILS/EXAMPLES)
John Koleszar0ea50ce2010-05-18 11:58:33 -0400265# and add this file to the list (for MSVS workspace generation)
Tom Finegan252453b2017-03-07 14:20:11 -0800266EXAMPLES_C = $(filter-out %.cc, $(ALL_EXAMPLES))
267$(foreach ex,$(EXAMPLES_C), \
268 $(eval $(notdir $(ex:.c=)).SRCS += $(ex) examples.mk))
269EXAMPLES_CXX = $(filter-out %.c, $(ALL_EXAMPLES))
270$(foreach ex,$(EXAMPLES_CXX), \
271 $(eval $(notdir $(ex:.cc=)).SRCS += $(ex) examples.mk))
John Koleszar0ea50ce2010-05-18 11:58:33 -0400272
John Koleszar0ea50ce2010-05-18 11:58:33 -0400273# Create build/install dependencies for all examples. The common case
274# is handled here. The MSVS case is handled below.
275NOT_MSVS = $(if $(CONFIG_MSVS),,yes)
Tom Finegan252453b2017-03-07 14:20:11 -0800276DIST-BINS-$(NOT_MSVS) += $(addprefix bin/,$(EXAMPLES_C:.c=$(EXE_SFX)))
277DIST-BINS-$(NOT_MSVS) += $(addprefix bin/,$(EXAMPLES_CXX:.cc=$(EXE_SFX)))
KO Myung-Hun2dad8d62012-02-03 13:31:11 +0900278INSTALL-BINS-$(NOT_MSVS) += $(addprefix bin/,$(UTILS:.c=$(EXE_SFX)))
John Koleszaree8bcb12010-05-24 10:16:44 -0400279DIST-SRCS-yes += $(ALL_SRCS)
280INSTALL-SRCS-yes += $(UTIL_SRCS)
Tom Finegan3d7063d2015-05-12 15:33:40 -0700281OBJS-$(NOT_MSVS) += $(call objs,$(ALL_SRCS))
Tom Finegan252453b2017-03-07 14:20:11 -0800282BINS-$(NOT_MSVS) += $(addprefix $(BUILD_PFX), \
283 $(EXAMPLES_C:.c=$(EXE_SFX)))
284BINS-$(NOT_MSVS) += $(addprefix $(BUILD_PFX), \
285 $(EXAMPLES_CXX:.cc=$(EXE_SFX)))
John Koleszar0ea50ce2010-05-18 11:58:33 -0400286
287# Instantiate linker template for all examples.
Yaowu Xuc27fc142016-08-22 16:08:15 -0700288CODEC_LIB=$(if $(CONFIG_DEBUG_LIBS),aom_g,aom)
KO Myung-Hun6d52fe22014-08-08 13:13:02 +0900289ifneq ($(filter darwin%,$(TGT_OS)),)
290SHARED_LIB_SUF=.dylib
291else
292ifneq ($(filter os2%,$(TGT_OS)),)
293SHARED_LIB_SUF=_dll.a
294else
295SHARED_LIB_SUF=.so
296endif
297endif
jimbankoski45e551b2012-07-25 19:39:33 -0700298CODEC_LIB_SUF=$(if $(CONFIG_SHARED),$(SHARED_LIB_SUF),.a)
John Koleszar0ea50ce2010-05-18 11:58:33 -0400299$(foreach bin,$(BINS-yes),\
Tom Finegan3d7063d2015-05-12 15:33:40 -0700300 $(eval $(bin):$(LIB_PATH)/lib$(CODEC_LIB)$(CODEC_LIB_SUF))\
301 $(eval $(call linker_template,$(bin),\
KO Myung-Hun2dad8d62012-02-03 13:31:11 +0900302 $(call objs,$($(notdir $(bin:$(EXE_SFX)=)).SRCS)) \
John Koleszar0ea50ce2010-05-18 11:58:33 -0400303 -l$(CODEC_LIB) $(addprefix -l,$(CODEC_EXTRA_LIBS))\
Tom Finegan3d7063d2015-05-12 15:33:40 -0700304 )))
John Koleszar0ea50ce2010-05-18 11:58:33 -0400305
John Koleszar0ea50ce2010-05-18 11:58:33 -0400306# The following pairs define a mapping of locations in the distribution
307# tree to locations in the source/build trees.
308INSTALL_MAPS += src/%.c %.c
309INSTALL_MAPS += src/% $(SRC_PATH_BARE)/%
310INSTALL_MAPS += bin/% %
311INSTALL_MAPS += % %
312
313
314# Set up additional MSVS environment
315ifeq ($(CONFIG_MSVS),yes)
Yaowu Xuf883b422016-08-30 14:01:10 -0700316CODEC_LIB=$(if $(CONFIG_SHARED),aom,$(if $(CONFIG_STATIC_MSVCRT),aommt,aommd))
John Koleszar0ea50ce2010-05-18 11:58:33 -0400317# This variable uses deferred expansion intentionally, since the results of
318# $(wildcard) may change during the course of the Make.
319VS_PLATFORMS = $(foreach d,$(wildcard */Release/$(CODEC_LIB).lib),$(word 1,$(subst /, ,$(d))))
320INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),bin/$(p)/% $(p)/Release/%)
321endif
322
323# Build Visual Studio Projects. We use a template here to instantiate
324# explicit rules rather than using an implicit rule because we want to
325# leverage make's VPATH searching rather than specifying the paths on
326# each file in ALL_EXAMPLES. This has the unfortunate side effect that
327# touching the source files trigger a rebuild of the project files
328# even though there is no real dependency there (the dependency is on
329# the makefiles). We may want to revisit this.
330define vcproj_template
Yaowu Xuf883b422016-08-30 14:01:10 -0700331$(1): $($(1:.$(VCPROJ_SFX)=).SRCS) aom.$(VCPROJ_SFX)
James Zerna2746d72015-08-03 16:24:24 -0700332 $(if $(quiet),@echo " [vcproj] $$@")
333 $(qexec)$$(GEN_VCPROJ)\
John Koleszar0ea50ce2010-05-18 11:58:33 -0400334 --exe\
335 --target=$$(TOOLCHAIN)\
Martin Storsjo0b4637e2013-05-17 00:56:46 +0300336 --name=$$(@:.$(VCPROJ_SFX)=)\
John Koleszar0ea50ce2010-05-18 11:58:33 -0400337 --ver=$$(CONFIG_VS_VERSION)\
Martin Storsjo0b4637e2013-05-17 00:56:46 +0300338 --proj-guid=$$($$(@:.$(VCPROJ_SFX)=).GUID)\
James Zernf66590c2014-06-02 16:42:14 -0700339 --src-path-bare="$(SRC_PATH_BARE)" \
John Koleszar0ea50ce2010-05-18 11:58:33 -0400340 $$(if $$(CONFIG_STATIC_MSVCRT),--static-crt) \
Ronald S. Bultjebbf890f2011-05-02 13:56:41 -0400341 --out=$$@ $$(INTERNAL_CFLAGS) $$(CFLAGS) \
Martin Storsjoa37e84d2013-05-19 12:21:29 +0300342 $$(INTERNAL_LDFLAGS) $$(LDFLAGS) -l$$(CODEC_LIB) $$^
John Koleszar0ea50ce2010-05-18 11:58:33 -0400343endef
James Zern77bbcab2014-02-05 16:55:01 -0800344ALL_EXAMPLES_BASENAME := $(notdir $(ALL_EXAMPLES))
345PROJECTS-$(CONFIG_MSVS) += $(ALL_EXAMPLES_BASENAME:.c=.$(VCPROJ_SFX))
John Koleszar0ea50ce2010-05-18 11:58:33 -0400346INSTALL-BINS-$(CONFIG_MSVS) += $(foreach p,$(VS_PLATFORMS),\
James Zern77bbcab2014-02-05 16:55:01 -0800347 $(addprefix bin/$(p)/,$(ALL_EXAMPLES_BASENAME:.c=.exe)))
John Koleszar0ea50ce2010-05-18 11:58:33 -0400348$(foreach proj,$(call enabled,PROJECTS),\
349 $(eval $(call vcproj_template,$(proj))))
James Zern354c5662014-02-14 19:38:20 -0800350
351#
352# Documentation Rules
353#
354%.dox: %.c
355 @echo " [DOXY] $@"
James Zernaaccf652015-02-05 19:31:38 -0800356 @mkdir -p $(dir $@)
James Zern354c5662014-02-14 19:38:20 -0800357 @echo "/*!\page example_$(@F:.dox=) $(@F:.dox=)" > $@
358 @echo " \includelineno $(<F)" >> $@
359 @echo "*/" >> $@
360
361samples.dox: examples.mk
362 @echo " [DOXY] $@"
363 @echo "/*!\page samples Sample Code" > $@
364 @echo " This SDK includes a number of sample applications."\
365 "Each sample documents a feature of the SDK in both prose"\
366 "and the associated C code."\
367 "The following samples are included: ">>$@
368 @$(foreach ex,$(sort $(notdir $(EXAMPLES:.c=))),\
369 echo " - \subpage example_$(ex) $($(ex).DESCRIPTION)" >> $@;)
370 @echo >> $@
371 @echo " In addition, the SDK contains a number of utilities."\
372 "Since these utilities are built upon the concepts described"\
373 "in the sample code listed above, they are not documented in"\
374 "pieces like the samples are. Their source is included here"\
375 "for reference. The following utilities are included:" >> $@
376 @$(foreach ex,$(sort $(UTILS:.c=)),\
377 echo " - \subpage example_$(ex) $($(ex).DESCRIPTION)" >> $@;)
378 @echo "*/" >> $@
379
380CLEAN-OBJS += examples.doxy samples.dox $(ALL_EXAMPLES:.c=.dox)
381DOCS-yes += examples.doxy samples.dox
382examples.doxy: samples.dox $(ALL_EXAMPLES:.c=.dox)
383 @echo "INPUT += $^" > $@