Let makefiles call RNG2C for generating codes automatically.
Signed-off-by: Shi Lei <shi_lei(a)massclouds.com>
---
src/Makefile.am | 16 +++++++++++++++-
src/access/Makefile.inc.am | 2 +-
src/conf/Makefile.inc.am | 10 +++++++++-
src/esx/Makefile.inc.am | 2 +-
src/interface/Makefile.inc.am | 2 +-
src/lxc/Makefile.inc.am | 1 +
src/network/Makefile.inc.am | 2 +-
src/node_device/Makefile.inc.am | 2 +-
src/nwfilter/Makefile.inc.am | 2 +-
src/qemu/Makefile.inc.am | 1 +
src/remote/Makefile.inc.am | 2 +-
src/secret/Makefile.inc.am | 2 +-
src/storage/Makefile.inc.am | 2 +-
src/test/Makefile.inc.am | 2 +-
src/util/Makefile.inc.am | 11 ++++++++++-
src/vbox/Makefile.inc.am | 2 +-
tests/Makefile.am | 2 ++
tools/Makefile.am | 2 ++
18 files changed, 51 insertions(+), 14 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 12dd6b8..dc2adb0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -23,7 +23,7 @@ AM_CPPFLAGS = -I$(top_srcdir) \
-I../include \
-I$(top_srcdir)/include \
-I$(srcdir)/util \
- -I./util \
+ -I./util -I./conf \
-DIN_LIBVIRT \
-Dabs_top_builddir="\"$(abs_top_builddir)\"" \
-Dabs_top_srcdir="\"$(abs_top_srcdir)\"" \
@@ -87,6 +87,20 @@ sbin_PROGRAMS =
bin_PROGRAMS =
DRIVER_SOURCES =
+RNG2C_GENERATED_FILES_STAMP = .rng2c_generator.stamp
+RNG_FILES = $(wildcard $(top_srcdir)/docs/schemas/*.rng)
+RNG2C_SOURCE = $(wildcard $(top_srcdir)/rng2c/*.py)
+RNG2C_ENTRIES = network.rng
+
+$(RNG2C_GENERATED_FILES_STAMP): $(RNG_FILES) $(RNG2C_SOURCE)
+ $(AM_V_GEN)topdir=$(top_srcdir) builddir=$(top_builddir) \
+ entries=$(RNG2C_ENTRIES) \
+ $(PYTHON) -B $(top_srcdir)/rng2c/generator.py generate -k scpf \
+ && touch $@
+
+MAINTAINERCLEANFILES += $(RNG2C_GENERATED_FILES_STAMP)
+CLEANFILES += $(RNG2C_GENERATED_FILES_STAMP)
+
COMMON_UNIT_VARS = \
-e 's|[@]runstatedir[@]|$(runstatedir)|g' \
-e 's|[@]sbindir[@]|$(sbindir)|g' \
diff --git a/src/access/Makefile.inc.am b/src/access/Makefile.inc.am
index 11f87c6..7832558 100644
--- a/src/access/Makefile.inc.am
+++ b/src/access/Makefile.inc.am
@@ -55,7 +55,7 @@ nodist_libvirt_driver_access_la_SOURCES = \
noinst_LTLIBRARIES += libvirt_driver_access.la
libvirt_la_BUILT_LIBADD += libvirt_driver_access.la
libvirt_driver_access_la_CFLAGS = \
- -I$(srcdir)/conf \
+ -I$(srcdir)/conf -I./conf \
$(AM_CFLAGS) \
$(NULL)
libvirt_driver_access_la_LDFLAGS = $(AM_LDFLAGS)
diff --git a/src/conf/Makefile.inc.am b/src/conf/Makefile.inc.am
index debc6f4..1fbde38 100644
--- a/src/conf/Makefile.inc.am
+++ b/src/conf/Makefile.inc.am
@@ -160,7 +160,11 @@ DEVICE_CONF_SOURCES = \
conf/device_conf.h \
$(NULL)
+CONF_GENERATED_SOURCES = \
+ $(NULL)
+
CONF_SOURCES = \
+ $(CONF_GENERATED_SOURCES) \
$(NETDEV_CONF_SOURCES) \
$(DOMAIN_CONF_SOURCES) \
$(OBJECT_EVENT_SOURCES) \
@@ -180,11 +184,15 @@ CONF_SOURCES = \
$(DEVICE_CONF_SOURCES) \
$(NULL)
+$(CONF_GENERATED_SOURCES): $(RNG2C_GENERATED_FILES_STAMP)
+MAINTAINERCLEANFILES += $(CONF_GENERATED_SOURCES)
+CLEANFILES += $(CONF_GENERATED_SOURCES)
+
noinst_LTLIBRARIES += libvirt_conf.la
libvirt_la_BUILT_LIBADD += libvirt_conf.la
libvirt_conf_la_SOURCES = $(CONF_SOURCES)
libvirt_conf_la_CFLAGS = \
- -I$(srcdir)/conf \
+ -I$(srcdir)/conf -I./conf \
$(AM_CFLAGS) \
$(NULL)
libvirt_conf_la_LDFLAGS = $(AM_LDFLAGS)
diff --git a/src/esx/Makefile.inc.am b/src/esx/Makefile.inc.am
index d53cef1..1df9a54 100644
--- a/src/esx/Makefile.inc.am
+++ b/src/esx/Makefile.inc.am
@@ -78,7 +78,7 @@ noinst_LTLIBRARIES += libvirt_driver_esx.la
libvirt_la_BUILT_LIBADD += libvirt_driver_esx.la
libvirt_driver_esx_la_CFLAGS = \
$(CURL_CFLAGS) \
- -I$(srcdir)/conf \
+ -I$(srcdir)/conf -I./conf \
-I$(builddir)/esx \
-I$(srcdir)/vmx \
$(AM_CFLAGS) \
diff --git a/src/interface/Makefile.inc.am b/src/interface/Makefile.inc.am
index 39157c0..e12c73a 100644
--- a/src/interface/Makefile.inc.am
+++ b/src/interface/Makefile.inc.am
@@ -23,7 +23,7 @@ mod_LTLIBRARIES += libvirt_driver_interface.la
libvirt_driver_interface_la_CFLAGS = \
-I$(srcdir)/access \
-I$(builddir)/access \
- -I$(srcdir)/conf \
+ -I$(srcdir)/conf -I./conf \
$(AM_CFLAGS) \
$(LIBNL_CFLAGS) \
$(NULL)
diff --git a/src/lxc/Makefile.inc.am b/src/lxc/Makefile.inc.am
index 2fee607..2e4c107 100644
--- a/src/lxc/Makefile.inc.am
+++ b/src/lxc/Makefile.inc.am
@@ -95,6 +95,7 @@ libvirt_driver_lxc_impl_la_CFLAGS = \
-I$(srcdir)/access \
-I$(builddir)/access \
-I$(srcdir)/conf \
+ -I./conf \
-I$(builddir)/lxc \
-I$(builddir)/rpc \
-I$(srcdir)/hypervisor \
diff --git a/src/network/Makefile.inc.am b/src/network/Makefile.inc.am
index bc05b01..5184908 100644
--- a/src/network/Makefile.inc.am
+++ b/src/network/Makefile.inc.am
@@ -46,7 +46,7 @@ libvirt_driver_network_impl_la_CFLAGS = \
$(DBUS_CFLAGS) \
-I$(srcdir)/access \
-I$(builddir)/access \
- -I$(srcdir)/conf \
+ -I$(srcdir)/conf -I./conf \
$(AM_CFLAGS) \
$(NULL)
libvirt_driver_network_impl_la_SOURCES = $(NETWORK_DRIVER_SOURCES)
diff --git a/src/node_device/Makefile.inc.am b/src/node_device/Makefile.inc.am
index 0b28718..9e9d16d 100644
--- a/src/node_device/Makefile.inc.am
+++ b/src/node_device/Makefile.inc.am
@@ -40,7 +40,7 @@ libvirt_driver_nodedev_la_SOURCES = $(NODE_DEVICE_DRIVER_SOURCES)
libvirt_driver_nodedev_la_CFLAGS = \
-I$(srcdir)/access \
-I$(builddir)/access \
- -I$(srcdir)/conf \
+ -I$(srcdir)/conf -I./conf \
$(AM_CFLAGS) \
$(LIBNL_CFLAGS) \
$(NULL)
diff --git a/src/nwfilter/Makefile.inc.am b/src/nwfilter/Makefile.inc.am
index 9a68fd8..772bf17 100644
--- a/src/nwfilter/Makefile.inc.am
+++ b/src/nwfilter/Makefile.inc.am
@@ -40,7 +40,7 @@ libvirt_driver_nwfilter_impl_la_CFLAGS = \
$(DBUS_CFLAGS) \
-I$(srcdir)/access \
-I$(builddir)/access \
- -I$(srcdir)/conf \
+ -I$(srcdir)/conf -I./conf \
$(AM_CFLAGS) \
$(NULL)
libvirt_driver_nwfilter_impl_la_LDFLAGS = $(AM_LDFLAGS)
diff --git a/src/qemu/Makefile.inc.am b/src/qemu/Makefile.inc.am
index 51cd798..a54a498 100644
--- a/src/qemu/Makefile.inc.am
+++ b/src/qemu/Makefile.inc.am
@@ -99,6 +99,7 @@ libvirt_driver_qemu_impl_la_CFLAGS = \
-I$(srcdir)/access \
-I$(builddir)/access \
-I$(srcdir)/conf \
+ -I./conf \
-I$(srcdir)/secret \
-I$(srcdir)/hypervisor \
$(AM_CFLAGS) \
diff --git a/src/remote/Makefile.inc.am b/src/remote/Makefile.inc.am
index 958bd18..e6eec31 100644
--- a/src/remote/Makefile.inc.am
+++ b/src/remote/Makefile.inc.am
@@ -47,7 +47,7 @@ REMOTE_DAEMON_CFLAGS = \
$(COVERAGE_CFLAGS) \
-I$(srcdir)/access \
-I$(builddir)/access \
- -I$(srcdir)/conf \
+ -I$(srcdir)/conf -I./conf \
-I$(srcdir)/rpc \
-I$(builddir)/rpc \
-I$(builddir)/remote \
diff --git a/src/secret/Makefile.inc.am b/src/secret/Makefile.inc.am
index 63c8bc6..e5b608a 100644
--- a/src/secret/Makefile.inc.am
+++ b/src/secret/Makefile.inc.am
@@ -20,7 +20,7 @@ mod_LTLIBRARIES += libvirt_driver_secret.la
libvirt_driver_secret_la_CFLAGS = \
-I$(srcdir)/access \
-I$(builddir)/access \
- -I$(srcdir)/conf \
+ -I$(srcdir)/conf -I./conf \
$(AM_CFLAGS) \
$(NULL)
libvirt_driver_secret_la_LIBADD = \
diff --git a/src/storage/Makefile.inc.am b/src/storage/Makefile.inc.am
index 3655b8a..c792583 100644
--- a/src/storage/Makefile.inc.am
+++ b/src/storage/Makefile.inc.am
@@ -122,7 +122,7 @@ libvirt_driver_storage_impl_la_SOURCES =
libvirt_driver_storage_impl_la_CFLAGS = \
-I$(srcdir)/access \
-I$(builddir)/access \
- -I$(srcdir)/conf \
+ -I$(srcdir)/conf -I./conf \
-I$(srcdir)/secret \
$(AM_CFLAGS) \
$(NULL)
diff --git a/src/test/Makefile.inc.am b/src/test/Makefile.inc.am
index b84ab52..ce1e635 100644
--- a/src/test/Makefile.inc.am
+++ b/src/test/Makefile.inc.am
@@ -21,7 +21,7 @@ driver_test_assetdir = $(pkgdatadir)
noinst_LTLIBRARIES += libvirt_driver_test.la
libvirt_la_BUILT_LIBADD += libvirt_driver_test.la
libvirt_driver_test_la_CFLAGS = \
- -I$(srcdir)/conf \
+ -I$(srcdir)/conf -I./conf \
$(AM_CFLAGS) \
$(NULL)
libvirt_driver_test_la_SOURCES = $(TEST_DRIVER_SOURCES)
diff --git a/src/util/Makefile.inc.am b/src/util/Makefile.inc.am
index 718b11a..ada1bb2 100644
--- a/src/util/Makefile.inc.am
+++ b/src/util/Makefile.inc.am
@@ -237,6 +237,10 @@ UTIL_SOURCES = \
$(NULL)
+UTIL_GENERATED_SOURCES = \
+ $(NULL)
+
+
EXTRA_DIST += \
$(srcdir)/keycodemapdb/data/keymaps.csv \
$(srcdir)/keycodemapdb/tools/keymap-gen \
@@ -251,8 +255,11 @@ KEYTABLES = \
$(KEYNAMES:%=util/virkeynametable_%.h) \
$(NULL)
-BUILT_SOURCES += $(KEYTABLES)
+UTIL_SOURCES += $(KEYTABLES) $(UTIL_GENERATED_SOURCES)
+BUILT_SOURCES += $(KEYTABLES) $(UTIL_GENERATED_SOURCES)
CLEANFILES += $(KEYTABLES)
+CLEANFILES += $(KEYMANS) $(KEYPODS) $(UTIL_GENERATED_SOURCES)
+MAINTAINERCLEANFILES += $(KEYTABLES) $(UTIL_GENERATED_SOURCES)
UTIL_IO_HELPER_SOURCES = util/iohelper.c
@@ -298,6 +305,8 @@ libvirt_util_la_LIBADD = \
$(NULL)
+$(UTIL_GENERATED_SOURCES): $(RNG2C_GENERATED_FILES_STAMP)
+
util/virkeycodetable_%.h: $(srcdir)/keycodemapdb/data/keymaps.csv \
$(srcdir)/keycodemapdb/tools/keymap-gen Makefile.am
$(AM_V_GEN)export NAME=`echo $@ | sed -e 's,util/virkeycodetable_,,' \
diff --git a/src/vbox/Makefile.inc.am b/src/vbox/Makefile.inc.am
index 72a15c6..00ad02a 100644
--- a/src/vbox/Makefile.inc.am
+++ b/src/vbox/Makefile.inc.am
@@ -52,7 +52,7 @@ mod_LTLIBRARIES += libvirt_driver_vbox.la
libvirt_driver_vbox_la_LDFLAGS = $(AM_LDFLAGS_MOD_NOUNDEF)
libvirt_driver_vbox_impl_la_CFLAGS = \
- -I$(srcdir)/conf \
+ -I$(srcdir)/conf -I./conf \
$(AM_CFLAGS) \
-DVBOX_DRIVER \
$(NULL)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index ada5b8f..46d2523 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -21,7 +21,9 @@ AM_CPPFLAGS = \
-I$(top_builddir)/include -I$(top_srcdir)/include \
-I$(top_builddir)/src -I$(top_srcdir)/src \
-I$(top_srcdir)/src/util \
+ -I$(top_builddir)/src/util \
-I$(top_srcdir)/src/conf \
+ -I$(top_builddir)/src/conf \
-I$(top_srcdir)/src/hypervisor \
-I$(top_builddir)/src/rpc \
$(NULL)
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 53df930..05a219e 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -19,6 +19,8 @@ AM_CPPFLAGS = \
-I$(top_builddir)/include -I$(top_srcdir)/include \
-I$(top_builddir)/src -I$(top_srcdir)/src \
-I$(top_srcdir)/src/util \
+ -I$(top_builddir)/src/util \
+ -I$(top_builddir)/src/conf \
-I$(top_srcdir) \
$(NULL)
--
2.17.1