Generate client headers for all interfaces

Use sdbus++'s client-header option to generate client header files for
the interfaces.

For now the header includes the interface's string, so that a user
will not have to define their own interface string anymore.

Tested: Verify the client.hpp are generated for each interface and get
        installed.

Depends-On: Idafc4724efa88a2dfd37e3f7735732c45171fd88
Signed-off-by: Lei YU <mine260309@gmail.com>
Change-Id: I966608e08b1745468fa37b30f6135e16e184a6bf
diff --git a/.gitignore b/.gitignore
index d270d59..aaaec40 100644
--- a/.gitignore
+++ b/.gitignore
@@ -48,6 +48,7 @@
 /config.h.in~
 /config.status
 Makefile
+/libtool
 *-libtool
 .libs
 *.hpp
diff --git a/Makefile.am b/Makefile.am
index 933e339..72ac4dc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -8,8 +8,8 @@
 libphosphor_dbus_la_LDFLAGS = $(SYSTEMD_LIBS) $(SDBUSPLUS_LIBS) -version-info 0:0:0 -shared
 libphosphor_dbus_la_CXXFLAGS = $(SYSTEMD_CFLAGS) $(SDBUSPLUS_CFLAGS) -flto
 
-BUILT_SOURCES = libphosphor_dbus.cpp
-CLEANFILES = libphosphor_dbus.cpp
+BUILT_SOURCES = libphosphor_dbus.cpp libphosphor_dbus_client.hpp
+CLEANFILES = libphosphor_dbus.cpp libphosphor_dbus_client.hpp
 
 pkgconfiglibdir = ${libdir}/pkgconfig
 pkgconfiglib_DATA = phosphor-dbus-interfaces.pc
diff --git a/generate_makefile.sh b/generate_makefile.sh
index 73840a3..036ec02 100755
--- a/generate_makefile.sh
+++ b/generate_makefile.sh
@@ -19,6 +19,10 @@
 	@mkdir -p \`dirname \$@\`
 	\$(SDBUSPLUSPLUS) -r \$(srcdir) interface server-header ${iface} > \$@
 
+${i%.interface.yaml}/client.hpp: ${i}
+	@mkdir -p \`dirname \$@\`
+	\$(SDBUSPLUSPLUS) -r \$(srcdir) interface client-header ${iface} > \$@
+
 MAKEFILE
 
 done
@@ -63,19 +67,30 @@
 do
     echo "	${e%.errors.yaml}/error.hpp\\"
 done
+echo
 
+echo "libphosphor_dbus_client_hpp_SOURCES = \\"
+for i in ${interfaces};
+do
+    echo "	${i%.interface.yaml}/client.hpp \\"
+done
 echo
 
 cat << MAKEFILE
 libphosphor_dbus.cpp: \$(libphosphor_dbus_cpp_SOURCES)
 	cat \$^ > \$@
 
-nobase_include_HEADERS = \$(libphosphor_dbus_hpp_SOURCES)
+libphosphor_dbus_client.hpp: \$(libphosphor_dbus_client_hpp_SOURCES)
+	cat \$^ > \$@
+
+nobase_include_HEADERS = \$(libphosphor_dbus_hpp_SOURCES) \\
+                         \$(libphosphor_dbus_client_hpp_SOURCES)
 
 .PHONY: clean-dbus
 clean-dbus:
 	for i in \$(libphosphor_dbus_cpp_SOURCES) \\
-	         \$(libphosphor_dbus_hpp_SOURCES); \\
+	         \$(libphosphor_dbus_hpp_SOURCES) \\
+	         \$(libphosphor_dbus_client_hpp_SOURCES); \\
 	do \\
 	    test -e \$\$i && rm \$\$i ; \\
 	    test -d \`dirname \$\$i\` && rmdir -p \`dirname \$\$i\` ; \\