build: use a common library for shared pieces

Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: Ic4b645091c71f270ba3b2f290f7206ebe3222f1d
diff --git a/Makefile.am b/Makefile.am
index 8743f70..42cdcbf 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -35,8 +35,19 @@
 endif
 
 ACLOCAL_AMFLAGS = -I m4
+AM_DEFAULT_SOURCE_EXT = .cpp
 
-SUBDIRS =
+noinst_LTLIBRARIES = libfirmware_common.la
+libfirmware_common_la_SOURCES = \
+	util.cpp \
+	internal/sys.cpp
+libfirmware_common_la_CXXFLAGS = \
+	$(CODE_COVERAGE_CXXFLAGS) \
+	-flto
+libfirmware_common_la_LDFLAGS = \
+	$(CODE_COVERAGE_LIBS)
+
+SUBDIRS = .
 
 if BUILD_BMC_HANDLER
 SUBDIRS += bmc