[RFC 03/21] maint: Call generator automatically when c-head-files change

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Let makefile call the generator-tool whenever the c header files
change. Only check those header files under src/conf and src/util.

Signed-off-by: Shi Lei <shi_lei@xxxxxxxxxxxxxx>
---
 src/Makefile.am                 | 15 +++++++++++++++
 src/access/Makefile.inc.am      |  2 +-
 src/conf/Makefile.inc.am        | 11 ++++++++++-
 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        | 12 +++++++++---
 src/vbox/Makefile.inc.am        |  2 +-
 tests/Makefile.am               |  2 ++
 tools/Makefile.am               |  2 ++
 18 files changed, 51 insertions(+), 15 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index 12dd6b8..224d786 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -24,6 +24,7 @@ AM_CPPFLAGS =	-I$(top_srcdir) \
 		-I$(top_srcdir)/include \
 		-I$(srcdir)/util \
 		-I./util \
+		-I./conf \
 		-DIN_LIBVIRT \
 		-Dabs_top_builddir="\"$(abs_top_builddir)\"" \
 		-Dabs_top_srcdir="\"$(abs_top_srcdir)\"" \
@@ -87,6 +88,20 @@ sbin_PROGRAMS =
 bin_PROGRAMS =
 DRIVER_SOURCES =
 
+GENERATED_FILES_STAMP = .generated_files.stamp
+UTIL_HEADS = $(wildcard $(top_srcdir)/src/util/*.h)
+CONF_HEADS = $(wildcard $(top_srcdir)/src/conf/*.h)
+GENERATOR_SRC = $(wildcard $(top_srcdir)/build-aux/generator/*.py)
+
+$(GENERATED_FILES_STAMP): $(UTIL_HEADS) $(CONF_HEADS) $(GENERATOR_SRC)
+	$(AM_V_GEN)topdir=$(top_srcdir) builddir=$(top_builddir) \
+		libclang_path=$(LIBCLANG_PATH) \
+		$(PYTHON) -B $(top_srcdir)/build-aux/generator/main.py \
+		generate -k cpf && touch $@
+
+MAINTAINERCLEANFILES += $(GENERATED_FILES_STAMP)
+CLEANFILES += $(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..3bd2199 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,16 @@ CONF_SOURCES = \
 	$(DEVICE_CONF_SOURCES) \
 	$(NULL)
 
+BUILT_SOURCES += $(CONF_GENERATED_SOURCES)
+$(CONF_GENERATED_SOURCES): $(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 46a43e6..03ccef1 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 b8c2e1e..fdbefb5 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 196a30e..d260f75 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 7885636..ee3c3bc 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 20db809..774b681 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 6a7fc08..680ec88 100644
--- a/src/qemu/Makefile.inc.am
+++ b/src/qemu/Makefile.inc.am
@@ -101,6 +101,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 1b1be83..4e42608 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 a8390f8..198b666 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 2f46d24..556d07b 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 5bc60cb..4056f1d 100644
--- a/src/util/Makefile.inc.am
+++ b/src/util/Makefile.inc.am
@@ -1,5 +1,8 @@
 # vim: filetype=automake
 
+UTIL_GENERATED_SOURCES = \
+	$(NULL)
+
 # These files are not related to driver APIs. Simply generic
 # helper APIs for various purposes
 UTIL_SOURCES = \
@@ -236,9 +239,9 @@ UTIL_SOURCES = \
 	util/virmdev.h \
 	util/virfilecache.c \
 	util/virfilecache.h \
+	$(UTIL_GENERATED_SOURCES) \
 	$(NULL)
 
-
 EXTRA_DIST += \
 	$(srcdir)/keycodemapdb/data/keymaps.csv \
 	$(srcdir)/keycodemapdb/tools/keymap-gen \
@@ -253,8 +256,9 @@ KEYTABLES = \
 	$(KEYNAMES:%=util/virkeynametable_%.h) \
 	$(NULL)
 
-BUILT_SOURCES += $(KEYTABLES)
-CLEANFILES += $(KEYTABLES)
+BUILT_SOURCES += $(KEYTABLES) $(UTIL_GENERATED_SOURCES)
+CLEANFILES += $(KEYTABLES) $(UTIL_GENERATED_SOURCES)
+MAINTAINERCLEANFILES += $(KEYTABLES) $(UTIL_GENERATED_SOURCES)
 
 UTIL_IO_HELPER_SOURCES = util/iohelper.c
 
@@ -300,6 +304,8 @@ libvirt_util_la_LIBADD = \
 	$(NULL)
 
 
+$(UTIL_GENERATED_SOURCES): $(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 c5c6d53..7348475 100644
--- a/src/vbox/Makefile.inc.am
+++ b/src/vbox/Makefile.inc.am
@@ -48,7 +48,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 f5766a7..486de26 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





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux