Makefile: split out common libary code for testing
We want to be able to link against our library code for testing without
including the ipmi specific start up code. This refactors the build to
produce a static library with most of the logic which gets linked into
the final ipmi provider.
Change-Id: I97ec6613654d8209fca29a1a33103527b78d154e
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/Makefile.am b/Makefile.am
index d37ef87..314e759 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,20 +5,25 @@
gbmc-psu-hardreset.target
endif
-libsyscmdsdir = ${libdir}/ipmid-providers
-libsyscmds_LTLIBRARIES = libsyscmds.la
-libsyscmds_la_SOURCES = main.cpp cable.cpp cpld.cpp eth.cpp psu.cpp pcie_i2c.cpp entity_name.cpp
-
-libsyscmds_la_LDFLAGS = \
+noinst_LTLIBRARIES = libsyscmds_common.la
+libsyscmds_common_la_SOURCES = cable.cpp cpld.cpp eth.cpp psu.cpp pcie_i2c.cpp entity_name.cpp
+libsyscmds_common_la_CXXFLAGS = \
+ $(SDBUSPLUS_CFLAGS) \
+ $(PHOSPHOR_LOGGING_CFLAGS)
+libsyscmds_common_la_LDFLAGS = \
$(SDBUSPLUS_LIBS) \
$(PHOSPHOR_LOGGING_LIBS) \
+ -lstdc++fs
+
+libsyscmdsdir = ${libdir}/ipmid-providers
+libsyscmds_LTLIBRARIES = libsyscmds.la
+libsyscmds_la_SOURCES = main.cpp
+libsyscmds_la_LIBADD = libsyscmds_common.la
+libsyscmds_la_LDFLAGS = \
$(LIBIPMID_LIBS) \
- -lstdc++fs \
-version-info 0:0:0 -shared
libsyscmds_la_CXXFLAGS = \
- $(SDBUSPLUS_CFLAGS) \
- $(PHOSPHOR_LOGGING_CFLAGS) \
$(LIBIPMID_CFLAGS) \
-flto