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