xref: /aosp_15_r20/external/libusb/tests/Makefile.am (revision 86b64dcb59b3a0b37502ecd56e119234366a6f7e)
1AM_CPPFLAGS = -I$(top_srcdir)/libusb
2LDADD = ../libusb/libusb-1.0.la
3AM_LDFLAGS = -static
4
5stress_SOURCES = stress.c testlib.c
6stress_mt_SOURCES = stress_mt.c
7set_option_SOURCES = set_option.c testlib.c
8init_context_SOURCES = init_context.c testlib.c
9macos_SOURCES = macos.c testlib.c
10
11stress_mt_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
12stress_mt_LDADD = $(LDADD) $(THREAD_LIBS)
13stress_mt_LDFLAGS = $(AM_LDFLAGS)
14
15if OS_EMSCRIPTEN
16# On the Web you can't block the main thread as this blocks the event loop itself,
17# causing deadlocks when trying to use async APIs like WebUSB.
18# We use the PROXY_TO_PTHREAD Emscripten's feature to move the main app to a separate thread
19# where it can block safely.
20stress_mt_LDFLAGS += ${AM_LDFLAGS} -s PROXY_TO_PTHREAD -s EXIT_RUNTIME
21endif
22
23noinst_HEADERS = libusb_testlib.h
24noinst_PROGRAMS = stress stress_mt set_option init_context
25if OS_DARWIN
26noinst_PROGRAMS += macos
27endif
28
29if BUILD_UMOCKDEV_TEST
30# NOTE: We add libumockdev-preload.so so that we can run tests in-process
31#       We also use -Wl,-lxxx as the compiler doesn't need it and libtool
32#       would reorder the flags otherwise.
33umockdev_CPPFLAGS = ${UMOCKDEV_CFLAGS} -I$(top_srcdir)/libusb
34umockdev_LDFLAGS = -Wl,--push-state,--no-as-needed -Wl,-lumockdev-preload -Wl,--pop-state ${UMOCKDEV_LIBS}
35umockdev_SOURCES = umockdev.c
36
37noinst_PROGRAMS += umockdev
38endif
39
40TESTS=$(noinst_PROGRAMS)
41