[CRIU] [PATCH] make: protobuf -- Fix deps generation on generated sources

Cyrill Gorcunov gorcunov at openvz.org
Mon Apr 14 12:04:56 PDT 2014


There are a few nits in protobuf generation (which in most
cases are harmless but somethime may cause building procedure
to fail)

 - Deps files over generated sources should be produced only
   when _all_ .proto files are handled, because we include headers
   which are autogenerated as well, thus simply wait until everything
   is complete then use compiler to generate deps files

 - typo in non-clean targes, i rather should use proto-obj-y objects

Reported-by: Andrey Vagin <avagin at parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 protobuf/Makefile | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/protobuf/Makefile b/protobuf/Makefile
index 2e40adeac763..db42368f005d 100644
--- a/protobuf/Makefile
+++ b/protobuf/Makefile
@@ -92,15 +92,19 @@ ifeq ($(SRCARCH),arm)
 	$(Q) sed -i -e 's/4294967295/0xFFFFFFFF/g' $(patsubst %.h,%.c,$@)
 endif
 
-$(obj)/%.o: $(obj)/%.pb-c.c $(obj)/%.pb-c.h
+_first_stage := $(addprefix $(obj)/,$(proto-obj-y:.o=.pb-c.c))
+_first_stage += $(addprefix $(obj)/,$(proto-obj-y:.o=.pb-c.h))
+$(obj)/%.pb-c.d: $(_first_stage)
+
+$(obj)/%.o: $(obj)/%.pb-c.c $(obj)/%.pb-c.h $(obj)/%.pb-c.d
 	$(E) "  CC      " $@
 	$(Q) $(CC) -c $(CFLAGS) $< -o $@
 
-$(obj)/%.d: $(obj)/%.pb-c.c $(obj)/%.pb-c.h
+$(obj)/%.pb-c.d: $(obj)/%.pb-c.c $(obj)/%.pb-c.h
 	$(E) "  DEP     " $@
 	$(Q) $(CC) -M -MT $@ -MT $(patsubst %.d,%.o,$@) $(CFLAGS) $< -o $@
 
-$(obj)/%.i: $(obj)/%.pb-c.c $(obj)/%.pb-c.h
+$(obj)/%.pb-c.i: $(obj)/%.pb-c.c $(obj)/%.pb-c.h
 	$(E) "  CC      " $@
 	$(Q) $(CC) -E $(CFLAGS) $< -o $@
 
@@ -111,8 +115,8 @@ $(obj)/built-in.o: $(addprefix $(obj)/,$(proto-obj-y))
 _all += $(obj)/built-in.o
 
 ifneq ($(MAKECMDGOALS),clean)
--include $(addprefix $(obj)/,$(obj-y:.o=.proto.d))
--include $(addprefix $(obj)/,$(obj-y:.o=.proto.c.d))
+-include $(addprefix $(obj)/,$(proto-obj-y:.o=.proto.d))
+-include $(addprefix $(obj)/,$(proto-obj-y:.o=.proto.c.d))
 endif
 
 cleanup-y += $(obj)/*.c.d $(obj)/*.pb-c.c $(obj)/*.pb-c.h
-- 
1.8.3.1



More information about the CRIU mailing list