4e3f18366a03421880d7389fa8696264eec84043
[opus.git] / Makefile.am
1 # Provide the full test output for failed tests when using the parallel
2 # test suite (which is enabled by default with automake 1.13+).
3 export VERBOSE = yes
4
5 AUTOMAKE_OPTIONS = subdir-objects
6 ACLOCAL_AMFLAGS = -I m4
7
8 lib_LTLIBRARIES = libopus.la
9
10 DIST_SUBDIRS = doc
11
12 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/celt -I$(top_srcdir)/silk \
13               -I$(top_srcdir)/silk/float -I$(top_srcdir)/silk/fixed $(NE10_CFLAGS)
14
15 include celt_sources.mk
16 include silk_sources.mk
17 include opus_sources.mk
18
19 if FIXED_POINT
20 SILK_SOURCES += $(SILK_SOURCES_FIXED)
21 if HAVE_SSE4_1
22 SILK_SOURCES += $(SILK_SOURCES_SSE4_1) $(SILK_SOURCES_FIXED_SSE4_1)
23 endif
24 if HAVE_ARM_NEON_INTR
25 SILK_SOURCES += $(SILK_SOURCES_FIXED_ARM_NEON_INTR)
26 endif
27 else
28 SILK_SOURCES += $(SILK_SOURCES_FLOAT)
29 if HAVE_SSE4_1
30 SILK_SOURCES += $(SILK_SOURCES_SSE4_1)
31 endif
32 endif
33
34 if DISABLE_FLOAT_API
35 else
36 OPUS_SOURCES += $(OPUS_SOURCES_FLOAT)
37 endif
38
39 if HAVE_SSE
40 CELT_SOURCES += $(CELT_SOURCES_SSE)
41 endif
42 if HAVE_SSE2
43 CELT_SOURCES += $(CELT_SOURCES_SSE2)
44 endif
45 if HAVE_SSE4_1
46 CELT_SOURCES += $(CELT_SOURCES_SSE4_1)
47 endif
48
49 if CPU_ARM
50 CELT_SOURCES += $(CELT_SOURCES_ARM)
51 SILK_SOURCES += $(SILK_SOURCES_ARM)
52
53 if HAVE_ARM_NEON_INTR
54 CELT_SOURCES += $(CELT_SOURCES_ARM_NEON_INTR)
55 SILK_SOURCES += $(SILK_SOURCES_ARM_NEON_INTR)
56 endif
57
58 if HAVE_ARM_NE10
59 CELT_SOURCES += $(CELT_SOURCES_ARM_NE10)
60 endif
61
62 if OPUS_ARM_EXTERNAL_ASM
63 noinst_LTLIBRARIES = libarmasm.la
64 libarmasm_la_SOURCES = $(CELT_SOURCES_ARM_ASM:.s=-gnu.S)
65 BUILT_SOURCES = $(CELT_SOURCES_ARM_ASM:.s=-gnu.S) \
66  $(CELT_AM_SOURCES_ARM_ASM:.s.in=.s) \
67  $(CELT_AM_SOURCES_ARM_ASM:.s.in=-gnu.S)
68 endif
69 endif
70
71 CLEANFILES = $(CELT_SOURCES_ARM_ASM:.s=-gnu.S) \
72  $(CELT_AM_SOURCES_ARM_ASM:.s.in=-gnu.S)
73
74 include celt_headers.mk
75 include silk_headers.mk
76 include opus_headers.mk
77
78 libopus_la_SOURCES = $(CELT_SOURCES) $(SILK_SOURCES) $(OPUS_SOURCES)
79 libopus_la_LDFLAGS = -no-undefined -version-info @OPUS_LT_CURRENT@:@OPUS_LT_REVISION@:@OPUS_LT_AGE@
80 libopus_la_LIBADD = $(NE10_LIBS) $(LIBM)
81 if OPUS_ARM_EXTERNAL_ASM
82 libopus_la_LIBADD += libarmasm.la
83 endif
84
85 pkginclude_HEADERS = include/opus.h include/opus_multistream.h include/opus_types.h include/opus_defines.h include/opus_projection.h
86
87 noinst_HEADERS = $(OPUS_HEAD) $(SILK_HEAD) $(CELT_HEAD)
88
89 if EXTRA_PROGRAMS
90 noinst_PROGRAMS = celt/tests/test_unit_cwrs32 \
91                   celt/tests/test_unit_dft \
92                   celt/tests/test_unit_entropy \
93                   celt/tests/test_unit_laplace \
94                   celt/tests/test_unit_mathops \
95                   celt/tests/test_unit_mdct \
96                   celt/tests/test_unit_rotation \
97                   celt/tests/test_unit_types \
98                   opus_compare \
99                   opus_demo \
100                   repacketizer_demo \
101                   silk/tests/test_unit_LPC_inv_pred_gain \
102                   tests/test_opus_api \
103                   tests/test_opus_decode \
104                   tests/test_opus_encode \
105                   tests/test_opus_padding \
106                   tests/test_opus_projection
107
108 TESTS = celt/tests/test_unit_cwrs32 \
109         celt/tests/test_unit_dft \
110         celt/tests/test_unit_entropy \
111         celt/tests/test_unit_laplace \
112         celt/tests/test_unit_mathops \
113         celt/tests/test_unit_mdct \
114         celt/tests/test_unit_rotation \
115         celt/tests/test_unit_types \
116         silk/tests/test_unit_LPC_inv_pred_gain \
117         tests/test_opus_api \
118         tests/test_opus_decode \
119         tests/test_opus_encode \
120         tests/test_opus_padding \
121         tests/test_opus_projection
122
123 opus_demo_SOURCES = src/opus_demo.c
124
125 opus_demo_LDADD = libopus.la $(NE10_LIBS) $(LIBM)
126
127 repacketizer_demo_SOURCES = src/repacketizer_demo.c
128
129 repacketizer_demo_LDADD = libopus.la $(NE10_LIBS) $(LIBM)
130
131 opus_compare_SOURCES = src/opus_compare.c
132 opus_compare_LDADD = $(LIBM)
133
134 tests_test_opus_api_SOURCES = tests/test_opus_api.c tests/test_opus_common.h
135 tests_test_opus_api_LDADD = libopus.la $(NE10_LIBS) $(LIBM)
136
137 tests_test_opus_encode_SOURCES = tests/test_opus_encode.c tests/opus_encode_regressions.c tests/test_opus_common.h
138 tests_test_opus_encode_LDADD = libopus.la $(NE10_LIBS) $(LIBM)
139
140 tests_test_opus_decode_SOURCES = tests/test_opus_decode.c tests/test_opus_common.h
141 tests_test_opus_decode_LDADD = libopus.la $(NE10_LIBS) $(LIBM)
142
143 tests_test_opus_padding_SOURCES = tests/test_opus_padding.c tests/test_opus_common.h
144 tests_test_opus_padding_LDADD = libopus.la $(NE10_LIBS) $(LIBM)
145
146 CELT_OBJ = $(CELT_SOURCES:.c=.lo)
147 SILK_OBJ = $(SILK_SOURCES:.c=.lo)
148 OPUS_OBJ = $(OPUS_SOURCES:.c=.lo)
149
150 tests_test_opus_projection_SOURCES = tests/test_opus_projection.c tests/test_opus_common.h
151 tests_test_opus_projection_LDADD = $(OPUS_OBJ) $(SILK_OBJ) $(CELT_OBJ) $(NE10_LIBS) $(LIBM)
152 if OPUS_ARM_EXTERNAL_ASM
153 tests_test_opus_projection_LDADD += libarmasm.la
154 endif
155
156 silk_tests_test_unit_LPC_inv_pred_gain_SOURCES = silk/tests/test_unit_LPC_inv_pred_gain.c
157 silk_tests_test_unit_LPC_inv_pred_gain_LDADD = $(SILK_OBJ) $(CELT_OBJ) $(NE10_LIBS) $(LIBM)
158 if OPUS_ARM_EXTERNAL_ASM
159 silk_tests_test_unit_LPC_inv_pred_gain_LDADD += libarmasm.la
160 endif
161
162 celt_tests_test_unit_cwrs32_SOURCES = celt/tests/test_unit_cwrs32.c
163 celt_tests_test_unit_cwrs32_LDADD = $(LIBM)
164
165 celt_tests_test_unit_dft_SOURCES = celt/tests/test_unit_dft.c
166 celt_tests_test_unit_dft_LDADD = $(CELT_OBJ) $(NE10_LIBS) $(LIBM)
167 if OPUS_ARM_EXTERNAL_ASM
168 celt_tests_test_unit_dft_LDADD += libarmasm.la
169 endif
170
171 celt_tests_test_unit_entropy_SOURCES = celt/tests/test_unit_entropy.c
172 celt_tests_test_unit_entropy_LDADD = $(LIBM)
173
174 celt_tests_test_unit_laplace_SOURCES = celt/tests/test_unit_laplace.c
175 celt_tests_test_unit_laplace_LDADD = $(LIBM)
176
177 celt_tests_test_unit_mathops_SOURCES = celt/tests/test_unit_mathops.c
178 celt_tests_test_unit_mathops_LDADD = $(CELT_OBJ) $(NE10_LIBS) $(LIBM)
179 if OPUS_ARM_EXTERNAL_ASM
180 celt_tests_test_unit_mathops_LDADD += libarmasm.la
181 endif
182
183 celt_tests_test_unit_mdct_SOURCES = celt/tests/test_unit_mdct.c
184 celt_tests_test_unit_mdct_LDADD = $(CELT_OBJ) $(NE10_LIBS) $(LIBM)
185 if OPUS_ARM_EXTERNAL_ASM
186 celt_tests_test_unit_mdct_LDADD += libarmasm.la
187 endif
188
189 celt_tests_test_unit_rotation_SOURCES = celt/tests/test_unit_rotation.c
190 celt_tests_test_unit_rotation_LDADD = $(CELT_OBJ) $(NE10_LIBS) $(LIBM)
191 if OPUS_ARM_EXTERNAL_ASM
192 celt_tests_test_unit_rotation_LDADD += libarmasm.la
193 endif
194
195 celt_tests_test_unit_types_SOURCES = celt/tests/test_unit_types.c
196 celt_tests_test_unit_types_LDADD = $(LIBM)
197 endif
198
199 if CUSTOM_MODES
200 pkginclude_HEADERS += include/opus_custom.h
201 if EXTRA_PROGRAMS
202 noinst_PROGRAMS += opus_custom_demo
203 opus_custom_demo_SOURCES = celt/opus_custom_demo.c
204 opus_custom_demo_LDADD = libopus.la $(LIBM)
205 endif
206 endif
207
208 EXTRA_DIST = opus.pc.in \
209              opus-uninstalled.pc.in \
210              opus.m4 \
211              Makefile.mips \
212              Makefile.unix \
213              CMakeLists.txt \
214              config.h.cmake.in \
215              opus_config.cmake \
216              opus_functions.cmake \
217              opus_sources.cmake \
218              OpusConfig.cmake.in \
219              tests/run_vectors.sh \
220              celt/arm/arm2gnu.pl \
221              celt/arm/celt_pitch_xcorr_arm.s \
222              win32/VS2015/opus.vcxproj \
223              win32/VS2015/test_opus_encode.vcxproj.filters \
224              win32/VS2015/test_opus_encode.vcxproj \
225              win32/VS2015/opus_demo.vcxproj \
226              win32/VS2015/test_opus_api.vcxproj.filters \
227              win32/VS2015/test_opus_api.vcxproj \
228              win32/VS2015/test_opus_decode.vcxproj.filters \
229              win32/VS2015/opus_demo.vcxproj.filters \
230              win32/VS2015/opus.vcxproj.filters \
231              win32/VS2015/test_opus_decode.vcxproj \
232              win32/VS2015/opus.sln \
233              win32/VS2015/common.props \
234              win32/genversion.bat \
235              win32/config.h
236
237 pkgconfigdir = $(libdir)/pkgconfig
238 pkgconfig_DATA = opus.pc
239
240 m4datadir = $(datadir)/aclocal
241 m4data_DATA = opus.m4
242
243 # Targets to build and install just the library without the docs
244 opus check-opus install-opus: export NO_DOXYGEN = 1
245
246 opus: all
247 check-opus: check
248 install-opus: install
249
250
251 # Or just the docs
252 docs:
253         ( cd doc && $(MAKE) $(AM_MAKEFLAGS) )
254
255 install-docs:
256         ( cd doc && $(MAKE) $(AM_MAKEFLAGS) install )
257
258
259 # Or everything (by default)
260 all-local:
261         @[ -n "$(NO_DOXYGEN)" ] || ( cd doc && $(MAKE) $(AM_MAKEFLAGS) )
262
263 install-data-local:
264         @[ -n "$(NO_DOXYGEN)" ] || ( cd doc && $(MAKE) $(AM_MAKEFLAGS) install )
265
266 clean-local:
267         -( cd doc && $(MAKE) $(AM_MAKEFLAGS) clean )
268
269 uninstall-local:
270         ( cd doc && $(MAKE) $(AM_MAKEFLAGS) uninstall )
271
272
273 # We check this every time make is run, with configure.ac being touched to
274 # trigger an update of the build system files if update_version changes the
275 # current PACKAGE_VERSION (or if package_version was modified manually by a
276 # user with either AUTO_UPDATE=no or no update_version script present - the
277 # latter being the normal case for tarball releases).
278 #
279 # We can't just add the package_version file to CONFIGURE_DEPENDENCIES since
280 # simply running autoconf will not actually regenerate configure for us when
281 # the content of that file changes (due to autoconf dependency checking not
282 # knowing about that without us creating yet another file for it to include).
283 #
284 # The MAKECMDGOALS check is a gnu-make'ism, but will degrade 'gracefully' for
285 # makes that don't support it.  The only loss of functionality is not forcing
286 # an update of package_version for `make dist` if AUTO_UPDATE=no, but that is
287 # unlikely to be a real problem for any real user.
288 $(top_srcdir)/configure.ac: force
289         @case "$(MAKECMDGOALS)" in \
290             dist-hook)                             exit 0       ;; \
291             dist-* | dist | distcheck | distclean) _arg=release ;; \
292         esac; \
293         if ! $(top_srcdir)/update_version $$_arg 2> /dev/null; then \
294             if [ ! -e $(top_srcdir)/package_version ]; then \
295                 echo 'PACKAGE_VERSION="unknown"' > $(top_srcdir)/package_version; \
296             fi; \
297             . $(top_srcdir)/package_version || exit 1; \
298             [ "$(PACKAGE_VERSION)" != "$$PACKAGE_VERSION" ] || exit 0; \
299         fi; \
300         touch $@
301
302 force:
303
304 # Create a minimal package_version file when make dist is run.
305 dist-hook:
306         echo 'PACKAGE_VERSION="$(PACKAGE_VERSION)"' > $(top_distdir)/package_version
307
308
309 .PHONY: opus check-opus install-opus docs install-docs
310
311 # automake doesn't do dependency tracking for asm files, that I can tell
312 $(CELT_SOURCES_ARM_ASM:%.s=%-gnu.S): celt/arm/armopts-gnu.S
313 $(CELT_SOURCES_ARM_ASM:%.s=%-gnu.S): $(top_srcdir)/celt/arm/arm2gnu.pl
314
315 # convert ARM asm to GNU as format
316 %-gnu.S: $(top_srcdir)/%.s
317         $(top_srcdir)/celt/arm/arm2gnu.pl @ARM2GNU_PARAMS@ < $< > $@
318 # For autoconf-modified sources (e.g., armopts.s)
319 %-gnu.S: %.s
320         $(top_srcdir)/celt/arm/arm2gnu.pl @ARM2GNU_PARAMS@ < $< > $@
321
322 OPT_UNIT_TEST_OBJ = $(celt_tests_test_unit_mathops_SOURCES:.c=.o) \
323                     $(celt_tests_test_unit_rotation_SOURCES:.c=.o) \
324                     $(celt_tests_test_unit_mdct_SOURCES:.c=.o) \
325                     $(celt_tests_test_unit_dft_SOURCES:.c=.o) \
326                     $(silk_tests_test_unit_LPC_inv_pred_gain_SOURCES:.c=.o)
327
328 if HAVE_SSE
329 SSE_OBJ = $(CELT_SOURCES_SSE:.c=.lo)
330 $(SSE_OBJ): CFLAGS += $(OPUS_X86_SSE_CFLAGS)
331 endif
332
333 if HAVE_SSE2
334 SSE2_OBJ = $(CELT_SOURCES_SSE2:.c=.lo)
335 $(SSE2_OBJ): CFLAGS += $(OPUS_X86_SSE2_CFLAGS)
336 endif
337
338 if HAVE_SSE4_1
339 SSE4_1_OBJ = $(CELT_SOURCES_SSE4_1:.c=.lo) \
340              $(SILK_SOURCES_SSE4_1:.c=.lo) \
341              $(SILK_SOURCES_FIXED_SSE4_1:.c=.lo)
342 $(SSE4_1_OBJ): CFLAGS += $(OPUS_X86_SSE4_1_CFLAGS)
343 endif
344
345 if HAVE_ARM_NEON_INTR
346 ARM_NEON_INTR_OBJ = $(CELT_SOURCES_ARM_NEON_INTR:.c=.lo) \
347                     $(SILK_SOURCES_ARM_NEON_INTR:.c=.lo) \
348                     $(SILK_SOURCES_FIXED_ARM_NEON_INTR:.c=.lo)
349 $(ARM_NEON_INTR_OBJ): CFLAGS += \
350  $(OPUS_ARM_NEON_INTR_CFLAGS)  $(NE10_CFLAGS)
351 endif