libipmi: Decouple user commands

This makes them an optional, separate provider like the sysfs cmds.

Tested:
    Ran on real hardware that included libusercmds.so in
    /usr/lib/host-ipmid and on a machine that did not include it. Ran
    ipmitool on the host to verify that the user commands were present
    when expected.

Change-Id: I07b3af5ae603c3e5f1ea41f0afc309329f4e185d
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/Makefile.am b/Makefile.am
index 6ced8fc..63718f9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -66,7 +66,6 @@
 	$(AM_V_GEN)@CHANNELGEN@ -o $(top_builddir) generate-cpp
 
 providers_LTLIBRARIES += libipmi20.la
-libipmi20_la_LIBADD = user_channel/libuserlayer.la
 libipmi20_la_SOURCES = \
 	net.cpp \
 	app/channel.cpp \
@@ -88,8 +87,6 @@
 	ipmi_fru_info_area.cpp \
 	read_fru_data.cpp \
 	sensordatahandler.cpp \
-	user_channel/usercommands.cpp \
-	user_channel/channelcommands.cpp \
 	$(libipmi20_BUILT_LIST)
 
 @CODE_COVERAGE_RULES@
@@ -104,7 +101,6 @@
 	$(libmapper_LIBS) \
 	$(PHOSPHOR_LOGGING_LIBS) \
 	$(PHOSPHOR_DBUS_INTERFACES_LIBS) \
-	$(LIBS) \
 	-lstdc++fs \
 	-version-info 0:0:0 -shared
 libipmi20_la_CXXFLAGS = \
@@ -115,6 +111,19 @@
 	$(PHOSPHOR_DBUS_INTERFACES_CFLAGS) \
 	-flto
 
+providers_LTLIBRARIES += libusercmds.la
+libusercmds_la_LIBADD = user_channel/libuserlayer.la
+libusercmds_la_SOURCES = \
+	user_channel/usercommands.cpp \
+	user_channel/channelcommands.cpp
+libusercmds_la_LDFLAGS = \
+	$(PHOSPHOR_LOGGING_LIBS) \
+	$(LIBS) \
+	-version-info 0:0:0 -shared
+libusercmds_la_CXXFLAGS = \
+	$(PHOSPHOR_LOGGING_CFLAGS) \
+	-flto
+
 providers_LTLIBRARIES += libsysintfcmds.la
 libsysintfcmds_la_SOURCES = \
 	systemintfcmds.cpp \