xref: /aosp_15_r20/external/libusb/tests/Makefile.am (revision 86b64dcb59b3a0b37502ecd56e119234366a6f7e)
1*86b64dcbSAndroid Build Coastguard WorkerAM_CPPFLAGS = -I$(top_srcdir)/libusb
2*86b64dcbSAndroid Build Coastguard WorkerLDADD = ../libusb/libusb-1.0.la
3*86b64dcbSAndroid Build Coastguard WorkerAM_LDFLAGS = -static
4*86b64dcbSAndroid Build Coastguard Worker
5*86b64dcbSAndroid Build Coastguard Workerstress_SOURCES = stress.c testlib.c
6*86b64dcbSAndroid Build Coastguard Workerstress_mt_SOURCES = stress_mt.c
7*86b64dcbSAndroid Build Coastguard Workerset_option_SOURCES = set_option.c testlib.c
8*86b64dcbSAndroid Build Coastguard Workerinit_context_SOURCES = init_context.c testlib.c
9*86b64dcbSAndroid Build Coastguard Workermacos_SOURCES = macos.c testlib.c
10*86b64dcbSAndroid Build Coastguard Worker
11*86b64dcbSAndroid Build Coastguard Workerstress_mt_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
12*86b64dcbSAndroid Build Coastguard Workerstress_mt_LDADD = $(LDADD) $(THREAD_LIBS)
13*86b64dcbSAndroid Build Coastguard Workerstress_mt_LDFLAGS = $(AM_LDFLAGS)
14*86b64dcbSAndroid Build Coastguard Worker
15*86b64dcbSAndroid Build Coastguard Workerif OS_EMSCRIPTEN
16*86b64dcbSAndroid Build Coastguard Worker# On the Web you can't block the main thread as this blocks the event loop itself,
17*86b64dcbSAndroid Build Coastguard Worker# causing deadlocks when trying to use async APIs like WebUSB.
18*86b64dcbSAndroid Build Coastguard Worker# We use the PROXY_TO_PTHREAD Emscripten's feature to move the main app to a separate thread
19*86b64dcbSAndroid Build Coastguard Worker# where it can block safely.
20*86b64dcbSAndroid Build Coastguard Workerstress_mt_LDFLAGS += ${AM_LDFLAGS} -s PROXY_TO_PTHREAD -s EXIT_RUNTIME
21*86b64dcbSAndroid Build Coastguard Workerendif
22*86b64dcbSAndroid Build Coastguard Worker
23*86b64dcbSAndroid Build Coastguard Workernoinst_HEADERS = libusb_testlib.h
24*86b64dcbSAndroid Build Coastguard Workernoinst_PROGRAMS = stress stress_mt set_option init_context
25*86b64dcbSAndroid Build Coastguard Workerif OS_DARWIN
26*86b64dcbSAndroid Build Coastguard Workernoinst_PROGRAMS += macos
27*86b64dcbSAndroid Build Coastguard Workerendif
28*86b64dcbSAndroid Build Coastguard Worker
29*86b64dcbSAndroid Build Coastguard Workerif BUILD_UMOCKDEV_TEST
30*86b64dcbSAndroid Build Coastguard Worker# NOTE: We add libumockdev-preload.so so that we can run tests in-process
31*86b64dcbSAndroid Build Coastguard Worker#       We also use -Wl,-lxxx as the compiler doesn't need it and libtool
32*86b64dcbSAndroid Build Coastguard Worker#       would reorder the flags otherwise.
33*86b64dcbSAndroid Build Coastguard Workerumockdev_CPPFLAGS = ${UMOCKDEV_CFLAGS} -I$(top_srcdir)/libusb
34*86b64dcbSAndroid Build Coastguard Workerumockdev_LDFLAGS = -Wl,--push-state,--no-as-needed -Wl,-lumockdev-preload -Wl,--pop-state ${UMOCKDEV_LIBS}
35*86b64dcbSAndroid Build Coastguard Workerumockdev_SOURCES = umockdev.c
36*86b64dcbSAndroid Build Coastguard Worker
37*86b64dcbSAndroid Build Coastguard Workernoinst_PROGRAMS += umockdev
38*86b64dcbSAndroid Build Coastguard Workerendif
39*86b64dcbSAndroid Build Coastguard Worker
40*86b64dcbSAndroid Build Coastguard WorkerTESTS=$(noinst_PROGRAMS)
41