summaryrefslogtreecommitdiffstats
path: root/spice
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2015-07-06 18:18:55 +0200
committerChristophe Fergeau <cfergeau@redhat.com>2015-08-07 11:54:47 +0200
commit2b9d15c1d3c8d17e0b9867a47887f2f676994015 (patch)
tree5c6d184dda6f20a6eade4a46102ec1f447b971c5 /spice
parenteb2e8ba0e8055a90f1425cacdb2c55660a087a6a (diff)
downloadspice-protocol-2b9d15c1d3c8d17e0b9867a47887f2f676994015.tar.gz
spice-protocol-2b9d15c1d3c8d17e0b9867a47887f2f676994015.tar.xz
spice-protocol-2b9d15c1d3c8d17e0b9867a47887f2f676994015.zip
build-sys: Add --enable-code-generator
This flag is only used for git builds, and can usually safely be disabled. When it's enabled, configure.ac will check that python-six and pyparsing are available, and will use these together with the codegen python scripts in order to automatically regenerate enums.h when the .proto files change.
Diffstat (limited to 'spice')
-rw-r--r--spice/Makefile.am24
1 files changed, 24 insertions, 0 deletions
diff --git a/spice/Makefile.am b/spice/Makefile.am
index a54ae89..9be09ec 100644
--- a/spice/Makefile.am
+++ b/spice/Makefile.am
@@ -21,4 +21,28 @@ spice_protocol_include_HEADERS = \
vdi_dev.h \
$(NULL)
+# Using the python code generator requires some python modules
+# which might not be installed on the user computer. Given that
+# enums.h is stored in git, and should be up-to-date anyway,
+# we can make this part optional
+if ENABLE_CODEGEN
+MARSHALLERS_DEPS = \
+ $(top_srcdir)/python_modules/__init__.py \
+ $(top_srcdir)/python_modules/codegen.py \
+ $(top_srcdir)/python_modules/demarshal.py \
+ $(top_srcdir)/python_modules/marshal.py \
+ $(top_srcdir)/python_modules/ptypes.py \
+ $(top_srcdir)/python_modules/spice_parser.py \
+ $(top_srcdir)/spice_codegen.py \
+ $(NULL)
+
+BUILT_SOURCES = enums.h
+
+# this is going to upset automake distcheck, since we try to write to
+# readonly srcdir. To limit the fail chances, rebuild automatically
+# enums.h only if the spice.proto has changed.
+enums.h: $(top_srcdir)/spice.proto # $(MARSHALLERS_DEPS)
+ $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-enums $< $@ >/dev/null
+endif
+
-include $(top_srcdir)/git.mk