test: rework gtest/gmock lookup

Rework the gtest/gmock lookup based on openbmc/gpioplus.

Change-Id: Ic53928e6f8b7a30e801976d62c910fe31bd4cc49
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/test/Makefile.am b/test/Makefile.am
index 2682d45..562de03 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,11 +1,13 @@
-AM_CPPFLAGS = -I$(top_srcdir)/ $(GTEST_CFLAGS) $(GMOCK_CFLAGS)
-AM_CXXFLAGS = \
-	$(GTEST_MAIN_CFLAGS)
+AM_CPPFLAGS = \
+	-I$(top_srcdir)/ \
+	$(GTEST_CFLAGS) \
+	$(GMOCK_CFLAGS) \
 	$(SDBUSPLUS_CFLAGS) \
 	$(PHOSPHOR_DBUS_INTERFACES_CFLAGS)
 AM_LDFLAGS = \
+	$(GTEST_LIBS) \
 	$(GMOCK_LIBS) \
-	$(GTEST_MAIN_LIBS) \
+	-lgmock_main \
 	$(OESDK_TESTCASE_FLAGS) \
 	$(SDBUSPLUS_LIBS) \
 	$(PHOSPHOR_DBUS_INTERFACES_LIBS)