Add an option to disable build of extra programs (demos and tests)
[opus.git] / Makefile.am
1 AUTOMAKE_OPTIONS = subdir-objects
2 ACLOCAL_AMFLAGS = -I m4
3
4 lib_LTLIBRARIES = libopus.la
5
6 DIST_SUBDIRS = doc
7
8 INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/celt -I$(top_srcdir)/silk -I$(top_srcdir)/silk/float -I$(top_srcdir)/silk/fixed
9
10 include celt_sources.mk
11 include silk_sources.mk
12 include opus_sources.mk
13
14 if FIXED_POINT
15 SILK_SOURCES += $(SILK_SOURCES_FIXED)
16 else
17 SILK_SOURCES += $(SILK_SOURCES_FLOAT)
18 OPUS_SOURCES += $(OPUS_SOURCES_FLOAT)
19 endif
20
21 include celt_headers.mk
22 include silk_headers.mk
23 include opus_headers.mk
24
25 libopus_la_SOURCES = $(CELT_SOURCES) $(SILK_SOURCES) $(OPUS_SOURCES)
26 libopus_la_LDFLAGS = -no-undefined -version-info @OPUS_LT_CURRENT@:@OPUS_LT_REVISION@:@OPUS_LT_AGE@
27
28 pkginclude_HEADERS = include/opus.h include/opus_multistream.h include/opus_types.h include/opus_defines.h
29
30 noinst_HEADERS = $(OPUS_HEAD) $(SILK_HEAD) $(CELT_HEAD)
31
32 if EXTRA_PROGRAMS
33 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
34
35 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
36
37 opus_demo_SOURCES = src/opus_demo.c
38
39 opus_demo_LDADD = libopus.la -lm
40
41 repacketizer_demo_SOURCES = src/repacketizer_demo.c
42
43 repacketizer_demo_LDADD = libopus.la -lm
44
45 opus_compare_SOURCES = src/opus_compare.c
46 opus_compare_LDADD = -lm
47
48 tests_test_opus_api_SOURCES = tests/test_opus_api.c tests/test_opus_common.h
49 tests_test_opus_api_LDADD = libopus.la -lm
50
51 tests_test_opus_encode_SOURCES = tests/test_opus_encode.c tests/test_opus_common.h
52 tests_test_opus_encode_LDADD = libopus.la -lm
53
54 tests_test_opus_decode_SOURCES = tests/test_opus_decode.c tests/test_opus_common.h
55 tests_test_opus_decode_LDADD = libopus.la -lm
56
57 tests_test_opus_padding_SOURCES = tests/test_opus_padding.c tests/test_opus_common.h
58 tests_test_opus_padding_LDADD = libopus.la -lm
59
60 celt_tests_test_unit_cwrs32_SOURCES = celt/tests/test_unit_cwrs32.c
61 celt_tests_test_unit_cwrs32_LDADD = -lm
62
63 celt_tests_test_unit_dft_SOURCES = celt/tests/test_unit_dft.c
64 celt_tests_test_unit_dft_LDADD = -lm
65
66 celt_tests_test_unit_entropy_SOURCES = celt/tests/test_unit_entropy.c
67 celt_tests_test_unit_entropy_LDADD = -lm
68
69 celt_tests_test_unit_laplace_SOURCES = celt/tests/test_unit_laplace.c
70 celt_tests_test_unit_laplace_LDADD = -lm
71
72 celt_tests_test_unit_mathops_SOURCES = celt/tests/test_unit_mathops.c
73 celt_tests_test_unit_mathops_LDADD = -lm
74
75 celt_tests_test_unit_mdct_SOURCES = celt/tests/test_unit_mdct.c
76 celt_tests_test_unit_mdct_LDADD = -lm
77
78 celt_tests_test_unit_rotation_SOURCES = celt/tests/test_unit_rotation.c
79 celt_tests_test_unit_rotation_LDADD = -lm
80
81 celt_tests_test_unit_types_SOURCES = celt/tests/test_unit_types.c
82 celt_tests_test_unit_types_LDADD = -lm
83 endif
84
85 if CUSTOM_MODES
86 pkginclude_HEADERS += include/opus_custom.h
87 if EXTRA_PROGRAMS
88 noinst_PROGRAMS += opus_custom_demo
89 opus_custom_demo_SOURCES = celt/opus_custom_demo.c
90 opus_custom_demo_LDADD = libopus.la -lm
91 endif
92 endif
93
94 EXTRA_DIST = version.mk \
95              opus.pc.in \
96              opus-uninstalled.pc.in \
97              opus.m4 \
98              Makefile.unix \
99              tests/run_vectors.sh \
100              opus.sln \
101              celt/celt.vcxproj \
102              celt/celt.vcxproj.filters \
103              src/opus_demo.vcxproj \
104              src/opus.vcxproj \
105              src/opus.vcxproj.filters \
106              src/opus_demo.vcxproj.filters \
107              tests/test_opus_decode.vcxproj.filters \
108              tests/test_opus_decode.vcxproj \
109              tests/test_opus_encode.vcxproj.filters \
110              tests/test_opus_encode.vcxproj \
111              tests/test_opus_api.vcxproj.filters \
112              tests/test_opus_api.vcxproj \
113              silk/float/silk_float.vcxproj.filters \
114              silk/float/silk_float.vcxproj \
115              silk/fixed/silk_fixed.vcxproj.filters \
116              silk/fixed/silk_fixed.vcxproj \
117              silk/silk_common.vcxproj \
118              silk/silk_common.vcxproj.filters \
119              win32/genversion.bat \
120              win32/config.h
121
122 pkgconfigdir = $(libdir)/pkgconfig
123 pkgconfig_DATA = opus.pc
124
125 m4datadir = $(datadir)/aclocal
126 m4data_DATA = opus.m4
127
128 # Targets to build and install just the library without the docs
129 opus check-opus install-opus: export NO_DOXYGEN = 1
130
131 opus: all
132 check-opus: check
133 install-opus: install
134
135
136 # Or just the docs
137 docs:
138         ( cd doc && $(MAKE) $(AM_MAKEFLAGS) )
139
140 install-docs:
141         ( cd doc && $(MAKE) $(AM_MAKEFLAGS) install )
142
143
144 # Or everything (by default)
145 all-local:
146         @[ -n "$(NO_DOXYGEN)" ] || ( cd doc && $(MAKE) $(AM_MAKEFLAGS) )
147
148 install-data-local:
149         @[ -n "$(NO_DOXYGEN)" ] || ( cd doc && $(MAKE) $(AM_MAKEFLAGS) install )
150
151 clean-local:
152         -( cd doc && $(MAKE) $(AM_MAKEFLAGS) clean )
153
154 uninstall-local:
155         ( cd doc && $(MAKE) $(AM_MAKEFLAGS) uninstall )
156
157
158 # We check this every time make is run, with configure.ac being touched to
159 # trigger an update of the build system files if update_version changes the
160 # current PACKAGE_VERSION (or if package_version was modified manually by a
161 # user with either AUTO_UPDATE=no or no update_version script present - the
162 # latter being the normal case for tarball releases).
163 #
164 # We can't just add the package_version file to CONFIGURE_DEPENDENCIES since
165 # simply running autoconf will not actually regenerate configure for us when
166 # the content of that file changes (due to autoconf dependency checking not
167 # knowing about that without us creating yet another file for it to include).
168 #
169 # The MAKECMDGOALS check is a gnu-make'ism, but will degrade 'gracefully' for
170 # makes that don't support it.  The only loss of functionality is not forcing
171 # an update of package_version for `make dist` if AUTO_UPDATE=no, but that is
172 # unlikely to be a real problem for any real user.
173 $(top_srcdir)/configure.ac: force
174         @case "$(MAKECMDGOALS)" in \
175             dist-hook)                             exit 0       ;; \
176             dist-* | dist | distcheck | distclean) _arg=release ;; \
177         esac; \
178         if ! $(top_srcdir)/update_version $$_arg 2> /dev/null; then \
179             if [ ! -e $(top_srcdir)/package_version ]; then \
180                 echo 'PACKAGE_VERSION="unknown"' > $(top_srcdir)/package_version; \
181             fi; \
182             . $(top_srcdir)/package_version || exit 1; \
183             [ "$(PACKAGE_VERSION)" != "$$PACKAGE_VERSION" ] || exit 0; \
184         fi; \
185         touch $@
186
187 force:
188
189 # Create a minimal package_version file when make dist is run.
190 dist-hook:
191         echo 'PACKAGE_VERSION="$(PACKAGE_VERSION)"' > $(top_distdir)/package_version
192
193
194 .PHONY: opus check-opus install-opus docs install-docs