We use these utility functions both in the daemon and
for test programs, so create a new convenience library
that we can compile once and include in both places.

Signed-off-by: Andrea Bolognani <abolo...@redhat.com>
---
 src/Makefile.am   | 11 ++++++++++-
 tests/Makefile.am |  4 +++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index 1b73c8d..493cf81 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -18,12 +18,20 @@ AM_LDFLAGS = \
        $(PID_LDFLAGS) \
        $(NULL)
 
+noinst_LTLIBRARIES = \
+       libutil.la \
+       $(NULL)
+
+libutil_la_SOURCES = \
+       util.c \
+       util.h \
+       $(NULL)
+
 bin_PROGRAMS = libvirt-dbus
 
 libvirt_dbus_SOURCES = \
        main.c \
        connect.c connect.h \
-       util.c util.h \
        domain.c domain.h \
        events.c events.h \
        gdbus.c gdbus.h \
@@ -35,6 +43,7 @@ libvirt_dbus_SOURCES = \
        storagevol.c storagevol.h \
        $(NULL)
 libvirt_dbus_LDADD = \
+       libutil.la \
        $(GIO2_LIBS) \
        $(GLIB2_LIBS) \
        $(LIBVIRT_LIBS) \
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 03d51aa..2991689 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -18,7 +18,8 @@ check_PROGRAMS = \
        test_util
 
 test_util_SOURCES = \
-       test_util.c $(top_srcdir)/src/util.c
+       test_util.c \
+       $(NULL)
 test_util_CFLAGS = \
        $(GIO2_CFLAGS) \
        $(GLIB2_CFLAGS) \
@@ -28,6 +29,7 @@ test_util_LDFLAGS = \
        $(GLIB2_LDFLAGS) \
        $(LIBVIRT_LDFLAGS)
 test_util_LDADD = \
+       $(top_builddir)/src/libutil.la \
        $(GIO2_LIBS) \
        $(GLIB2_LIBS) \
        $(LIBVIRT_LIBS)
-- 
2.17.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to