blob: 32993267060d09fb8ef2e66850251cc563a3a07f [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
Ryan Overbecka5fefa72017-09-19 11:39:10 -0700202ifeq ($(CONFIG_EXT_TILE),yes)
203EXAMPLES-$(CONFIG_AV1_ENCODER) += lightfield_encoder.c
204lightfield_encoder.SRCS += ivfenc.h ivfenc.c
205lightfield_encoder.SRCS += tools_common.h tools_common.c
206lightfield_encoder.SRCS += video_common.h
207lightfield_encoder.SRCS += video_writer.h video_writer.c
208lightfield_encoder.SRCS += aom_ports/msvc.h
209lightfield_encoder.GUID = 73494FA6-4AF9-4763-8FBB-265C92402FD8
210lightfield_encoder.DESCRIPTION = Lightfield encoder loop
211EXAMPLES-$(CONFIG_AV1_DECODER) += lightfield_decoder.c
212lightfield_decoder.SRCS += ivfdec.h ivfdec.c
213lightfield_decoder.SRCS += tools_common.h tools_common.c
214lightfield_decoder.SRCS += video_common.h
215lightfield_decoder.SRCS += video_reader.h video_reader.c
216lightfield_decoder.SRCS += aom_ports/mem_ops.h
217lightfield_decoder.SRCS += aom_ports/mem_ops_aligned.h
218lightfield_decoder.SRCS += aom_ports/msvc.h
219lightfield_decoder.GUID = D3BBF1E9-2427-450D-BBFF-B2843C1D44CC
220lightfield_decoder.DESCRIPTION = lightfield decoder loop
221endif
Tom Finegan378d6522017-05-22 13:04:56 -0700222ifeq ($(CONFIG_AV1_ENCODER),yes)
223ifeq ($(CONFIG_AV1_DECODER),yes)
224EXAMPLES-$(CONFIG_AV1_ENCODER) += aom_cx_set_ref.c
Yaowu Xufe24b952016-09-08 09:57:21 -0700225aom_cx_set_ref.SRCS += ivfenc.h ivfenc.c
226aom_cx_set_ref.SRCS += tools_common.h tools_common.c
Urvang Joshi09c293e2017-04-20 17:56:27 -0700227aom_cx_set_ref.SRCS += examples/encoder_util.h
228aom_cx_set_ref.SRCS += examples/encoder_util.c
Yaowu Xufe24b952016-09-08 09:57:21 -0700229aom_cx_set_ref.SRCS += video_common.h
230aom_cx_set_ref.SRCS += video_writer.h video_writer.c
231aom_cx_set_ref.SRCS += aom_ports/msvc.h
232aom_cx_set_ref.GUID = C5E31F7F-96F6-48BD-BD3E-10EBF6E8057A
233aom_cx_set_ref.DESCRIPTION = AV1 set encoder reference frame
Yunqing Wang9aaa3c92016-03-25 11:57:20 -0700234endif
235endif
Dmitry Kovalev98254a42014-01-17 16:56:04 -0800236
John Koleszar0ea50ce2010-05-18 11:58:33 -0400237# Handle extra library flags depending on codec configuration
John Koleszar0ea50ce2010-05-18 11:58:33 -0400238
Tero Rintaluoma11a222f2011-01-24 11:21:40 +0200239# We should not link to math library (libm) on RVCT
240# when building for bare-metal targets
241ifeq ($(CONFIG_OS_SUPPORT), yes)
Yaowu Xufe24b952016-09-08 09:57:21 -0700242CODEC_EXTRA_LIBS-$(CONFIG_AV1) += m
Tero Rintaluoma11a222f2011-01-24 11:21:40 +0200243else
244 ifeq ($(CONFIG_GCC), yes)
Yaowu Xuf883b422016-08-30 14:01:10 -0700245 CODEC_EXTRA_LIBS-$(CONFIG_AV1) += m
Tero Rintaluoma11a222f2011-01-24 11:21:40 +0200246 endif
247endif
John Koleszar0ea50ce2010-05-18 11:58:33 -0400248#
249# End of specified files. The rest of the build rules should happen
250# automagically from here.
251#
252
253
254# Examples need different flags based on whether we're building
255# from an installed tree or a version controlled tree. Determine
256# the proper paths.
257ifeq ($(HAVE_ALT_TREE_LAYOUT),yes)
James Zern3a7d4672014-08-10 16:15:18 -0700258 LIB_PATH-yes := $(SRC_PATH_BARE)/../lib
259 INC_PATH-yes := $(SRC_PATH_BARE)/../include
John Koleszar0ea50ce2010-05-18 11:58:33 -0400260else
261 LIB_PATH-yes += $(if $(BUILD_PFX),$(BUILD_PFX),.)
Yaowu Xuf883b422016-08-30 14:01:10 -0700262 INC_PATH-$(CONFIG_AV1_DECODER) += $(SRC_PATH_BARE)/av1
263 INC_PATH-$(CONFIG_AV1_ENCODER) += $(SRC_PATH_BARE)/av1
John Koleszar0ea50ce2010-05-18 11:58:33 -0400264endif
James Zern3a7d4672014-08-10 16:15:18 -0700265INC_PATH-$(CONFIG_LIBYUV) += $(SRC_PATH_BARE)/third_party/libyuv/include
266LIB_PATH := $(call enabled,LIB_PATH)
267INC_PATH := $(call enabled,INC_PATH)
Ronald S. Bultjebbf890f2011-05-02 13:56:41 -0400268INTERNAL_CFLAGS = $(addprefix -I,$(INC_PATH))
269INTERNAL_LDFLAGS += $(addprefix -L,$(LIB_PATH))
John Koleszar0ea50ce2010-05-18 11:58:33 -0400270
271
272# Expand list of selected examples to build (as specified above)
273UTILS = $(call enabled,UTILS)
James Zern77bbcab2014-02-05 16:55:01 -0800274EXAMPLES = $(addprefix examples/,$(call enabled,EXAMPLES))
275ALL_EXAMPLES = $(UTILS) $(EXAMPLES)
Tom Finegan252453b2017-03-07 14:20:11 -0800276UTIL_SRCS = $(foreach ex,$(UTILS),$($(ex:.c=).SRCS) $($(ex:.cc=).SRCS))
277ALL_SRCS = $(foreach ex, $(ALL_EXAMPLES), \
278 $($(notdir $(ex:.c=)).SRCS) \
279 $($(notdir $(ex:.cc=)).SRCS))
John Koleszar0ea50ce2010-05-18 11:58:33 -0400280CODEC_EXTRA_LIBS=$(sort $(call enabled,CODEC_EXTRA_LIBS))
281
282
283# Expand all example sources into a variable containing all sources
James Zern77bbcab2014-02-05 16:55:01 -0800284# for that example (not just them main one specified in UTILS/EXAMPLES)
John Koleszar0ea50ce2010-05-18 11:58:33 -0400285# and add this file to the list (for MSVS workspace generation)
Tom Finegan252453b2017-03-07 14:20:11 -0800286EXAMPLES_C = $(filter-out %.cc, $(ALL_EXAMPLES))
287$(foreach ex,$(EXAMPLES_C), \
288 $(eval $(notdir $(ex:.c=)).SRCS += $(ex) examples.mk))
289EXAMPLES_CXX = $(filter-out %.c, $(ALL_EXAMPLES))
290$(foreach ex,$(EXAMPLES_CXX), \
291 $(eval $(notdir $(ex:.cc=)).SRCS += $(ex) examples.mk))
John Koleszar0ea50ce2010-05-18 11:58:33 -0400292
John Koleszar0ea50ce2010-05-18 11:58:33 -0400293# Create build/install dependencies for all examples. The common case
294# is handled here. The MSVS case is handled below.
295NOT_MSVS = $(if $(CONFIG_MSVS),,yes)
Tom Finegan252453b2017-03-07 14:20:11 -0800296DIST-BINS-$(NOT_MSVS) += $(addprefix bin/,$(EXAMPLES_C:.c=$(EXE_SFX)))
297DIST-BINS-$(NOT_MSVS) += $(addprefix bin/,$(EXAMPLES_CXX:.cc=$(EXE_SFX)))
KO Myung-Hun2dad8d62012-02-03 13:31:11 +0900298INSTALL-BINS-$(NOT_MSVS) += $(addprefix bin/,$(UTILS:.c=$(EXE_SFX)))
John Koleszaree8bcb12010-05-24 10:16:44 -0400299DIST-SRCS-yes += $(ALL_SRCS)
300INSTALL-SRCS-yes += $(UTIL_SRCS)
Tom Finegan3d7063d2015-05-12 15:33:40 -0700301OBJS-$(NOT_MSVS) += $(call objs,$(ALL_SRCS))
Tom Finegan252453b2017-03-07 14:20:11 -0800302BINS-$(NOT_MSVS) += $(addprefix $(BUILD_PFX), \
303 $(EXAMPLES_C:.c=$(EXE_SFX)))
304BINS-$(NOT_MSVS) += $(addprefix $(BUILD_PFX), \
305 $(EXAMPLES_CXX:.cc=$(EXE_SFX)))
John Koleszar0ea50ce2010-05-18 11:58:33 -0400306
307# Instantiate linker template for all examples.
Yaowu Xuc27fc142016-08-22 16:08:15 -0700308CODEC_LIB=$(if $(CONFIG_DEBUG_LIBS),aom_g,aom)
KO Myung-Hun6d52fe22014-08-08 13:13:02 +0900309ifneq ($(filter darwin%,$(TGT_OS)),)
310SHARED_LIB_SUF=.dylib
311else
312ifneq ($(filter os2%,$(TGT_OS)),)
313SHARED_LIB_SUF=_dll.a
314else
315SHARED_LIB_SUF=.so
316endif
317endif
jimbankoski45e551b2012-07-25 19:39:33 -0700318CODEC_LIB_SUF=$(if $(CONFIG_SHARED),$(SHARED_LIB_SUF),.a)
John Koleszar0ea50ce2010-05-18 11:58:33 -0400319$(foreach bin,$(BINS-yes),\
Tom Finegan3d7063d2015-05-12 15:33:40 -0700320 $(eval $(bin):$(LIB_PATH)/lib$(CODEC_LIB)$(CODEC_LIB_SUF))\
321 $(eval $(call linker_template,$(bin),\
KO Myung-Hun2dad8d62012-02-03 13:31:11 +0900322 $(call objs,$($(notdir $(bin:$(EXE_SFX)=)).SRCS)) \
John Koleszar0ea50ce2010-05-18 11:58:33 -0400323 -l$(CODEC_LIB) $(addprefix -l,$(CODEC_EXTRA_LIBS))\
Tom Finegan3d7063d2015-05-12 15:33:40 -0700324 )))
John Koleszar0ea50ce2010-05-18 11:58:33 -0400325
John Koleszar0ea50ce2010-05-18 11:58:33 -0400326# The following pairs define a mapping of locations in the distribution
327# tree to locations in the source/build trees.
328INSTALL_MAPS += src/%.c %.c
329INSTALL_MAPS += src/% $(SRC_PATH_BARE)/%
330INSTALL_MAPS += bin/% %
331INSTALL_MAPS += % %
332
333
334# Set up additional MSVS environment
335ifeq ($(CONFIG_MSVS),yes)
Yaowu Xuf883b422016-08-30 14:01:10 -0700336CODEC_LIB=$(if $(CONFIG_SHARED),aom,$(if $(CONFIG_STATIC_MSVCRT),aommt,aommd))
John Koleszar0ea50ce2010-05-18 11:58:33 -0400337# This variable uses deferred expansion intentionally, since the results of
338# $(wildcard) may change during the course of the Make.
339VS_PLATFORMS = $(foreach d,$(wildcard */Release/$(CODEC_LIB).lib),$(word 1,$(subst /, ,$(d))))
340INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),bin/$(p)/% $(p)/Release/%)
341endif
342
343# Build Visual Studio Projects. We use a template here to instantiate
344# explicit rules rather than using an implicit rule because we want to
345# leverage make's VPATH searching rather than specifying the paths on
346# each file in ALL_EXAMPLES. This has the unfortunate side effect that
347# touching the source files trigger a rebuild of the project files
348# even though there is no real dependency there (the dependency is on
349# the makefiles). We may want to revisit this.
350define vcproj_template
Yaowu Xuf883b422016-08-30 14:01:10 -0700351$(1): $($(1:.$(VCPROJ_SFX)=).SRCS) aom.$(VCPROJ_SFX)
James Zerna2746d72015-08-03 16:24:24 -0700352 $(if $(quiet),@echo " [vcproj] $$@")
353 $(qexec)$$(GEN_VCPROJ)\
John Koleszar0ea50ce2010-05-18 11:58:33 -0400354 --exe\
355 --target=$$(TOOLCHAIN)\
Martin Storsjo0b4637e2013-05-17 00:56:46 +0300356 --name=$$(@:.$(VCPROJ_SFX)=)\
John Koleszar0ea50ce2010-05-18 11:58:33 -0400357 --ver=$$(CONFIG_VS_VERSION)\
Martin Storsjo0b4637e2013-05-17 00:56:46 +0300358 --proj-guid=$$($$(@:.$(VCPROJ_SFX)=).GUID)\
James Zernf66590c2014-06-02 16:42:14 -0700359 --src-path-bare="$(SRC_PATH_BARE)" \
John Koleszar0ea50ce2010-05-18 11:58:33 -0400360 $$(if $$(CONFIG_STATIC_MSVCRT),--static-crt) \
Ronald S. Bultjebbf890f2011-05-02 13:56:41 -0400361 --out=$$@ $$(INTERNAL_CFLAGS) $$(CFLAGS) \
Martin Storsjoa37e84d2013-05-19 12:21:29 +0300362 $$(INTERNAL_LDFLAGS) $$(LDFLAGS) -l$$(CODEC_LIB) $$^
John Koleszar0ea50ce2010-05-18 11:58:33 -0400363endef
James Zern77bbcab2014-02-05 16:55:01 -0800364ALL_EXAMPLES_BASENAME := $(notdir $(ALL_EXAMPLES))
365PROJECTS-$(CONFIG_MSVS) += $(ALL_EXAMPLES_BASENAME:.c=.$(VCPROJ_SFX))
John Koleszar0ea50ce2010-05-18 11:58:33 -0400366INSTALL-BINS-$(CONFIG_MSVS) += $(foreach p,$(VS_PLATFORMS),\
James Zern77bbcab2014-02-05 16:55:01 -0800367 $(addprefix bin/$(p)/,$(ALL_EXAMPLES_BASENAME:.c=.exe)))
John Koleszar0ea50ce2010-05-18 11:58:33 -0400368$(foreach proj,$(call enabled,PROJECTS),\
369 $(eval $(call vcproj_template,$(proj))))
James Zern354c5662014-02-14 19:38:20 -0800370
371#
372# Documentation Rules
373#
374%.dox: %.c
375 @echo " [DOXY] $@"
James Zernaaccf652015-02-05 19:31:38 -0800376 @mkdir -p $(dir $@)
James Zern354c5662014-02-14 19:38:20 -0800377 @echo "/*!\page example_$(@F:.dox=) $(@F:.dox=)" > $@
378 @echo " \includelineno $(<F)" >> $@
379 @echo "*/" >> $@
380
381samples.dox: examples.mk
382 @echo " [DOXY] $@"
383 @echo "/*!\page samples Sample Code" > $@
384 @echo " This SDK includes a number of sample applications."\
385 "Each sample documents a feature of the SDK in both prose"\
386 "and the associated C code."\
387 "The following samples are included: ">>$@
388 @$(foreach ex,$(sort $(notdir $(EXAMPLES:.c=))),\
389 echo " - \subpage example_$(ex) $($(ex).DESCRIPTION)" >> $@;)
390 @echo >> $@
391 @echo " In addition, the SDK contains a number of utilities."\
392 "Since these utilities are built upon the concepts described"\
393 "in the sample code listed above, they are not documented in"\
394 "pieces like the samples are. Their source is included here"\
395 "for reference. The following utilities are included:" >> $@
396 @$(foreach ex,$(sort $(UTILS:.c=)),\
397 echo " - \subpage example_$(ex) $($(ex).DESCRIPTION)" >> $@;)
398 @echo "*/" >> $@
399
400CLEAN-OBJS += examples.doxy samples.dox $(ALL_EXAMPLES:.c=.dox)
401DOCS-yes += examples.doxy samples.dox
402examples.doxy: samples.dox $(ALL_EXAMPLES:.c=.dox)
403 @echo "INPUT += $^" > $@