Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/Makefile.am | 85 +----------------------------------
src/network/Makefile.inc.am | 106 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 107 insertions(+), 84 deletions(-)
create mode 100644 src/network/Makefile.inc.am
diff --git a/src/Makefile.am b/src/Makefile.am
index e50f6eecb3..d16cbe2f0c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -99,6 +99,7 @@ include xenapi/Makefile.inc.am
include vz/Makefile.inc.am
include lxc/Makefile.inc.am
include interface/Makefile.inc.am
+include network/Makefile.inc.am
THREAD_LIBS = $(LIB_PTHREAD) $(LTLIBMULTITHREAD)
@@ -114,9 +115,6 @@ SECDRIVER_CFLAGS += $(APPARMOR_CFLAGS)
SECDRIVER_LIBS += $(APPARMOR_LIBS)
endif WITH_SECDRIVER_APPARMOR
-if WITH_NETWORK
-UUID=$(shell uuidgen 2>/dev/null)
-endif WITH_NETWORK
lib_LTLIBRARIES = libvirt.la libvirt-qemu.la libvirt-lxc.la
@@ -782,7 +780,6 @@ check-drivername:
EXTRA_DIST += check-drivername.pl
DRIVER_SOURCE_FILES += \
- $(NETWORK_DRIVER_SOURCES) \
$(NODE_DEVICE_DRIVER_SOURCES) \
$(NODE_DEVICE_DRIVER_HAL_SOURCES) \
$(NODE_DEVICE_DRIVER_UDEV_SOURCES) \
@@ -793,7 +790,6 @@ DRIVER_SOURCE_FILES += \
$(NULL)
STATEFUL_DRIVER_SOURCE_FILES += \
- $(NETWORK_DRIVER_SOURCES) \
$(NODE_DEVICE_DRIVER_SOURCES) \
$(NWFILTER_DRIVER_SOURCES) \
$(SECRET_DRIVER_SOURCES) \
@@ -830,12 +826,6 @@ SECURITY_DRIVER_APPARMOR_HELPER_SOURCES = \
$(DATATYPES_SOURCES) \
security/virt-aa-helper.c
-NETWORK_DRIVER_SOURCES = \
- network/bridge_driver.h network/bridge_driver.c \
- network/bridge_driver_platform.h \
- network/bridge_driver_platform.c \
- $(NULL)
-EXTRA_DIST += network/bridge_driver_linux.c network/bridge_driver_nop.c
SECRET_UTIL_SOURCES = \
secret/secret_util.h secret/secret_util.c
@@ -894,9 +884,6 @@ STORAGE_HELPER_DISK_SOURCES = \
UTIL_IO_HELPER_SOURCES = \
util/iohelper.c
-NETWORK_LEASES_HELPER_SOURCES = \
- network/leaseshelper.c
-
# Network filters
NWFILTER_DRIVER_SOURCES = \
nwfilter/nwfilter_driver.h nwfilter/nwfilter_driver.c \
@@ -1167,27 +1154,6 @@ EXTRA_DIST += \
$< $(srcdir)/$(subst $(srcdir)/,,$@)
-if WITH_NETWORK
-noinst_LTLIBRARIES += libvirt_driver_network_impl.la
-libvirt_driver_network_la_SOURCES =
-libvirt_driver_network_la_LIBADD = libvirt_driver_network_impl.la
-mod_LTLIBRARIES += libvirt_driver_network.la
-libvirt_driver_network_la_LIBADD += libvirt.la ../gnulib/lib/libgnu.la \
- $(LIBNL_LIBS) \
- $(DBUS_LIBS) \
- $(NULL)
-libvirt_driver_network_la_LDFLAGS = $(AM_LDFLAGS_MOD_NOUNDEF)
-
-libvirt_driver_network_impl_la_CFLAGS = \
- $(LIBNL_CFLAGS) \
- $(DBUS_CFLAGS) \
- -I$(srcdir)/access \
- -I$(srcdir)/conf \
- $(AM_CFLAGS)
-libvirt_driver_network_impl_la_SOURCES = $(NETWORK_DRIVER_SOURCES)
-libvirt_driver_network_impl_la_LIBADD = $(DBUS_LIBS)
-endif WITH_NETWORK
-EXTRA_DIST += network/default.xml
if WITH_SECRETS
@@ -1530,7 +1496,6 @@ access/viraccessapichecklxc.c: $(srcdir)/rpc/gendispatch.pl \
# Add all conditional sources just in case...
EXTRA_DIST += \
$(REMOTE_DRIVER_SOURCES) \
- $(NETWORK_DRIVER_SOURCES) \
$(STORAGE_DRIVER_SOURCES) \
$(STORAGE_DRIVER_FS_SOURCES) \
$(STORAGE_DRIVER_LVM_SOURCES) \
@@ -2652,27 +2617,6 @@ libvirt_iohelper_CFLAGS = \
$(PIE_CFLAGS) \
$(NULL)
-if WITH_NETWORK
-libexec_PROGRAMS += libvirt_leaseshelper
-libvirt_leaseshelper_SOURCES = $(NETWORK_LEASES_HELPER_SOURCES)
-libvirt_leaseshelper_LDFLAGS = \
- $(AM_LDFLAGS) \
- $(PIE_LDFLAGS) \
- $(NULL)
-libvirt_leaseshelper_LDADD = \
- libvirt_util.la \
- ../gnulib/lib/libgnu.la
-if WITH_DTRACE_PROBES
-libvirt_leaseshelper_LDADD += libvirt_probes.lo
-endif WITH_DTRACE_PROBES
-
-libvirt_leaseshelper_CFLAGS = \
- $(AM_CFLAGS) \
- $(PIE_CFLAGS) \
- $(NULL)
-else ! WITH_NETWORK
-EXTRA_DIST += $(NETWORK_LEASES_HELPER_SOURCES)
-endif ! WITH_NETWORK
endif WITH_LIBVIRTD
@@ -2834,25 +2778,6 @@ endif WITH_LIBVIRTD
if WITH_SANLOCK
$(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/sanlock"
endif WITH_SANLOCK
-if WITH_NETWORK
- $(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/network"
- $(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/dnsmasq"
- $(MKDIR_P) "$(DESTDIR)$(localstatedir)/run/libvirt/network"
- $(MKDIR_P) "$(DESTDIR)$(confdir)/qemu/networks/autostart"
- $(INSTALL_DATA) $(srcdir)/network/default.xml \
- $(DESTDIR)$(confdir)/qemu/networks/default.xml
- test -z "$(UUID)" || \
- { sed -e "s,</name>,</name>; <uuid>$(UUID)</uuid>,"
\
- $(DESTDIR)$(confdir)/qemu/networks/default.xml | \
- tr ";" "\n" > \
- $(DESTDIR)$(confdir)/qemu/networks/default.xml.t && \
- cp $(DESTDIR)$(confdir)/qemu/networks/default.xml.t \
- $(DESTDIR)$(confdir)/qemu/networks/default.xml && \
- rm $(DESTDIR)$(confdir)/qemu/networks/default.xml.t; }
- ( cd $(DESTDIR)$(confdir)/qemu/networks/autostart && \
- rm -f default.xml && \
- $(LN_S) ../default.xml default.xml )
-endif WITH_NETWORK
uninstall-local:: uninstall-init uninstall-systemd uninstall-upstart \
uninstall-sysctl uninstall-polkit uninstall-sasl \
@@ -2870,14 +2795,6 @@ endif WITH_LIBVIRTD
if WITH_SANLOCK
rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/sanlock" ||:
endif WITH_SANLOCK
-if WITH_NETWORK
- rm -f $(DESTDIR)$(confdir)/qemu/networks/autostart/default.xml
- rm -f $(DESTDIR)$(confdir)/qemu/networks/default.xml
- rmdir "$(DESTDIR)$(confdir)/qemu/networks/autostart" || :
- rmdir "$(DESTDIR)$(confdir)/qemu/networks" || :
- rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/network" ||:
- rmdir "$(DESTDIR)$(localstatedir)/run/libvirt/network" ||:
-endif WITH_NETWORK
rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt" ||:
CLEANFILES += *.gcov .libs/*.gcda .libs/*.gcno *.gcno *.gcda *.i *.s
diff --git a/src/network/Makefile.inc.am b/src/network/Makefile.inc.am
new file mode 100644
index 0000000000..508c8c0422
--- /dev/null
+++ b/src/network/Makefile.inc.am
@@ -0,0 +1,106 @@
+NETWORK_DRIVER_SOURCES = \
+ network/bridge_driver.h \
+ network/bridge_driver.c \
+ network/bridge_driver_platform.h \
+ network/bridge_driver_platform.c \
+ $(NULL)
+
+NETWORK_DRIVER_PLATFORM_INC = \
+ network/bridge_driver_linux.c \
+ network/bridge_driver_nop.c \
+ $(NULL)
+
+NETWORK_LEASES_HELPER_SOURCES = \
+ network/leaseshelper.c \
+ $(NULL)
+
+DRIVER_SOURCE_FILES += $(NETWORK_DRIVER_SOURCES)
+STATEFUL_DRIVER_SOURCE_FILES += $(NETWORK_DRIVER_SOURCES)
+EXTRA_DIST += \
+ $(NETWORK_DRIVER_SOURCES) \
+ $(NETWORK_DRIVER_PLATFORM_INC) \
+ $(NETWORK_LEASES_HELPER_SOURCES) \
+ $(NULL)
+
+
+if WITH_NETWORK
+
+noinst_LTLIBRARIES += libvirt_driver_network_impl.la
+libvirt_driver_network_la_SOURCES =
+libvirt_driver_network_la_LIBADD = \
+ libvirt_driver_network_impl.la \
+ libvirt.la \
+ ../gnulib/lib/libgnu.la \
+ $(LIBNL_LIBS) \
+ $(DBUS_LIBS) \
+ $(NULL)
+mod_LTLIBRARIES += libvirt_driver_network.la
+libvirt_driver_network_la_LDFLAGS = $(AM_LDFLAGS_MOD_NOUNDEF)
+
+libvirt_driver_network_impl_la_CFLAGS = \
+ $(LIBNL_CFLAGS) \
+ $(DBUS_CFLAGS) \
+ -I$(srcdir)/access \
+ -I$(srcdir)/conf \
+ $(AM_CFLAGS) \
+ $(NULL)
+libvirt_driver_network_impl_la_SOURCES = $(NETWORK_DRIVER_SOURCES)
+libvirt_driver_network_impl_la_LIBADD = $(DBUS_LIBS)
+
+libexec_PROGRAMS += libvirt_leaseshelper
+libvirt_leaseshelper_SOURCES = $(NETWORK_LEASES_HELPER_SOURCES)
+libvirt_leaseshelper_LDFLAGS = \
+ $(AM_LDFLAGS) \
+ $(PIE_LDFLAGS) \
+ $(NULL)
+libvirt_leaseshelper_LDADD = \
+ libvirt_util.la \
+ ../gnulib/lib/libgnu.la
+if WITH_DTRACE_PROBES
+libvirt_leaseshelper_LDADD += libvirt_probes.lo
+endif WITH_DTRACE_PROBES
+
+libvirt_leaseshelper_CFLAGS = \
+ $(AM_CFLAGS) \
+ $(PIE_CFLAGS) \
+ $(NULL)
+
+INSTALL_DATA_DIRS += network
+
+UUID=$(shell uuidgen 2>/dev/null)
+
+install-data-network:
+ $(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/network"
+ $(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/dnsmasq"
+ $(MKDIR_P) "$(DESTDIR)$(localstatedir)/run/libvirt/network"
+ $(MKDIR_P) "$(DESTDIR)$(confdir)/qemu/networks/autostart"
+ $(INSTALL_DATA) $(srcdir)/network/default.xml \
+ $(DESTDIR)$(confdir)/qemu/networks/default.xml
+ test -z "$(UUID)" || \
+ { sed -e "s,</name>,</name>; <uuid>$(UUID)</uuid>,"
\
+ $(DESTDIR)$(confdir)/qemu/networks/default.xml | \
+ tr ";" "\n" > \
+ $(DESTDIR)$(confdir)/qemu/networks/default.xml.t && \
+ cp $(DESTDIR)$(confdir)/qemu/networks/default.xml.t \
+ $(DESTDIR)$(confdir)/qemu/networks/default.xml && \
+ rm $(DESTDIR)$(confdir)/qemu/networks/default.xml.t; }
+ ( cd $(DESTDIR)$(confdir)/qemu/networks/autostart && \
+ rm -f default.xml && \
+ $(LN_S) ../default.xml default.xml )
+
+uninstall-data-network:
+ rm -f $(DESTDIR)$(confdir)/qemu/networks/autostart/default.xml
+ rm -f $(DESTDIR)$(confdir)/qemu/networks/default.xml
+ rmdir "$(DESTDIR)$(confdir)/qemu/networks/autostart" || :
+ rmdir "$(DESTDIR)$(confdir)/qemu/networks" || :
+ rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/network" ||:
+ rmdir "$(DESTDIR)$(localstatedir)/run/libvirt/network" ||:
+
+endif WITH_NETWORK
+
+EXTRA_DIST += network/default.xml
+
+.PHONY: \
+ install-data-network \
+ uninstall-data-network \
+ $(NULL)
--
2.14.3