• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5AUTOMAKE_OPTIONS = subdir-objects
6ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS}
7
8if HAVE_SSE42
9CRAS_SSE4_2 = libcrasmix_sse42.la
10else
11CRAS_SSE4_2 =
12endif
13
14if HAVE_AVX
15CRAS_AVX = libcrasmix_avx.la
16else
17CRAS_AVX =
18endif
19
20if HAVE_AVX2
21CRAS_AVX2 = libcrasmix_avx2.la
22else
23CRAS_AVX2 =
24endif
25
26if HAVE_FMA
27CRAS_FMA = libcrasmix_fma.la
28else
29CRAS_FMA =
30endif
31
32if HAVE_WEBRTC_APM
33CRAS_WEBRTC_APM_SOURCES = \
34	server/cras_apm_list.c
35else
36CRAS_WEBRTC_APM_SOURCES =
37endif
38
39CRAS_UT_TMPDIR_CFLAGS=-DCRAS_UT_TMPDIR=\"/tmp\"
40COMMON_CPPFLAGS = -O2 -Wall -Werror -Wno-error=cpp
41COMMON_SIMD_CPPFLAGS = -O3 -Wall -Werror -Wno-error=cpp
42
43bin_PROGRAMS = cras cras_test_client cras_monitor cras_router
44noinst_PROGRAMS =
45
46if HAVE_DBUS
47CRAS_DBUS_SOURCES = \
48	common/cras_sbc_codec.c \
49	common/packet_status_logger.c \
50	server/cras_bt_manager.c \
51	server/cras_bt_adapter.c \
52	server/cras_bt_device.c \
53	server/cras_bt_transport.c \
54	server/cras_bt_endpoint.c \
55	server/cras_bt_player.c \
56	server/cras_bt_io.c \
57	server/cras_bt_profile.c \
58	server/cras_bt_battery_provider.c \
59	server/cras_dbus.c \
60	server/cras_dbus_util.c \
61	server/cras_dbus_control.c \
62	server/cras_hfp_ag_profile.c \
63	server/cras_hfp_iodev.c \
64	server/cras_hfp_alsa_iodev.c \
65	server/cras_hfp_info.c \
66	server/cras_hfp_slc.c \
67	server/cras_a2dp_endpoint.c \
68	server/cras_a2dp_info.c \
69	server/cras_a2dp_iodev.c \
70	server/cras_telephony.c \
71	server/cras_utf8.c
72else
73CRAS_DBUS_SOURCES =
74endif
75
76if HAVE_SELINUX
77CRAS_SELINUX_SOURCES = common/cras_selinux_helper.c
78CRAS_SELINUX_UNITTEST_SOURCES = tests/cras_selinux_helper_unittest.c
79else
80CRAS_SELINUX_SOURCES =
81CRAS_SELINUX_UNITTEST_SOURCES =
82endif
83
84cras_server_SOURCES = \
85	$(CRAS_DBUS_SOURCES) \
86	$(CRAS_SELINUX_SOURCES) \
87	$(CRAS_WEBRTC_APM_SOURCES) \
88	common/cras_audio_format.c \
89	common/cras_checksum.c \
90	common/cras_config.c \
91	common/cras_metrics.c \
92	common/cras_shm.c \
93	common/cras_util.c \
94	common/dumper.c \
95	common/edid_utils.c \
96	common/sfh.c \
97	dsp/biquad.c \
98	dsp/crossover.c \
99	dsp/crossover2.c \
100	dsp/dcblock.c \
101	dsp/drc.c \
102	dsp/drc_kernel.c \
103	dsp/drc_math.c \
104	dsp/dsp_util.c \
105	dsp/eq.c \
106	dsp/eq2.c \
107	plc/cras_plc.c\
108	server/audio_thread.c \
109	server/buffer_share.c \
110	server/config/cras_board_config.c \
111	server/config/cras_card_config.c \
112	server/config/cras_device_blocklist.c \
113	server/cras_alert.c \
114	server/cras_alsa_card.c \
115	server/cras_alsa_helpers.c \
116	server/cras_alsa_io.c \
117	server/cras_alsa_jack.c \
118	server/cras_alsa_mixer.c \
119	server/cras_alsa_mixer_name.c \
120	server/cras_alsa_plugin_io.c \
121	server/cras_alsa_ucm.c \
122	server/cras_alsa_ucm_section.c \
123	server/cras_audio_area.c \
124	server/cras_audio_thread_monitor.c \
125	server/cras_device_monitor.c \
126	server/cras_dsp.c \
127	server/cras_dsp_ini.c \
128	server/cras_dsp_mod_builtin.c \
129	server/cras_dsp_mod_ladspa.c \
130	server/cras_dsp_pipeline.c \
131	server/cras_empty_iodev.c \
132	server/cras_expr.c \
133	server/cras_fmt_conv.c \
134	server/cras_fmt_conv_ops.c \
135	server/cras_gpio_jack.c \
136	server/cras_hotword_handler.c \
137	server/cras_iodev.c \
138	server/cras_iodev_list.c \
139	server/cras_loopback_iodev.c \
140	server/cras_main_message.c \
141	server/cras_mix.c \
142	server/cras_non_empty_audio_handler.c \
143	server/cras_observer.c \
144	server/cras_ramp.c \
145	server/cras_rclient.c \
146	server/cras_rclient_util.c \
147	server/cras_control_rclient.c \
148	server/cras_playback_rclient.c \
149	server/cras_capture_rclient.c \
150	server/cras_unified_rclient.c \
151	server/cras_rstream.c \
152	server/cras_rstream_config.c \
153	server/cras_server_metrics.c \
154	server/cras_system_state.c \
155	server/cras_tm.c \
156	server/cras_udev.c \
157	server/cras_volume_curve.c \
158	server/dev_io.c \
159	server/dev_stream.c \
160	server/ewma_power.c \
161	server/input_data.c \
162	server/linear_resampler.c \
163	server/polled_interval_checker.c \
164	server/server_stream.c \
165	server/stream_list.c \
166	server/test_iodev.c \
167	server/softvol_curve.c
168
169SERVER_RUST_SRCDIR = $(top_srcdir)/src/server/rust
170
171libcrasserver_la_SOURCES = \
172	$(cras_server_SOURCES)
173libcrasserver_la_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common \
174	-I$(top_srcdir)/src/dsp -I$(top_srcdir)/src/server \
175	-I$(top_srcdir)/src/server/config -I$(top_srcdir)/src/plc \
176	-I$(SERVER_RUST_SRCDIR)/src/headers \
177	$(DBUS_CFLAGS) $(SBC_CFLAGS) $(SELINUX_CFLAGS)
178libcrasserver_la_LIBADD = \
179	$(CRAS_RUST) \
180	libcrasmix.la \
181	$(CRAS_SSE4_2) \
182	$(CRAS_AVX) \
183	$(CRAS_AVX2) \
184	$(CRAS_FMA) \
185	-lpthread -lasound -lrt -liniparser -ludev -ldl -lm -lspeexdsp \
186	$(SBC_LIBS) \
187	$(DBUS_LIBS) \
188	$(SELINUX_LIBS)
189
190cras_SOURCES = \
191	server/cras.c \
192	server/cras_server.c
193
194cras_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common \
195	-I$(top_srcdir)/src/dsp -I$(top_srcdir)/src/server \
196	-I$(top_srcdir)/src/server/config -I$(top_srcdir)/src/plc \
197	$(DBUS_CFLAGS) $(SBC_CFLAGS)
198
199cras_LDADD = \
200	libcrasmix.la \
201	libcrasserver.la \
202	$(CRAS_SSE4_2) \
203	$(CRAS_AVX) \
204	$(CRAS_AVX2) \
205	$(CRAS_FMA) \
206	$(CRAS_RUST) \
207	-lpthread -lasound -lrt -liniparser -ludev -ldl -lm -lspeexdsp \
208	$(METRICS_LIBS) \
209	$(SBC_LIBS) \
210	$(DBUS_LIBS) \
211	$(WEBRTC_APM_LIBS)
212
213noinst_LTLIBRARIES = \
214	$(CRAS_SSE4_2) \
215	$(CRAS_AVX) \
216	$(CRAS_AVX2) \
217	$(CRAS_FMA) \
218	libcrasmix.la \
219	libcrasserver.la
220
221libcrasmix_la_SOURCES = \
222	server/cras_mix_ops.c
223
224libcrasmix_la_CFLAGS = \
225	$(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common \
226	-I$(top_srcdir)/src/dsp -I$(top_srcdir)/src/server \
227	-I$(top_srcdir)/src/server/config -I$(top_srcdir)/src/plc \
228	$(DBUS_CFLAGS) $(SBC_CFLAGS)
229
230libcrasmix_sse42_la_SOURCES = \
231	server/cras_mix_ops.c
232
233libcrasmix_sse42_la_CFLAGS = \
234	$(COMMON_SIMD_CPPFLAGS) -I$(top_srcdir)/src/common \
235	-I$(top_srcdir)/src/dsp -I$(top_srcdir)/src/server \
236	-I$(top_srcdir)/src/server/config -I$(top_srcdir)/src/plc \
237	$(DBUS_CFLAGS) $(SSE42_CFLAGS)
238
239libcrasmix_avx_la_SOURCES = \
240	server/cras_mix_ops.c
241
242libcrasmix_avx_la_CFLAGS = \
243	$(COMMON_SIMD_CPPFLAGS) -I$(top_srcdir)/src/common \
244	-I$(top_srcdir)/src/dsp -I$(top_srcdir)/src/server \
245	-I$(top_srcdir)/src/server/config -I$(top_srcdir)/src/plc \
246	$(DBUS_CFLAGS) $(AVX_CFLAGS)
247
248libcrasmix_avx2_la_SOURCES = \
249	server/cras_mix_ops.c
250
251libcrasmix_avx2_la_CFLAGS = \
252	$(COMMON_SIMD_CPPFLAGS) -I$(top_srcdir)/src/common \
253	-I$(top_srcdir)/src/dsp -I$(top_srcdir)/src/server \
254	-I$(top_srcdir)/src/server/config -I$(top_srcdir)/src/plc \
255	$(DBUS_CFLAGS) $(AVX2_CFLAGS)
256
257libcrasmix_fma_la_SOURCES = \
258	server/cras_mix_ops.c
259
260libcrasmix_fma_la_CFLAGS = \
261	$(COMMON_SIMD_CPPFLAGS) -I$(top_srcdir)/src/common \
262	-I$(top_srcdir)/src/dsp -I$(top_srcdir)/src/server \
263	-I$(top_srcdir)/src/server/config -I$(top_srcdir)/src/plc \
264	$(DBUS_CFLAGS) $(FMA_CFLAGS)
265
266lib_LTLIBRARIES = libcras.la
267libcras_la_SOURCES = \
268	common/cras_audio_format.c \
269	common/cras_config.c \
270	common/cras_file_wait.c \
271	common/cras_shm.c \
272	common/cras_util.c \
273	common/edid_utils.c \
274	libcras/cras_client.c \
275	libcras/cras_helpers.c
276
277include_HEADERS = \
278	common/cras_audio_format.h \
279	common/cras_config.h \
280	common/cras_iodev_info.h \
281	common/cras_messages.h \
282	common/cras_shm.h \
283	common/cras_types.h \
284	common/cras_util.h \
285	common/edid_utils.h \
286	common/packet_status_logger.h \
287	common/utlist.h \
288	libcras/cras_client.h \
289	libcras/cras_helpers.h
290
291libcras_la_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common \
292	-I$(top_srcdir)/src/libcras
293libcras_la_LIBADD = -lpthread -lasound -lrt
294libcras_la_LDFLAGS = -version-info 0:0:0
295
296asound_module_pcm_cras_LTLIBRARIES = libasound_module_pcm_cras.la
297asound_module_ctl_cras_LTLIBRARIES = libasound_module_ctl_cras.la
298asound_module_pcm_crasdir = @ALSA_PLUGIN_DIR@
299asound_module_ctl_crasdir = @ALSA_PLUGIN_DIR@
300libasound_module_pcm_cras_la_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common \
301	-I$(top_srcdir)/src/libcras
302libasound_module_pcm_cras_la_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined \
303	$(LDFLAGS_NOUNDEFINED)
304libasound_module_ctl_cras_la_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common \
305	-I$(top_srcdir)/src/libcras
306libasound_module_ctl_cras_la_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined \
307	$(LDFLAGS_NOUNDEFINED)
308libasound_module_pcm_cras_la_SOURCES = alsa_plugin/pcm_cras.c
309libasound_module_pcm_cras_la_LIBADD = -lasound libcras.la
310libasound_module_ctl_cras_la_SOURCES = alsa_plugin/ctl_cras.c
311libasound_module_ctl_cras_la_LIBADD = -lasound libcras.la
312
313if !WITH_SYSTEM_RUST
314RUST_FILES = \
315	$(SERVER_RUST_SRCDIR)/Cargo.toml \
316	$(SERVER_RUST_SRCDIR)/src/rate_estimator_bindings.rs \
317	$(SERVER_RUST_SRCDIR)/src/rate_estimator.rs
318
319CRAS_RUST_TARGET_DIR = $(top_builddir)/src/server/rust/target
320CRAS_RUST = $(CRAS_RUST_TARGET_DIR)/release/libcras_rust.a
321$(CRAS_RUST): $(RUST_FILES)
322	cargo build --release \
323		--manifest-path $(SERVER_RUST_SRCDIR)/Cargo.toml \
324		--target-dir $(CRAS_RUST_TARGET_DIR)
325
326clean-local:
327	cargo clean --release \
328		--manifest-path $(SERVER_RUST_SRCDIR)/Cargo.toml \
329		--target-dir $(CRAS_RUST_TARGET_DIR)
330
331else
332CRAS_RUST = -lcras_rust
333endif
334
335# Inject a dependency between the installation rules of libcras and its modules.
336# This avoids a race when the modules are relinked before libcras is actually
337# installed.
338#
339# Automake will refuse to generate a rule that collides with a user-specified
340# one. The hide_install variable prevents automake from noticing these rules,
341# so everything else will behave as usual.
342hide_install=install
343$(hide_install)-asound_module_pcm_crasLTLIBRARIES: install-libLTLIBRARIES
344$(hide_install)-asound_module_ctl_crasLTLIBRARIES: install-libLTLIBRARIES
345
346# ==== Fuzzer section
347if HAVE_FUZZER
348FUZZERS = \
349	cras_rclient_message_fuzzer \
350	cras_hfp_slc_fuzzer
351
352noinst_PROGRAMS += $(FUZZERS)
353
354FUZZER_CPPFLAGS = $(COMMON_CPPFLAGS) \
355	-I$(top_srcdir)/src/common \
356	-I$(top_srcdir)/src/dsp -I$(top_srcdir)/src/server \
357	-I$(top_srcdir)/src/server/config -I$(top_srcdir)/src/plc \
358	$(DBUS_CFLAGS) $(SBC_CFLAGS)
359
360FUZZER_LDADD = \
361	libcrasmix.la \
362	libcrasserver.la \
363	$(CRAS_SSE4_2) \
364	$(CRAS_AVX) \
365	$(CRAS_AVX2) \
366	$(CRAS_FMA) \
367	$(CRAS_RUST) \
368	-lpthread -lasound -lrt -liniparser -ludev -ldl -lm -lspeexdsp \
369	$(METRICS_LIBS) \
370	$(SBC_LIBS) \
371	$(DBUS_LIBS) \
372	$(WEBRTC_APM_LIBS)
373
374cras_rclient_message_fuzzer_SOURCES = \
375	fuzz/rclient_message.cc
376
377cras_rclient_message_fuzzer_CPPFLAGS = $(FUZZER_CPPFLAGS)
378cras_rclient_message_fuzzer_LDFLAGS = $(FUZZER_LDFLAGS)
379cras_rclient_message_fuzzer_LDADD = $(FUZZER_LDADD)
380
381cras_hfp_slc_fuzzer_SOURCES = \
382	fuzz/cras_hfp_slc.cc
383
384cras_hfp_slc_fuzzer_CPPFLAGS = $(FUZZER_CPPFLAGS)
385cras_hfp_slc_fuzzer_LDFLAGS = $(FUZZER_LDFLAGS)
386cras_hfp_slc_fuzzer_LDADD = $(FUZZER_LDADD)
387endif
388
389# ==== Tests section
390if HAVE_DBUS
391DBUS_TESTS = \
392	a2dp_info_unittest \
393	a2dp_iodev_unittest \
394	alsa_io_unittest \
395	bt_device_unittest \
396	bt_io_unittest \
397	hfp_iodev_unittest \
398	hfp_alsa_iodev_unittest \
399	hfp_ag_profile_unittest \
400	hfp_slc_unittest
401else
402DBUS_TESTS =
403endif
404
405if HAVE_WEBRTC_APM
406CRAS_WEBRTC_APM_TESTS = \
407	apm_list_unittest
408else
409CRAS_WEBRTC_APM_TESTS =
410endif
411
412TESTS = \
413	$(DBUS_TESTS) \
414	$(CRAS_WEBRTC_APM_TESTS) \
415	audio_area_unittest \
416	audio_format_unittest \
417	audio_thread_unittest \
418	audio_thread_monitor_unittest \
419	alert_unittest \
420	alsa_card_unittest \
421	alsa_helpers_unittest \
422	alsa_jack_unittest \
423	alsa_mixer_unittest \
424	alsa_ucm_unittest \
425	array_unittest \
426	biquad_unittest \
427	byte_buffer_unittest \
428	card_config_unittest \
429	checksum_unittest \
430	cras_abi_unittest \
431	cras_client_unittest \
432	cras_tm_unittest \
433	device_monitor_unittest \
434	dev_io_unittest \
435	dev_stream_unittest \
436	device_blocklist_unittest \
437	dsp_core_unittest \
438	dsp_ini_unittest \
439	dsp_pipeline_unittest \
440	dsp_unittest \
441	dumper_unittest \
442	edid_utils_unittest \
443	empty_iodev_unittest \
444	expr_unittest \
445	ewma_power_unittest \
446	file_wait_unittest \
447	float_buffer_unittest \
448	fmt_conv_unittest \
449	fmt_conv_ops_unittest \
450	hfp_info_unittest \
451	buffer_share_unittest \
452	input_data_unittest \
453	iodev_list_unittest \
454	iodev_unittest \
455	loopback_iodev_unittest \
456	mix_unittest \
457	linear_resampler_unittest \
458	observer_unittest \
459	polled_interval_checker_unittest \
460	ramp_unittest \
461	rate_estimator_unittest \
462	control_rclient_unittest \
463	playback_rclient_unittest \
464	capture_rclient_unittest \
465	rstream_unittest \
466	shm_unittest \
467	server_metrics_unittest \
468	softvol_curve_unittest \
469	stream_list_unittest \
470	system_state_unittest \
471	timing_unittest \
472	utf8_unittest \
473	util_unittest \
474	volume_curve_unittest
475
476check_PROGRAMS = $(TESTS)
477
478cras_test_client_SOURCES = tools/cras_test_client/cras_test_client.c
479cras_test_client_LDADD = -lm libcras.la
480cras_test_client_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/libcras \
481	-I$(top_srcdir)/src/common -I$(top_builddir)/src/common
482
483tools/cras_test_client/cras_test_client.c: common/cras_version.h
484
485cras_monitor_SOURCES = tools/cras_monitor/cras_monitor.c
486cras_monitor_LDADD = -lm libcras.la
487cras_monitor_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/libcras \
488	-I$(top_srcdir)/src/common -I$(top_builddir)/src/common
489
490tools/cras_monitor/cras_monitor.c: common/cras_version.h
491
492cras_router_SOURCES = tools/cras_router/cras_router.c
493cras_router_LDADD = -lm libcras.la
494cras_router_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/libcras \
495        -I$(top_srcdir)/src/common -I$(top_srcdir)/src/dsp \
496	-I$(top_srcdir)/src/server -I$(top_builddir)/src/common
497
498tools/cras_router/cras_router.c: common/cras_version.h
499
500CLEANFILES = common/cras_version.h
501.PHONY: common/cras_version.h
502common/cras_version.h:
503	if echo "$(CPPFLAGS)" | grep -q -- '-DVCSID='; then \
504		echo > $@.tmp; \
505	else \
506		commit="outoftree-$$(git rev-parse HEAD)"; \
507		if [ -n "$$(git diff-index --name-only HEAD)" ]; then \
508			commit="$${commit}-dirty"; \
509		fi; \
510		echo "#define VCSID \"$$commit\"" > $@.tmp; \
511	fi
512	diff $@.tmp $@ && rm -f $@.tmp || mv $@.tmp $@
513
514# dsp test programs (not run automatically)
515check_PROGRAMS += \
516	crossover_test \
517	crossover2_test \
518	dcblock_test \
519	drc_test \
520	dsp_util_test \
521	eq_test \
522	eq2_test \
523	cmpraw
524
525DSP_INCLUDE_PATHS = -I$(top_srcdir)/src/dsp -I$(top_srcdir)/src/common
526
527crossover_test_SOURCES = dsp/crossover.c dsp/biquad.c dsp/dsp_util.c \
528	dsp/tests/crossover_test.c dsp/tests/dsp_test_util.c dsp/tests/raw.c
529crossover_test_LDADD = -lrt -lm
530crossover_test_CPPFLAGS = $(COMMON_CPPFLAGS) $(DSP_INCLUDE_PATHS)
531
532crossover2_test_SOURCES = dsp/crossover2.c dsp/biquad.c dsp/dsp_util.c \
533	dsp/tests/crossover2_test.c dsp/tests/dsp_test_util.c dsp/tests/raw.c
534crossover2_test_LDADD = -lrt -lm
535crossover2_test_CPPFLAGS = $(COMMON_CPPFLAGS) $(DSP_INCLUDE_PATHS)
536
537dcblock_test_SOURCES = dsp/dcblock.c dsp/dsp_util.c dsp/tests/dcblock_test.c \
538	dsp/tests/dsp_test_util.c dsp/tests/raw.c
539dcblock_test_LDADD = -lrt -lm
540dcblock_test_CPPFLAGS = $(COMMON_CPPFLAGS) $(DSP_INCLUDE_PATHS)
541
542drc_test_SOURCES = dsp/drc.c dsp/drc_kernel.c dsp/drc_math.c \
543	dsp/crossover2.c dsp/eq2.c dsp/biquad.c dsp/dsp_util.c \
544	dsp/tests/drc_test.c dsp/tests/dsp_test_util.c dsp/tests/raw.c
545drc_test_LDADD = -lrt -lm
546drc_test_CPPFLAGS = $(COMMON_CPPFLAGS) $(DSP_INCLUDE_PATHS)
547
548dsp_util_test_SOURCES = dsp/tests/dsp_util_test.c dsp/dsp_util.c
549dsp_util_test_LDADD = -lm
550dsp_util_test_CPPFLAGS = $(COMMON_CPPFLAGS) $(DSP_INCLUDE_PATHS) -Wno-error=strict-aliasing
551
552eq_test_SOURCES = dsp/biquad.c dsp/eq.c dsp/dsp_util.c dsp/tests/eq_test.c \
553	dsp/tests/dsp_test_util.c dsp/tests/raw.c
554eq_test_LDADD = -lrt -lm
555eq_test_CPPFLAGS = $(COMMON_CPPFLAGS) $(DSP_INCLUDE_PATHS)
556
557eq2_test_SOURCES = dsp/biquad.c dsp/eq2.c dsp/dsp_util.c dsp/tests/eq2_test.c \
558	dsp/tests/dsp_test_util.c dsp/tests/raw.c
559eq2_test_LDADD = -lrt -lm
560eq2_test_CPPFLAGS = $(COMMON_CPPFLAGS) $(DSP_INCLUDE_PATHS)
561
562cmpraw_SOURCES = dsp/tests/cmpraw.c dsp/tests/raw.c
563cmpraw_LDADD = -lm
564cmpraw_CPPFLAGS = $(COMMON_CPPFLAGS) $(DSP_INCLUDE_PATHS)
565
566cras_plc_test_SOURCES = plc/cras_plc_test.c plc/cras_plc.c \
567	common/cras_sbc_codec.c
568cras_plc_test_LDADD = -lrt -lm $(SBC_LIBS)
569cras_plc_test_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/plc \
570	-I$(top_srcdir)/src/common \
571	$(SBC_CFLAGS)
572check_PROGRAMS += cras_plc_test
573
574# unit tests
575alert_unittest_SOURCES = tests/alert_unittest.cc \
576	server/cras_alert.c
577alert_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) \
578	-I$(top_srcdir)/src/common \
579	-I$(top_srcdir)/src/server
580alert_unittest_LDADD = -lgtest -lpthread
581
582alsa_card_unittest_SOURCES = tests/alsa_card_unittest.cc \
583	server/cras_alsa_card.c server/cras_alsa_mixer_name.c \
584	server/cras_alsa_ucm_section.c
585alsa_card_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) \
586	-I$(top_srcdir)/src/common \
587	-I$(top_srcdir)/src/server \
588	-I$(top_srcdir)/src/server/config
589alsa_card_unittest_LDADD = -lgtest -lpthread
590
591alsa_helpers_unittest_SOURCES = tests/alsa_helpers_unittest.cc \
592	common/cras_audio_format.c
593alsa_helpers_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) \
594	-I$(top_srcdir)/src/common \
595	-I$(top_srcdir)/src/server
596alsa_helpers_unittest_LDADD = -lgtest -lpthread
597
598audio_area_unittest_SOURCES = tests/audio_area_unittest.cc \
599	server/cras_audio_area.c
600audio_area_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/server \
601	-I$(top_srcdir)/src/common
602audio_area_unittest_LDADD = -lgtest -lpthread
603
604audio_format_unittest_SOURCES = tests/audio_format_unittest.cc
605audio_format_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/server \
606	-I$(top_srcdir)/src/common
607audio_format_unittest_LDADD = -lgtest -lpthread
608
609if HAVE_DBUS
610a2dp_info_unittest_SOURCES =  \
611	server/cras_a2dp_info.c \
612	tests/a2dp_info_unittest.cc \
613	tests/sbc_codec_stub.cc
614a2dp_info_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/server \
615	-I$(top_srcdir)/src/common
616a2dp_info_unittest_LDADD = -lgtest -lpthread
617
618a2dp_iodev_unittest_SOURCES = tests/a2dp_iodev_unittest.cc
619a2dp_iodev_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/server \
620	-I$(top_srcdir)/src/common $(DBUS_CFLAGS)
621a2dp_iodev_unittest_LDADD = -lgtest -lpthread $(DBUS_LIBS)
622endif
623
624alsa_io_unittest_SOURCES = tests/alsa_io_unittest.cc server/softvol_curve.c \
625	common/sfh.c \
626	server/cras_alsa_ucm_section.c \
627	server/cras_alsa_mixer_name.c
628alsa_io_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) $(DBUS_CFLAGS) \
629	-I$(top_srcdir)/src/server \
630	-I$(top_srcdir)/src/common \
631	-I$(top_srcdir)/src/server/config
632alsa_io_unittest_LDADD = -lgtest -lpthread
633
634alsa_jack_unittest_SOURCES = tests/alsa_jack_unittest.cc \
635	server/cras_alsa_jack.c \
636	server/cras_alsa_ucm_section.c \
637	server/cras_alsa_mixer_name.c
638alsa_jack_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common \
639	-I$(top_srcdir)/src/server
640alsa_jack_unittest_LDADD = -lgtest -lpthread
641
642alsa_mixer_unittest_SOURCES = tests/alsa_mixer_unittest.cc \
643	server/cras_alsa_mixer_name.c \
644	server/cras_alsa_ucm_section.c
645alsa_mixer_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) \
646	-I$(top_srcdir)/src/common \
647	-I$(top_srcdir)/src/server \
648	-I$(top_srcdir)/src/server/config
649alsa_mixer_unittest_LDADD = -lgtest -lpthread
650
651alsa_ucm_unittest_SOURCES = tests/alsa_ucm_unittest.cc \
652	server/cras_alsa_mixer_name.c \
653	server/cras_alsa_ucm_section.c
654alsa_ucm_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) \
655	-I$(top_srcdir)/src/common \
656	-I$(top_srcdir)/src/server \
657	-I$(top_srcdir)/src/server/config
658alsa_ucm_unittest_LDADD = -lgtest -lpthread
659
660if HAVE_WEBRTC_APM
661apm_list_unittest_SOURCES = tests/apm_list_unittest.cc \
662	server/cras_apm_list.c
663apm_list_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) \
664	$(DSP_INCLUDE_PATHS) \
665	-I$(top_srcdir)/src/server \
666	-I$(top_srcdir)/src/server/config \
667	$(WEBRTC_APM_CFLAGS)
668apm_list_unittest_LDADD = -lgtest -liniparser
669endif
670
671array_unittest_SOURCES = tests/array_unittest.cc
672array_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common
673array_unittest_LDADD = -lgtest -lpthread
674
675audio_thread_unittest_SOURCES = tests/audio_thread_unittest.cc \
676	server/dev_io.c tests/empty_audio_stub.cc tests/metrics_stub.cc \
677	common/cras_shm.c
678audio_thread_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) \
679	-I$(top_srcdir)/src/common -I$(top_srcdir)/src/server \
680	-I$(SERVER_RUST_SRCDIR)/src/headers
681audio_thread_unittest_LDADD = -lgtest -lpthread -lrt
682
683audio_thread_monitor_unittest_SOURCES = tests/audio_thread_monitor_unittest.cc
684audio_thread_monitor_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) \
685	-I$(top_srcdir)/src/common -I$(top_srcdir)/src/server
686audio_thread_monitor_unittest_LDADD = -lgtest -lpthread -lrt
687
688if HAVE_DBUS
689bt_device_unittest_SOURCES = tests/bt_device_unittest.cc \
690	server/cras_bt_device.c \
691	tests/metrics_stub.cc common/sfh.c
692bt_device_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/server \
693	-I$(top_srcdir)/src/common $(DBUS_CFLAGS)
694bt_device_unittest_LDADD = -lgtest -lpthread $(DBUS_LIBS)
695
696bt_io_unittest_SOURCES = tests/bt_io_unittest.cc common/sfh.c
697bt_io_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/server \
698	-I$(top_srcdir)/src/common $(DBUS_CFLAGS)
699bt_io_unittest_LDADD = -lgtest -lpthread $(DBUS_LIBS)
700endif
701
702biquad_unittest_SOURCES = tests/biquad_unittest.cc \
703	dsp/biquad.c
704biquad_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) $(DSP_INCLUDE_PATHS) \
705	-I$(top_srcdir)/src/server
706biquad_unittest_LDADD = -lgtest -lpthread -lm
707
708byte_buffer_unittest_SOURCES = tests/byte_buffer_unittest.cc
709byte_buffer_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common
710byte_buffer_unittest_LDADD = -lgtest -lpthread
711
712card_config_unittest_SOURCES = tests/card_config_unittest.cc \
713	server/config/cras_card_config.c
714card_config_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) \
715	-I$(top_srcdir)/src/common -I$(top_srcdir)/src/server \
716	-I$(top_srcdir)/src/server/config $(CRAS_UT_TMPDIR_CFLAGS)
717card_config_unittest_LDADD = -lgtest -liniparser -lpthread
718
719checksum_unittest_SOURCES = tests/checksum_unittest.cc common/cras_checksum.c
720checksum_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common
721checksum_unittest_LDADD = -lgtest -lpthread
722
723cras_abi_unittest_SOURCES = tests/cras_abi_unittest.cc \
724	common/cras_config.c common/cras_shm.c common/cras_util.c \
725	common/cras_file_wait.c common/cras_audio_format.c
726cras_abi_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common \
727	-I$(top_srcdir)/src/libcras
728cras_abi_unittest_LDADD = -lgtest -lpthread -lrt -lspeexdsp
729
730cras_client_unittest_SOURCES = tests/cras_client_unittest.cc \
731	common/cras_config.c common/cras_shm.c common/cras_util.c \
732	common/cras_file_wait.c
733cras_client_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common \
734	-I$(top_srcdir)/src/libcras
735cras_client_unittest_LDADD = -lgtest -lpthread -lrt -lspeexdsp
736
737cras_tm_unittest_SOURCES = tests/cras_tm_unittest.cc server/cras_tm.c
738cras_tm_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common \
739	 -I$(top_srcdir)/src/server
740cras_tm_unittest_LDADD = -lgtest -lpthread
741
742dev_io_unittest_SOURCES = \
743	$(CRAS_SELINUX_UNITTEST_SOURCES) \
744	common/cras_audio_format.c \
745	server/dev_io.c \
746	tests/dev_io_stubs.cc \
747	tests/iodev_stub.cc \
748	tests/empty_audio_stub.cc \
749	tests/metrics_stub.cc \
750	tests/rstream_stub.cc \
751	tests/dev_io_unittest.cc
752dev_io_unittest_CXXFLAGS = \
753	-std=c++11 -Wno-noexcept-type
754dev_io_unittest_CPPFLAGS = \
755	$(COMMON_CPPFLAGS) \
756	-I$(top_srcdir)/src/common \
757	-I$(top_srcdir)/src/server \
758	-I$(top_srcdir)/src/server/config \
759	-I$(SERVER_RUST_SRCDIR)/src/headers \
760	$(SELINUX_CFLAGS)
761dev_io_unittest_LDADD = \
762	libcrasmix.la \
763	$(CRAS_SSE4_2) \
764	$(CRAS_AVX) \
765	$(CRAS_AVX2) \
766	$(CRAS_FMA) \
767	$(SELINUX_LIBS) \
768	-lgtest -lrt -lpthread -ldl -lm -lspeexdsp
769
770dev_stream_unittest_SOURCES = tests/dev_stream_unittest.cc \
771	server/dev_stream.c common/cras_shm.c
772dev_stream_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) \
773	-I$(top_srcdir)/src/common -I$(top_srcdir)/src/server
774dev_stream_unittest_LDADD = -lgtest -liniparser -lpthread -lrt
775
776device_blocklist_unittest_SOURCES = tests/device_blocklist_unittest.cc \
777	server/config/cras_device_blocklist.c
778device_blocklist_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) \
779	-I$(top_srcdir)/src/common -I$(top_srcdir)/src/server \
780	-I$(top_srcdir)/src/server/config $(CRAS_UT_TMPDIR_CFLAGS)
781device_blocklist_unittest_LDADD = -lgtest -liniparser -lpthread
782
783device_monitor_unittest_SOURCES = tests/device_monitor_unittest.cc
784device_monitor_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common \
785	-I$(top_srcdir)/src/server
786device_monitor_unittest_LDADD = -lgtest -lpthread
787
788dsp_core_unittest_SOURCES = tests/dsp_core_unittest.cc dsp/eq.c dsp/eq2.c \
789	dsp/biquad.c dsp/dsp_util.c dsp/crossover.c dsp/crossover2.c dsp/drc.c \
790	dsp/drc_kernel.c dsp/drc_math.c
791dsp_core_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) $(DSP_INCLUDE_PATHS)
792dsp_core_unittest_LDADD = -lgtest -lpthread
793
794dsp_ini_unittest_SOURCES = tests/dsp_ini_unittest.cc \
795	server/cras_dsp_ini.c server/cras_expr.c common/dumper.c
796dsp_ini_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common \
797	-I$(top_srcdir)/src/server
798dsp_ini_unittest_LDADD = -lgtest -liniparser -lpthread
799
800dsp_pipeline_unittest_SOURCES = tests/cras_dsp_pipeline_unittest.cc \
801	server/cras_dsp_ini.c server/cras_expr.c server/cras_dsp_pipeline.c \
802	common/dumper.c dsp/dsp_util.c
803dsp_pipeline_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) \
804	-I$(top_srcdir)/src/server $(DSP_INCLUDE_PATHS)
805dsp_pipeline_unittest_LDADD = -lgtest -lrt -liniparser -lpthread
806
807dsp_unittest_SOURCES = tests/dsp_unittest.cc \
808	server/cras_dsp.c server/cras_dsp_ini.c server/cras_dsp_pipeline.c \
809	server/cras_expr.c common/dumper.c dsp/dsp_util.c \
810	dsp/tests/dsp_test_util.c
811dsp_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) \
812	-I$(top_srcdir)/src/server $(DSP_INCLUDE_PATHS)
813dsp_unittest_LDADD = -lgtest -lrt -liniparser -lpthread
814
815dumper_unittest_SOURCES = tests/dumper_unittest.cc common/dumper.c
816dumper_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common
817dumper_unittest_LDADD = -lgtest -lpthread
818
819edid_utils_unittest_SOURCES = tests/edid_utils_unittest.cc common/edid_utils.c
820edid_utils_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common
821edid_utils_unittest_LDADD = -lgtest -lpthread
822
823empty_iodev_unittest_SOURCES = tests/empty_iodev_unittest.cc \
824	server/cras_empty_iodev.c
825empty_iodev_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common \
826	-I$(top_srcdir)/src/server
827empty_iodev_unittest_LDADD = -lgtest -lpthread
828
829expr_unittest_SOURCES = tests/expr_unittest.cc server/cras_expr.c common/dumper.c
830expr_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common \
831	-I$(top_srcdir)/src/server
832expr_unittest_LDADD = -lgtest -lpthread
833
834file_wait_unittest_SOURCES = tests/file_wait_unittest.cc \
835	common/cras_file_wait.c common/cras_util.c
836file_wait_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common \
837	$(CRAS_UT_TMPDIR_CFLAGS)
838file_wait_unittest_LDADD = -lgtest -lpthread
839
840
841float_buffer_unittest_SOURCES = tests/float_buffer_unittest.cc
842float_buffer_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common \
843	-I$(top_srcdir)/src/server
844float_buffer_unittest_LDADD = -lgtest -lpthread
845
846fmt_conv_unittest_SOURCES = tests/fmt_conv_unittest.cc server/cras_fmt_conv.c \
847	server/cras_fmt_conv_ops.c
848fmt_conv_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common \
849	 -I$(top_srcdir)/src/server
850fmt_conv_unittest_LDADD = -lasound -lspeexdsp -lgtest -lpthread
851
852fmt_conv_ops_unittest_SOURCES = tests/fmt_conv_ops_unittest.cc \
853	server/cras_fmt_conv_ops.c
854fmt_conv_ops_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common \
855	 -I$(top_srcdir)/src/server
856fmt_conv_ops_unittest_LDADD = -lasound -lspeexdsp -lgtest -lpthread
857
858hfp_info_unittest_SOURCES = tests/hfp_info_unittest.cc \
859	tests/metrics_stub.cc tests/sbc_codec_stub.cc
860hfp_info_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common \
861	-I$(top_srcdir)/src/server -I$(top_srcdir)/src/plc
862hfp_info_unittest_LDADD = -lgtest -lpthread
863
864if HAVE_DBUS
865hfp_iodev_unittest_SOURCES = tests/hfp_iodev_unittest.cc \
866	server/cras_hfp_iodev.c
867hfp_iodev_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common \
868	-I$(top_srcdir)/src/server $(DBUS_CFLAGS)
869hfp_iodev_unittest_LDADD = -lgtest -lpthread $(DBUS_LIBS)
870
871hfp_alsa_iodev_unittest_SOURCES = tests/hfp_alsa_iodev_unittest.cc \
872	server/cras_hfp_alsa_iodev.c
873hfp_alsa_iodev_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) \
874	-I$(top_srcdir)/src/common -I$(top_srcdir)/src/server $(DBUS_CFLAGS)
875hfp_alsa_iodev_unittest_LDADD = -lgtest -lpthread $(DBUS_LIBS)
876
877hfp_ag_profile_unittest_SOURCES = tests/hfp_ag_profile_unittest.cc \
878	server/cras_hfp_ag_profile.c common/sfh.c tests/metrics_stub.cc
879hfp_ag_profile_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) \
880	-I$(top_srcdir)/src/common -I$(top_srcdir)/src/server $(DBUS_CFLAGS)
881hfp_ag_profile_unittest_LDADD = -lgtest -lpthread $(DBUS_LIBS)
882
883hfp_slc_unittest_SOURCES = tests/hfp_slc_unittest.cc \
884	server/cras_hfp_slc.c tests/metrics_stub.cc
885hfp_slc_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common \
886	-I$(top_srcdir)/src/server $(DBUS_CFLAGS)
887hfp_slc_unittest_LDADD = -lgtest -lpthread $(DBUS_LIBS)
888endif
889
890buffer_share_unittest_SOURCES = tests/buffer_share_unittest.cc \
891	server/buffer_share.c
892buffer_share_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) \
893	-I$(top_srcdir)/src/common -I$(top_srcdir)/src/server
894buffer_share_unittest_LDADD = -lgtest -liniparser -lpthread
895
896ewma_power_unittest_SOURCES = tests/ewma_power_unittest.cc \
897	common/cras_audio_format.c server/cras_audio_area.c \
898	server/ewma_power.c
899
900ewma_power_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) \
901	-I$(top_srcdir)/src/common -I$(top_srcdir)/src/server
902ewma_power_unittest_LDADD = -lgtest
903
904iodev_list_unittest_SOURCES = tests/iodev_list_unittest.cc \
905	server/cras_iodev_list.c
906iodev_list_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common \
907	 -I$(top_srcdir)/src/server
908iodev_list_unittest_LDADD = -lgtest -lpthread
909
910loopback_iodev_unittest_SOURCES = tests/loopback_iodev_unittest.cc \
911	server/cras_loopback_iodev.c common/cras_shm.c common/sfh.c
912loopback_iodev_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) \
913	-I$(top_srcdir)/src/common \
914	-I$(top_srcdir)/src/server
915loopback_iodev_unittest_LDADD = -lgtest -lpthread -lrt
916
917input_data_unittest_SOURCES = tests/input_data_unittest.cc \
918	server/input_data.c
919input_data_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common \
920	 -I$(top_srcdir)/src/dsp -I$(top_srcdir)/src/server
921input_data_unittest_LDADD = -lgtest -lpthread
922
923iodev_unittest_SOURCES = tests/iodev_unittest.cc \
924	server/cras_iodev.c common/cras_shm.c
925iodev_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common \
926	-I$(top_srcdir)/src/server \
927	-I$(SERVER_RUST_SRCDIR)/src/headers
928iodev_unittest_LDADD = -lgtest -lpthread -lrt
929
930mix_unittest_SOURCES = tests/mix_unittest.cc server/cras_mix.c
931mix_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common \
932	 -I$(top_srcdir)/src/server
933mix_unittest_LDADD = libcrasmix.la \
934	$(CRAS_SSE4_2) \
935	$(CRAS_AVX) \
936	$(CRAS_AVX2) \
937	$(CRAS_FMA) \
938	-lgtest \
939	-lpthread
940
941linear_resampler_unittest_SOURCES = tests/linear_resampler_unittest.cc \
942	server/linear_resampler.c server/cras_audio_area.c
943linear_resampler_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common \
944	 -I$(top_srcdir)/src/server
945linear_resampler_unittest_LDADD = -lgtest -lpthread
946
947observer_unittest_SOURCES = tests/observer_unittest.cc
948observer_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common \
949	-I$(top_srcdir)/src/server
950observer_unittest_LDADD = -lgtest -lpthread
951
952polled_interval_checker_unittest_SOURCES = tests/polled_interval_checker_unittest.cc \
953    server/polled_interval_checker.c
954polled_interval_checker_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common \
955	-I$(top_srcdir)/src/server
956polled_interval_checker_unittest_LDADD = -lgtest -lpthread
957
958ramp_unittest_SOURCES = tests/ramp_unittest.cc
959ramp_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common \
960	-I$(top_srcdir)/src/server
961ramp_unittest_LDADD = -lgtest -lpthread
962
963rate_estimator_unittest_SOURCES = tests/rate_estimator_unittest.cc
964rate_estimator_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common \
965	 -I$(top_srcdir)/src/server \
966	 -I$(SERVER_RUST_SRCDIR)/src/headers
967rate_estimator_unittest_LDADD = $(CRAS_RUST) -lgtest -ldl -lpthread
968
969control_rclient_unittest_SOURCES = tests/control_rclient_unittest.cc \
970				   server/cras_rstream_config.c
971control_rclient_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) \
972	-I$(top_srcdir)/src/common \
973	-I$(top_srcdir)/src/server $(CRAS_UT_TMPDIR_CFLAGS) \
974	$(DBUS_CFLAGS)
975control_rclient_unittest_LDADD = -lgtest -lpthread $(DBUS_LIBS)
976
977playback_rclient_unittest_SOURCES = tests/playback_rclient_unittest.cc \
978				    server/cras_rstream_config.c
979playback_rclient_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) \
980	-I$(top_srcdir)/src/common \
981	-I$(top_srcdir)/src/server $(CRAS_UT_TMPDIR_CFLAGS)
982playback_rclient_unittest_LDADD = -lgtest -lpthread
983
984capture_rclient_unittest_SOURCES = tests/capture_rclient_unittest.cc \
985				   server/cras_rstream_config.c
986capture_rclient_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) \
987	-I$(top_srcdir)/src/common \
988	-I$(top_srcdir)/src/server $(CRAS_UT_TMPDIR_CFLAGS)
989capture_rclient_unittest_LDADD = -lgtest -lpthread
990
991rstream_unittest_SOURCES = tests/rstream_unittest.cc server/cras_rstream.c \
992	common/cras_shm.c tests/metrics_stub.cc \
993	server/cras_rstream_config.c $(CRAS_SELINUX_UNITTEST_SOURCES)
994rstream_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common \
995	 -I$(top_srcdir)/src/server $(SELINUX_CFLAGS)
996rstream_unittest_LDADD = $(SELINUX_LIBS) \
997	-lasound -lgtest -lpthread -lrt
998
999server_metrics_unittest_SOURCES = tests/server_metrics_unittest.cc
1000server_metrics_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common \
1001	-I$(top_srcdir)/src/server
1002server_metrics_unittest_LDADD = -lgtest -lpthread
1003
1004shm_unittest_SOURCES = tests/shm_unittest.cc
1005shm_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common
1006shm_unittest_LDADD = -lgtest -lpthread
1007
1008softvol_curve_unittest_SOURCES = tests/softvol_curve_unittest.cc server/softvol_curve.c
1009softvol_curve_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common \
1010	 -I$(top_srcdir)/src/server
1011softvol_curve_unittest_LDADD = -lgtest -lpthread
1012
1013stream_list_unittest_SOURCES = tests/stream_list_unittest.cc \
1014	server/stream_list.c
1015stream_list_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common \
1016	 -I$(top_srcdir)/src/server
1017stream_list_unittest_LDADD = -lgtest -lpthread
1018
1019system_state_unittest_SOURCES = tests/system_state_unittest.cc \
1020	server/cras_system_state.c common/cras_shm.c \
1021       	$(CRAS_SELINUX_UNITTEST_SOURCES)
1022system_state_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) \
1023	-I$(top_srcdir)/src/common -I$(top_srcdir)/src/server \
1024	-I$(top_srcdir)/src/server/config $(SELINUX_CFLAGS)
1025system_state_unittest_LDADD = $(SELINUX_LIBS) \
1026	-lgtest -liniparser -lpthread -lrt
1027
1028timing_unittest_SOURCES = \
1029	$(CRAS_SELINUX_UNITTEST_SOURCES) \
1030	common/cras_audio_format.c \
1031	common/cras_shm.c \
1032	server/cras_audio_area.c \
1033	server/cras_fmt_conv.c \
1034	server/cras_fmt_conv_ops.c \
1035	server/cras_mix.c \
1036	server/cras_mix_ops.c \
1037	server/dev_io.c \
1038	server/dev_stream.c \
1039	server/linear_resampler.c \
1040	tests/dev_io_stubs.cc \
1041	tests/iodev_stub.cc \
1042	tests/empty_audio_stub.cc \
1043	tests/metrics_stub.cc \
1044	tests/rstream_stub.cc \
1045	tests/timing_unittest.cc
1046timing_unittest_CXXFLAGS = \
1047	-std=c++11 -Wno-noexcept-type
1048timing_unittest_CPPFLAGS = \
1049	$(COMMON_CPPFLAGS) \
1050	-I$(top_srcdir)/src/common \
1051	-I$(top_srcdir)/src/server \
1052	-I$(top_srcdir)/src/server/config \
1053	-I$(SERVER_RUST_SRCDIR)/src/headers \
1054	$(SELINUX_CFLAGS)
1055timing_unittest_LDADD = \
1056	libcrasmix.la \
1057	$(CRAS_SSE4_2) \
1058	$(CRAS_AVX) \
1059	$(CRAS_AVX2) \
1060	$(CRAS_FMA) \
1061	$(SELINUX_LIBS) \
1062	-lgtest -lrt -lpthread -ldl -lm -lspeexdsp
1063
1064utf8_unittest_SOURCES = tests/utf8_unittest.cc server/cras_utf8.c
1065utf8_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common \
1066	-I$(top_srcdir)/src/server
1067utf8_unittest_LDADD = -lgtest -lpthread
1068
1069util_unittest_SOURCES = tests/util_unittest.cc common/cras_util.c \
1070	common/cras_config.c
1071util_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/src/common
1072util_unittest_LDADD = -lgtest -lpthread
1073
1074volume_curve_unittest_SOURCES = tests/volume_curve_unittest.cc \
1075	server/cras_volume_curve.c
1076volume_curve_unittest_CPPFLAGS = $(COMMON_CPPFLAGS) \
1077	-I$(top_srcdir)/src/common -I$(top_srcdir)/src/server
1078volume_curve_unittest_LDADD = -lgtest -lpthread
1079