build: split object to enable coverage
Split the object into two pieces so we can pass part of it to the
unit-tests.
Tested: Verified the coverage output processed the files.
Change-Id: Iea97da797982464d394986a70946a03ac50a479d
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/Makefile.am b/Makefile.am
index 234496e..bc5b5d7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -37,10 +37,8 @@
ACLOCAL_AMFLAGS = -I m4
AM_DEFAULT_SOURCE_EXT = .cpp
-libfirmwareblobdir = ${libdir}/ipmid-providers
-libfirmwareblob_LTLIBRARIES = libfirmwareblob.la
-libfirmwareblob_la_SOURCES = \
- main.cpp \
+noinst_LTLIBRARIES = libfirmwareblob_common.la
+libfirmwareblob_common_la_SOURCES = \
firmware_handler.cpp \
lpc_handler.cpp \
pci_handler.cpp \
@@ -48,6 +46,21 @@
lpc_aspeed.cpp \
lpc_nuvoton.cpp \
internal/sys.cpp
+libfirmwareblob_common_la_CXXFLAGS = \
+ $(SDBUSPLUS_CFLAGS) \
+ $(PHOSPHOR_LOGGING_CFLAGS) \
+ $(CODE_COVERAGE_CXXFLAGS) \
+ -flto
+libfirmwareblob_common_la_LDFLAGS = \
+ $(SDBUSPLUS_LIBS) \
+ $(PHOSPHOR_LOGGING_LIBS) \
+ $(CODE_COVERAGE_LIBS) \
+ -lstdc++fs
+
+libfirmwareblobdir = ${libdir}/ipmid-providers
+libfirmwareblob_LTLIBRARIES = libfirmwareblob.la
+libfirmwareblob_la_SOURCES = main.cpp
+libfirmwareblob_la_LIBADD = libfirmwareblob_common.la
libfirmwareblob_la_LDFLAGS = \
$(SDBUSPLUS_LIBS) \
$(PHOSPHOR_LOGGING_LIBS) \
diff --git a/test/Makefile.am b/test/Makefile.am
index 117e3d3..0f0a18e 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -38,46 +38,46 @@
TESTS = $(check_PROGRAMS)
firmware_createhandler_unittest_SOURCES = firmware_createhandler_unittest.cpp
-firmware_createhandler_unittest_LDADD = $(top_builddir)/firmware_handler.o
+firmware_createhandler_unittest_LDADD = $(top_builddir)/libfirmwareblob_common.la
firmware_handler_unittest_SOURCES = firmware_handler_unittest.cpp
-firmware_handler_unittest_LDADD = $(top_builddir)/firmware_handler.o
+firmware_handler_unittest_LDADD = $(top_builddir)/libfirmwareblob_common.la
firmware_stat_unittest_SOURCES = firmware_stat_unittest.cpp
-firmware_stat_unittest_LDADD = $(top_builddir)/firmware_handler.o
+firmware_stat_unittest_LDADD = $(top_builddir)/libfirmwareblob_common.la
firmware_canhandle_unittest_SOURCES = firmware_canhandle_unittest.cpp
-firmware_canhandle_unittest_LDADD = $(top_builddir)/firmware_handler.o
+firmware_canhandle_unittest_LDADD = $(top_builddir)/libfirmwareblob_common.la
firmware_open_unittest_SOURCES = firmware_open_unittest.cpp
-firmware_open_unittest_LDADD = $(top_builddir)/firmware_handler.o
+firmware_open_unittest_LDADD = $(top_builddir)/libfirmwareblob_common.la
firmware_write_unittest_SOURCES = firmware_write_unittest.cpp
-firmware_write_unittest_LDADD = $(top_builddir)/firmware_handler.o
+firmware_write_unittest_LDADD = $(top_builddir)/libfirmwareblob_common.la
firmware_writemeta_unittest_SOURCES = firmware_writemeta_unittest.cpp
-firmware_writemeta_unittest_LDADD = $(top_builddir)/firmware_handler.o
+firmware_writemeta_unittest_LDADD = $(top_builddir)/libfirmwareblob_common.la
firmware_close_unittest_SOURCES = firmware_close_unittest.cpp
-firmware_close_unittest_LDADD = $(top_builddir)/firmware_handler.o
+firmware_close_unittest_LDADD = $(top_builddir)/libfirmwareblob_common.la
firmware_delete_unittest_SOURCES = firmware_delete_unittest.cpp
-firmware_delete_unittest_LDADD = $(top_builddir)/firmware_handler.o
+firmware_delete_unittest_LDADD = $(top_builddir)/libfirmwareblob_common.la
firmware_sessionstat_unittest_SOURCES = firmware_sessionstat_unittest.cpp
-firmware_sessionstat_unittest_LDADD = $(top_builddir)/firmware_handler.o
+firmware_sessionstat_unittest_LDADD = $(top_builddir)/libfirmwareblob_common.la
firmware_commit_unittest_SOURCES = firmware_commit_unittest.cpp
-firmware_commit_unittest_LDADD = $(top_builddir)/firmware_handler.o
+firmware_commit_unittest_LDADD = $(top_builddir)/libfirmwareblob_common.la
file_handler_unittest_SOURCES = file_handler_unittest.cpp
-file_handler_unittest_LDADD = $(top_builddir)/file_handler.o -lstdc++fs
+file_handler_unittest_LDADD = $(top_builddir)/libfirmwareblob_common.la -lstdc++fs
tools_bt_unittest_SOURCES = tools_bt_unittest.cpp
-tools_bt_unittest_LDADD = $(top_builddir)/tools/bt.o
+tools_bt_unittest_LDADD = $(top_builddir)/tools/libupdater.la
tools_lpc_unittest_SOURCES = tools_lpc_unittest.cpp
-tools_lpc_unittest_LDADD = $(top_builddir)/tools/lpc.o
+tools_lpc_unittest_LDADD = $(top_builddir)/tools/libupdater.la
tools_updater_unittest_SOURCES = tools_updater_unittest.cpp
-tools_updater_unittest_LDADD = $(top_builddir)/tools/updater.o
+tools_updater_unittest_LDADD = $(top_builddir)/tools/libupdater.la