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