Commit 9359084d authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

make: protobuf -- Fix deps generation on generated sources

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: 's avatarAndrey Vagin <avagin@parallels.com>
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 72dd148a
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment