blob: dd59880b6e22b614d12522c2760de2ff0ba96da8 [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
Cyril Concolato6c788832017-10-30 16:30:35 -070087ifeq ($(CONFIG_OBU_NO_IVF),yes)
88 aomdec.SRCS += obudec.c obudec.h
89endif
Yaowu Xuf883b422016-08-30 14:01:10 -070090aomdec.GUID = BA5FE66F-38DD-E034-F542-B1578C5FB950
91aomdec.DESCRIPTION = Full featured decoder
Tom Finegan378d6522017-05-22 13:04:56 -070092UTILS-$(CONFIG_AV1_ENCODER) += aomenc.c
Yaowu Xuf883b422016-08-30 14:01:10 -070093aomenc.SRCS += args.c args.h y4minput.c y4minput.h aomenc.h
94aomenc.SRCS += ivfdec.c ivfdec.h
95aomenc.SRCS += ivfenc.c ivfenc.h
96aomenc.SRCS += rate_hist.c rate_hist.h
97aomenc.SRCS += tools_common.c tools_common.h
Urvang Joshi09c293e2017-04-20 17:56:27 -070098aomenc.SRCS += examples/encoder_util.h examples/encoder_util.c
Yaowu Xuf883b422016-08-30 14:01:10 -070099aomenc.SRCS += warnings.c warnings.h
100aomenc.SRCS += aom_ports/mem_ops.h
101aomenc.SRCS += aom_ports/mem_ops_aligned.h
102aomenc.SRCS += aom_ports/msvc.h
103aomenc.SRCS += aom_ports/aom_timer.h
104aomenc.SRCS += aomstats.c aomstats.h
Deb Mukherjee47031c02014-05-16 18:52:01 -0700105ifeq ($(CONFIG_LIBYUV),yes)
Yaowu Xuf883b422016-08-30 14:01:10 -0700106 aomenc.SRCS += $(LIBYUV_SRCS)
Deb Mukherjee47031c02014-05-16 18:52:01 -0700107endif
Vignesh Venkatasubramanian0ffa3832014-03-14 08:10:35 -0700108ifeq ($(CONFIG_WEBM_IO),yes)
Yaowu Xuf883b422016-08-30 14:01:10 -0700109 aomenc.SRCS += $(LIBWEBM_COMMON_SRCS)
110 aomenc.SRCS += $(LIBWEBM_MUXER_SRCS)
111 aomenc.SRCS += $(LIBWEBM_PARSER_SRCS)
112 aomenc.SRCS += webmenc.cc webmenc.h
Vignesh Venkatasubramanian0ffa3832014-03-14 08:10:35 -0700113endif
Yaowu Xuf883b422016-08-30 14:01:10 -0700114aomenc.GUID = 548DEC74-7A15-4B2B-AFC3-AA102E7C25C1
115aomenc.DESCRIPTION = Full featured encoder
John Koleszarea68ee02010-10-21 15:02:10 -0400116
Nathan E. Egge1a0d5ea2017-02-22 11:17:00 -0500117ifeq ($(CONFIG_ANALYZER),yes)
Tom Finegan378d6522017-05-22 13:04:56 -0700118 EXAMPLES-$(CONFIG_AV1_DECODER) += analyzer.cc
Nathan E. Egge1a0d5ea2017-02-22 11:17:00 -0500119 analyzer.GUID = 83827a8c-e3c3-4b19-8832-0cfc206c4496
120 analyzer.SRCS += ivfdec.h ivfdec.c
121 analyzer.SRCS += av1/decoder/inspection.h
122 analyzer.SRCS += av1/decoder/inspection.c
123 analyzer.SRCS += video_reader.h video_reader.c
124 analyzer.SRCS += tools_common.h tools_common.c
125 analyzer.DESCRIPTION = Bitstream analyzer
126endif
127
Michael Bebenitaf4f27fe2017-03-02 17:40:44 -0800128ifeq ($(CONFIG_INSPECTION),yes)
Tom Finegan378d6522017-05-22 13:04:56 -0700129EXAMPLES-$(CONFIG_AV1_DECODER) += inspect.c
130inspect.GUID = FA46A420-3356-441F-B0FD-60AA1345C181
131inspect.SRCS += ivfdec.h ivfdec.c
132inspect.SRCS += args.c args.h
133inspect.SRCS += tools_common.h tools_common.c
134inspect.SRCS += video_common.h
135inspect.SRCS += video_reader.h video_reader.c
136inspect.SRCS += aom_ports/mem_ops.h
137inspect.SRCS += aom_ports/mem_ops_aligned.h
138inspect.SRCS += aom_ports/msvc.h
139inspect.DESCRIPTION = Dump inspection data
Michael Bebenitaf4f27fe2017-03-02 17:40:44 -0800140endif
141
Tom Finegan378d6522017-05-22 13:04:56 -0700142EXAMPLES-$(CONFIG_AV1_DECODER) += simple_decoder.c
James Zern77bbcab2014-02-05 16:55:01 -0800143simple_decoder.GUID = D3BBF1E9-2427-450D-BBFF-B2843C1D44CC
Dmitry Kovalev7ec27692014-01-27 13:40:29 -0800144simple_decoder.SRCS += ivfdec.h ivfdec.c
145simple_decoder.SRCS += tools_common.h tools_common.c
Dmitry Kovalev37e6fd32014-02-05 18:34:46 -0800146simple_decoder.SRCS += video_common.h
147simple_decoder.SRCS += video_reader.h video_reader.c
Yaowu Xuc27fc142016-08-22 16:08:15 -0700148simple_decoder.SRCS += aom_ports/mem_ops.h
149simple_decoder.SRCS += aom_ports/mem_ops_aligned.h
150simple_decoder.SRCS += aom_ports/msvc.h
James Zern77bbcab2014-02-05 16:55:01 -0800151simple_decoder.DESCRIPTION = Simplified decoder loop
Tom Finegan378d6522017-05-22 13:04:56 -0700152EXAMPLES-$(CONFIG_AV1_DECODER) += decode_to_md5.c
Dmitry Kovalevc2b33682014-01-24 11:20:09 -0800153decode_to_md5.SRCS += md5_utils.h md5_utils.c
154decode_to_md5.SRCS += ivfdec.h ivfdec.c
155decode_to_md5.SRCS += tools_common.h tools_common.c
Dmitry Kovalev37e6fd32014-02-05 18:34:46 -0800156decode_to_md5.SRCS += video_common.h
157decode_to_md5.SRCS += video_reader.h video_reader.c
Yaowu Xuc27fc142016-08-22 16:08:15 -0700158decode_to_md5.SRCS += aom_ports/mem_ops.h
159decode_to_md5.SRCS += aom_ports/mem_ops_aligned.h
160decode_to_md5.SRCS += aom_ports/msvc.h
James Zern77bbcab2014-02-05 16:55:01 -0800161decode_to_md5.GUID = 59120B9B-2735-4BFE-B022-146CA340FE42
162decode_to_md5.DESCRIPTION = Frame by frame MD5 checksum
Tom Finegan378d6522017-05-22 13:04:56 -0700163EXAMPLES-$(CONFIG_AV1_ENCODER) += simple_encoder.c
Dmitry Kovalev37e6fd32014-02-05 18:34:46 -0800164simple_encoder.SRCS += ivfenc.h ivfenc.c
165simple_encoder.SRCS += tools_common.h tools_common.c
166simple_encoder.SRCS += video_common.h
167simple_encoder.SRCS += video_writer.h video_writer.c
Yaowu Xuc27fc142016-08-22 16:08:15 -0700168simple_encoder.SRCS += aom_ports/msvc.h
John Koleszar0ea50ce2010-05-18 11:58:33 -0400169simple_encoder.GUID = 4607D299-8A71-4D2C-9B1D-071899B6FBFD
170simple_encoder.DESCRIPTION = Simplified encoder loop
Yaowu Xudef1a3d2016-09-23 15:37:46 -0700171EXAMPLES-$(CONFIG_AV1_ENCODER) += lossless_encoder.c
Yaowu Xu5eee9072016-07-28 11:51:48 -0700172lossless_encoder.SRCS += ivfenc.h ivfenc.c
173lossless_encoder.SRCS += tools_common.h tools_common.c
174lossless_encoder.SRCS += video_common.h
175lossless_encoder.SRCS += video_writer.h video_writer.c
Yaowu Xuc27fc142016-08-22 16:08:15 -0700176lossless_encoder.SRCS += aom_ports/msvc.h
Yaowu Xu5eee9072016-07-28 11:51:48 -0700177lossless_encoder.GUID = B63C7C88-5348-46DC-A5A6-CC151EF93366
Yaowu Xua3cff082016-08-03 11:33:39 -0700178lossless_encoder.DESCRIPTION = Simplified lossless encoder
Tom Finegan378d6522017-05-22 13:04:56 -0700179EXAMPLES-$(CONFIG_AV1_ENCODER) += twopass_encoder.c
Dmitry Kovalev592936b2014-02-07 11:37:39 -0800180twopass_encoder.SRCS += ivfenc.h ivfenc.c
181twopass_encoder.SRCS += tools_common.h tools_common.c
182twopass_encoder.SRCS += video_common.h
183twopass_encoder.SRCS += video_writer.h video_writer.c
Yaowu Xuc27fc142016-08-22 16:08:15 -0700184twopass_encoder.SRCS += aom_ports/msvc.h
John Koleszar0ea50ce2010-05-18 11:58:33 -0400185twopass_encoder.GUID = 73494FA6-4AF9-4763-8FBB-265C92402FD8
186twopass_encoder.DESCRIPTION = Two-pass encoder loop
Tom Finegan378d6522017-05-22 13:04:56 -0700187EXAMPLES-$(CONFIG_AV1_DECODER) += decode_with_drops.c
James Zern77bbcab2014-02-05 16:55:01 -0800188decode_with_drops.SRCS += ivfdec.h ivfdec.c
189decode_with_drops.SRCS += tools_common.h tools_common.c
Dmitry Kovalev37e6fd32014-02-05 18:34:46 -0800190decode_with_drops.SRCS += video_common.h
191decode_with_drops.SRCS += video_reader.h video_reader.c
Yaowu Xuc27fc142016-08-22 16:08:15 -0700192decode_with_drops.SRCS += aom_ports/mem_ops.h
193decode_with_drops.SRCS += aom_ports/mem_ops_aligned.h
194decode_with_drops.SRCS += aom_ports/msvc.h
John Koleszar0ea50ce2010-05-18 11:58:33 -0400195decode_with_drops.GUID = CE5C53C4-8DDA-438A-86ED-0DDD3CDB8D26
196decode_with_drops.DESCRIPTION = Drops frames while decoding
Tom Finegan378d6522017-05-22 13:04:56 -0700197EXAMPLES-$(CONFIG_AV1_ENCODER) += set_maps.c
Alex Converse61ecd7f2014-03-10 16:13:49 -0700198set_maps.SRCS += ivfenc.h ivfenc.c
199set_maps.SRCS += tools_common.h tools_common.c
200set_maps.SRCS += video_common.h
201set_maps.SRCS += video_writer.h video_writer.c
Yaowu Xuc27fc142016-08-22 16:08:15 -0700202set_maps.SRCS += aom_ports/msvc.h
Alex Converse61ecd7f2014-03-10 16:13:49 -0700203set_maps.GUID = ECB2D24D-98B8-4015-A465-A4AF3DCC145F
204set_maps.DESCRIPTION = Set active and ROI maps
Ryan Overbecka5fefa72017-09-19 11:39:10 -0700205ifeq ($(CONFIG_EXT_TILE),yes)
206EXAMPLES-$(CONFIG_AV1_ENCODER) += lightfield_encoder.c
207lightfield_encoder.SRCS += ivfenc.h ivfenc.c
208lightfield_encoder.SRCS += tools_common.h tools_common.c
209lightfield_encoder.SRCS += video_common.h
210lightfield_encoder.SRCS += video_writer.h video_writer.c
211lightfield_encoder.SRCS += aom_ports/msvc.h
212lightfield_encoder.GUID = 73494FA6-4AF9-4763-8FBB-265C92402FD8
213lightfield_encoder.DESCRIPTION = Lightfield encoder loop
214EXAMPLES-$(CONFIG_AV1_DECODER) += lightfield_decoder.c
215lightfield_decoder.SRCS += ivfdec.h ivfdec.c
216lightfield_decoder.SRCS += tools_common.h tools_common.c
217lightfield_decoder.SRCS += video_common.h
218lightfield_decoder.SRCS += video_reader.h video_reader.c
219lightfield_decoder.SRCS += aom_ports/mem_ops.h
220lightfield_decoder.SRCS += aom_ports/mem_ops_aligned.h
221lightfield_decoder.SRCS += aom_ports/msvc.h
222lightfield_decoder.GUID = D3BBF1E9-2427-450D-BBFF-B2843C1D44CC
223lightfield_decoder.DESCRIPTION = lightfield decoder loop
224endif
Tom Finegan378d6522017-05-22 13:04:56 -0700225ifeq ($(CONFIG_AV1_ENCODER),yes)
226ifeq ($(CONFIG_AV1_DECODER),yes)
227EXAMPLES-$(CONFIG_AV1_ENCODER) += aom_cx_set_ref.c
Yaowu Xufe24b952016-09-08 09:57:21 -0700228aom_cx_set_ref.SRCS += ivfenc.h ivfenc.c
229aom_cx_set_ref.SRCS += tools_common.h tools_common.c
Urvang Joshi09c293e2017-04-20 17:56:27 -0700230aom_cx_set_ref.SRCS += examples/encoder_util.h
231aom_cx_set_ref.SRCS += examples/encoder_util.c
Yaowu Xufe24b952016-09-08 09:57:21 -0700232aom_cx_set_ref.SRCS += video_common.h
233aom_cx_set_ref.SRCS += video_writer.h video_writer.c
234aom_cx_set_ref.SRCS += aom_ports/msvc.h
235aom_cx_set_ref.GUID = C5E31F7F-96F6-48BD-BD3E-10EBF6E8057A
236aom_cx_set_ref.DESCRIPTION = AV1 set encoder reference frame
Yunqing Wang9aaa3c92016-03-25 11:57:20 -0700237endif
238endif
Dmitry Kovalev98254a42014-01-17 16:56:04 -0800239
John Koleszar0ea50ce2010-05-18 11:58:33 -0400240# Handle extra library flags depending on codec configuration
John Koleszar0ea50ce2010-05-18 11:58:33 -0400241
Tero Rintaluoma11a222f2011-01-24 11:21:40 +0200242# We should not link to math library (libm) on RVCT
243# when building for bare-metal targets
244ifeq ($(CONFIG_OS_SUPPORT), yes)
Yaowu Xufe24b952016-09-08 09:57:21 -0700245CODEC_EXTRA_LIBS-$(CONFIG_AV1) += m
Tero Rintaluoma11a222f2011-01-24 11:21:40 +0200246else
247 ifeq ($(CONFIG_GCC), yes)
Yaowu Xuf883b422016-08-30 14:01:10 -0700248 CODEC_EXTRA_LIBS-$(CONFIG_AV1) += m
Tero Rintaluoma11a222f2011-01-24 11:21:40 +0200249 endif
250endif
John Koleszar0ea50ce2010-05-18 11:58:33 -0400251#
252# End of specified files. The rest of the build rules should happen
253# automagically from here.
254#
255
256
257# Examples need different flags based on whether we're building
258# from an installed tree or a version controlled tree. Determine
259# the proper paths.
260ifeq ($(HAVE_ALT_TREE_LAYOUT),yes)
James Zern3a7d4672014-08-10 16:15:18 -0700261 LIB_PATH-yes := $(SRC_PATH_BARE)/../lib
262 INC_PATH-yes := $(SRC_PATH_BARE)/../include
John Koleszar0ea50ce2010-05-18 11:58:33 -0400263else
264 LIB_PATH-yes += $(if $(BUILD_PFX),$(BUILD_PFX),.)
Yaowu Xuf883b422016-08-30 14:01:10 -0700265 INC_PATH-$(CONFIG_AV1_DECODER) += $(SRC_PATH_BARE)/av1
266 INC_PATH-$(CONFIG_AV1_ENCODER) += $(SRC_PATH_BARE)/av1
John Koleszar0ea50ce2010-05-18 11:58:33 -0400267endif
James Zern3a7d4672014-08-10 16:15:18 -0700268INC_PATH-$(CONFIG_LIBYUV) += $(SRC_PATH_BARE)/third_party/libyuv/include
269LIB_PATH := $(call enabled,LIB_PATH)
270INC_PATH := $(call enabled,INC_PATH)
Ronald S. Bultjebbf890f2011-05-02 13:56:41 -0400271INTERNAL_CFLAGS = $(addprefix -I,$(INC_PATH))
272INTERNAL_LDFLAGS += $(addprefix -L,$(LIB_PATH))
John Koleszar0ea50ce2010-05-18 11:58:33 -0400273
274
275# Expand list of selected examples to build (as specified above)
276UTILS = $(call enabled,UTILS)
James Zern77bbcab2014-02-05 16:55:01 -0800277EXAMPLES = $(addprefix examples/,$(call enabled,EXAMPLES))
278ALL_EXAMPLES = $(UTILS) $(EXAMPLES)
Tom Finegan252453b2017-03-07 14:20:11 -0800279UTIL_SRCS = $(foreach ex,$(UTILS),$($(ex:.c=).SRCS) $($(ex:.cc=).SRCS))
280ALL_SRCS = $(foreach ex, $(ALL_EXAMPLES), \
281 $($(notdir $(ex:.c=)).SRCS) \
282 $($(notdir $(ex:.cc=)).SRCS))
John Koleszar0ea50ce2010-05-18 11:58:33 -0400283CODEC_EXTRA_LIBS=$(sort $(call enabled,CODEC_EXTRA_LIBS))
284
285
286# Expand all example sources into a variable containing all sources
James Zern77bbcab2014-02-05 16:55:01 -0800287# for that example (not just them main one specified in UTILS/EXAMPLES)
John Koleszar0ea50ce2010-05-18 11:58:33 -0400288# and add this file to the list (for MSVS workspace generation)
Tom Finegan252453b2017-03-07 14:20:11 -0800289EXAMPLES_C = $(filter-out %.cc, $(ALL_EXAMPLES))
290$(foreach ex,$(EXAMPLES_C), \
291 $(eval $(notdir $(ex:.c=)).SRCS += $(ex) examples.mk))
292EXAMPLES_CXX = $(filter-out %.c, $(ALL_EXAMPLES))
293$(foreach ex,$(EXAMPLES_CXX), \
294 $(eval $(notdir $(ex:.cc=)).SRCS += $(ex) examples.mk))
John Koleszar0ea50ce2010-05-18 11:58:33 -0400295
John Koleszar0ea50ce2010-05-18 11:58:33 -0400296# Create build/install dependencies for all examples. The common case
297# is handled here. The MSVS case is handled below.
298NOT_MSVS = $(if $(CONFIG_MSVS),,yes)
Tom Finegan252453b2017-03-07 14:20:11 -0800299DIST-BINS-$(NOT_MSVS) += $(addprefix bin/,$(EXAMPLES_C:.c=$(EXE_SFX)))
300DIST-BINS-$(NOT_MSVS) += $(addprefix bin/,$(EXAMPLES_CXX:.cc=$(EXE_SFX)))
KO Myung-Hun2dad8d62012-02-03 13:31:11 +0900301INSTALL-BINS-$(NOT_MSVS) += $(addprefix bin/,$(UTILS:.c=$(EXE_SFX)))
John Koleszaree8bcb12010-05-24 10:16:44 -0400302DIST-SRCS-yes += $(ALL_SRCS)
303INSTALL-SRCS-yes += $(UTIL_SRCS)
Tom Finegan3d7063d2015-05-12 15:33:40 -0700304OBJS-$(NOT_MSVS) += $(call objs,$(ALL_SRCS))
Tom Finegan252453b2017-03-07 14:20:11 -0800305BINS-$(NOT_MSVS) += $(addprefix $(BUILD_PFX), \
306 $(EXAMPLES_C:.c=$(EXE_SFX)))
307BINS-$(NOT_MSVS) += $(addprefix $(BUILD_PFX), \
308 $(EXAMPLES_CXX:.cc=$(EXE_SFX)))
John Koleszar0ea50ce2010-05-18 11:58:33 -0400309
310# Instantiate linker template for all examples.
Yaowu Xuc27fc142016-08-22 16:08:15 -0700311CODEC_LIB=$(if $(CONFIG_DEBUG_LIBS),aom_g,aom)
KO Myung-Hun6d52fe22014-08-08 13:13:02 +0900312ifneq ($(filter darwin%,$(TGT_OS)),)
313SHARED_LIB_SUF=.dylib
314else
315ifneq ($(filter os2%,$(TGT_OS)),)
316SHARED_LIB_SUF=_dll.a
317else
318SHARED_LIB_SUF=.so
319endif
320endif
jimbankoski45e551b2012-07-25 19:39:33 -0700321CODEC_LIB_SUF=$(if $(CONFIG_SHARED),$(SHARED_LIB_SUF),.a)
John Koleszar0ea50ce2010-05-18 11:58:33 -0400322$(foreach bin,$(BINS-yes),\
Tom Finegan3d7063d2015-05-12 15:33:40 -0700323 $(eval $(bin):$(LIB_PATH)/lib$(CODEC_LIB)$(CODEC_LIB_SUF))\
324 $(eval $(call linker_template,$(bin),\
KO Myung-Hun2dad8d62012-02-03 13:31:11 +0900325 $(call objs,$($(notdir $(bin:$(EXE_SFX)=)).SRCS)) \
John Koleszar0ea50ce2010-05-18 11:58:33 -0400326 -l$(CODEC_LIB) $(addprefix -l,$(CODEC_EXTRA_LIBS))\
Tom Finegan3d7063d2015-05-12 15:33:40 -0700327 )))
John Koleszar0ea50ce2010-05-18 11:58:33 -0400328
John Koleszar0ea50ce2010-05-18 11:58:33 -0400329# The following pairs define a mapping of locations in the distribution
330# tree to locations in the source/build trees.
331INSTALL_MAPS += src/%.c %.c
332INSTALL_MAPS += src/% $(SRC_PATH_BARE)/%
333INSTALL_MAPS += bin/% %
334INSTALL_MAPS += % %
335
336
337# Set up additional MSVS environment
338ifeq ($(CONFIG_MSVS),yes)
Yaowu Xuf883b422016-08-30 14:01:10 -0700339CODEC_LIB=$(if $(CONFIG_SHARED),aom,$(if $(CONFIG_STATIC_MSVCRT),aommt,aommd))
John Koleszar0ea50ce2010-05-18 11:58:33 -0400340# This variable uses deferred expansion intentionally, since the results of
341# $(wildcard) may change during the course of the Make.
342VS_PLATFORMS = $(foreach d,$(wildcard */Release/$(CODEC_LIB).lib),$(word 1,$(subst /, ,$(d))))
343INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),bin/$(p)/% $(p)/Release/%)
344endif
345
346# Build Visual Studio Projects. We use a template here to instantiate
347# explicit rules rather than using an implicit rule because we want to
348# leverage make's VPATH searching rather than specifying the paths on
349# each file in ALL_EXAMPLES. This has the unfortunate side effect that
350# touching the source files trigger a rebuild of the project files
351# even though there is no real dependency there (the dependency is on
352# the makefiles). We may want to revisit this.
353define vcproj_template
Yaowu Xuf883b422016-08-30 14:01:10 -0700354$(1): $($(1:.$(VCPROJ_SFX)=).SRCS) aom.$(VCPROJ_SFX)
James Zerna2746d72015-08-03 16:24:24 -0700355 $(if $(quiet),@echo " [vcproj] $$@")
356 $(qexec)$$(GEN_VCPROJ)\
John Koleszar0ea50ce2010-05-18 11:58:33 -0400357 --exe\
358 --target=$$(TOOLCHAIN)\
Martin Storsjo0b4637e2013-05-17 00:56:46 +0300359 --name=$$(@:.$(VCPROJ_SFX)=)\
John Koleszar0ea50ce2010-05-18 11:58:33 -0400360 --ver=$$(CONFIG_VS_VERSION)\
Martin Storsjo0b4637e2013-05-17 00:56:46 +0300361 --proj-guid=$$($$(@:.$(VCPROJ_SFX)=).GUID)\
James Zernf66590c2014-06-02 16:42:14 -0700362 --src-path-bare="$(SRC_PATH_BARE)" \
John Koleszar0ea50ce2010-05-18 11:58:33 -0400363 $$(if $$(CONFIG_STATIC_MSVCRT),--static-crt) \
Ronald S. Bultjebbf890f2011-05-02 13:56:41 -0400364 --out=$$@ $$(INTERNAL_CFLAGS) $$(CFLAGS) \
Martin Storsjoa37e84d2013-05-19 12:21:29 +0300365 $$(INTERNAL_LDFLAGS) $$(LDFLAGS) -l$$(CODEC_LIB) $$^
John Koleszar0ea50ce2010-05-18 11:58:33 -0400366endef
James Zern77bbcab2014-02-05 16:55:01 -0800367ALL_EXAMPLES_BASENAME := $(notdir $(ALL_EXAMPLES))
368PROJECTS-$(CONFIG_MSVS) += $(ALL_EXAMPLES_BASENAME:.c=.$(VCPROJ_SFX))
John Koleszar0ea50ce2010-05-18 11:58:33 -0400369INSTALL-BINS-$(CONFIG_MSVS) += $(foreach p,$(VS_PLATFORMS),\
James Zern77bbcab2014-02-05 16:55:01 -0800370 $(addprefix bin/$(p)/,$(ALL_EXAMPLES_BASENAME:.c=.exe)))
John Koleszar0ea50ce2010-05-18 11:58:33 -0400371$(foreach proj,$(call enabled,PROJECTS),\
372 $(eval $(call vcproj_template,$(proj))))
James Zern354c5662014-02-14 19:38:20 -0800373
374#
375# Documentation Rules
376#
377%.dox: %.c
378 @echo " [DOXY] $@"
James Zernaaccf652015-02-05 19:31:38 -0800379 @mkdir -p $(dir $@)
James Zern354c5662014-02-14 19:38:20 -0800380 @echo "/*!\page example_$(@F:.dox=) $(@F:.dox=)" > $@
381 @echo " \includelineno $(<F)" >> $@
382 @echo "*/" >> $@
383
384samples.dox: examples.mk
385 @echo " [DOXY] $@"
386 @echo "/*!\page samples Sample Code" > $@
387 @echo " This SDK includes a number of sample applications."\
388 "Each sample documents a feature of the SDK in both prose"\
389 "and the associated C code."\
390 "The following samples are included: ">>$@
391 @$(foreach ex,$(sort $(notdir $(EXAMPLES:.c=))),\
392 echo " - \subpage example_$(ex) $($(ex).DESCRIPTION)" >> $@;)
393 @echo >> $@
394 @echo " In addition, the SDK contains a number of utilities."\
395 "Since these utilities are built upon the concepts described"\
396 "in the sample code listed above, they are not documented in"\
397 "pieces like the samples are. Their source is included here"\
398 "for reference. The following utilities are included:" >> $@
399 @$(foreach ex,$(sort $(UTILS:.c=)),\
400 echo " - \subpage example_$(ex) $($(ex).DESCRIPTION)" >> $@;)
401 @echo "*/" >> $@
402
403CLEAN-OBJS += examples.doxy samples.dox $(ALL_EXAMPLES:.c=.dox)
404DOCS-yes += examples.doxy samples.dox
405examples.doxy: samples.dox $(ALL_EXAMPLES:.c=.dox)
406 @echo "INPUT += $^" > $@