driver list: move more driver presence conditions from build rules to source files
[autotool-experiments.git] / Makefile.am
blobb411eb038b831a541c29f64a6a990d5c8f2a0f62
1 ACLOCAL_AMFLAGS = -I m4
3 # Remove the tedium of keeping track whether an automake variable
4 # previously was assigned to, and whether = or += _must_ be used.
5 # Start empty, and always append.
6 bin_PROGRAMS =
7 noinst_LTLIBRARIES =
8 lib_LTLIBRARIES =
10 # Create a library for typical application tasks. Also include the
11 # drivers' implementation as well as the support code to enumerate
12 # the available drivers. The separation into application code and
13 # the drivers library (as it was inherited from the libisgrok build)
14 # has become obsolete.
15 COMBO_LIBRARY = src/libcombo.la
16 COMBO_LIB_FILENAME = src/.libs/libcombo.a
17 COMBO_DLL_FILENAME = src/.libs/libcombo.so
18 lib_LTLIBRARIES += $(COMBO_LIBRARY)
19 src_libcombo_la_SOURCES = src/comm.c src/comm.h
20 src_libcombo_la_SOURCES += src/drivers.c src/drivers.h
21 src_libcombo_la_SOURCES += src/driver_1.c
22 src_libcombo_la_SOURCES += src/driver_2.c
23 src_libcombo_la_SOURCES += src/driver_3.c
24 src_libcombo_la_SOURCES += src/driver_4.c
25 src_libcombo_la_SOURCES += src/driver_5.c
26 src_libcombo_la_SOURCES += src/driver_67.c
27 src_libcombo_la_SOURCES += src/driver_8.c
28 src_libcombo_la_LDFLAGS = -version-info 1:2:0 -Wl,-T,$(srcdir)/drivers.ld
30 # TODO How to run a command _after_ the library was created? Want to
31 # dump the resulting drivers list similar to what CMake POST_BUILD does:
32 # $ objdump -s -j __sr_driver_list -j __DATA,__sr_driver_list $<TARGET_FILE:combo>
34 dump_driver_list_a: $(COMBO_LIB_FILENAME)
35         objdump -s -j __sr_driver_list -j __DATA,__sr_driver_list $^
37 dump_driver_list_so: $(COMBO_DLL_FILENAME)
38         objdump -s -j __sr_driver_list -j __DATA,__sr_driver_list $^
40 dump: dump_driver_list_a dump_driver_list_so
42 # Create an application which uses the combined library.
43 bin_PROGRAMS += app_combo
44 app_combo_SOURCES = src/app_main.c
45 app_combo_LDADD = $(COMBO_LIBRARY)
47 # BEWARE! The above _LDADD instruction references the shared library.
48 # Static linking fails "in the absence" of the driver list start symbol.
49 # Which is provided by the linker script, which does not take effect
50 # when the .a static library gets created. :(
52 # app_combo_LDFLAGS = -Wl,--push-state,--whole-archive,$(COMBO_LIB_FILENAME),--pop-state
53 # app_combo_LDFLAGS = -Wl,--whole-archive,$(COMBO_LIB_FILENAME),--no-whole-archive