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