[CRIU] [PATCH 2/9] protobuf: generate python modules

Ruslan Kuprieiev kupruser at gmail.com
Wed Oct 8 03:35:25 PDT 2014


Lets generate them right after generating c files, because
they have the same *.proto dependencies and adding separate
target whould only mess up everything.

Signed-off-by: Ruslan Kuprieiev <kupruser at gmail.com>
---
 protobuf/.gitignore | 4 ++++
 protobuf/Makefile   | 3 +++
 2 files changed, 7 insertions(+)
 create mode 100644 protobuf/.gitignore

diff --git a/protobuf/.gitignore b/protobuf/.gitignore
new file mode 100644
index 0000000..5232c2a
--- /dev/null
+++ b/protobuf/.gitignore
@@ -0,0 +1,4 @@
+*pb-c.c
+*pb-c.h
+*pb2.py
+*.pyc
diff --git a/protobuf/Makefile b/protobuf/Makefile
index 7f6485b..a8a7666 100644
--- a/protobuf/Makefile
+++ b/protobuf/Makefile
@@ -88,6 +88,8 @@ $(obj)/%.proto.c.d: $(obj)/%.proto | $(obj)/%.proto.d
 $(obj)/%.pb-c.c $(obj)/%.pb-c.h: $(obj)/%.proto $(obj)/%.proto.c.d
 	$(E) "  PBCC    " $@
 	$(Q) protoc-c --proto_path=$(obj)/ --c_out=$(obj)/ $<
+	$(E) "  PBCC    " $(@:.pb-c.c=_pb2.py)
+	$(Q) protoc -I=$(obj)/ --python_out=$(obj)/ $<
 ifeq ($(SRCARCH),arm)
 	$(Q) sed -i -e 's/4294967295/0xFFFFFFFF/g' $@
 	$(Q) sed -i -e 's/4294967295/0xFFFFFFFF/g' $(patsubst %.c,%.h,$@)
@@ -123,3 +125,4 @@ endif
 
 cleanup-y += $(obj)/*.c.d $(obj)/*.pb-c.c $(obj)/*.pb-c.h
 cleanup-y += $(obj)/*.d $(obj)/*.i $(obj)/*.s $(obj)/*.o
+cleanup-y += $(obj)/*_pb2.py $(obj)/*.pyc
-- 
1.9.3



More information about the CRIU mailing list