[CRIU] [PATCH 1/2] protobuf: regenerate images on Makefile changes

Dmitry Safonov dsafonov at virtuozzo.com
Tue Jan 31 05:56:30 PST 2017


Result:
  [japdoll at dsafonov criu]$ touch Makefile
  [japdoll at dsafonov criu]$ make
  make[1]: Entering directory '/home/japdoll/tools/criu'
    PBCC     images/macvlan.pb-c.c
    DEP      images/macvlan.pb-c.d
    PBCC     images/autofs.pb-c.c
    DEP      images/autofs.pb-c.d
    PBCC     images/sysctl.pb-c.c
    DEP      images/sysctl.pb-c.d
  <...>

Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
 images/Makefile | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/images/Makefile b/images/Makefile
index eb18526239f6..86a7a0151d6a 100644
--- a/images/Makefile
+++ b/images/Makefile
@@ -75,10 +75,12 @@ $(shell grep "^[[:blank:]]*import[[:blank:]]" $(1)      |       \
         sort | uniq)
 endef
 
+makefile-deps := Makefile $(obj)/Makefile
+
 #
 # Generates rules needed to compile protobuf files.
 define gen-proto-rules
-$(obj)/$(1).pb-c.c $(obj)/$(1).pb-c.h: $(obj)/$(1).proto $(addsuffix .pb-c.c,$(addprefix $(obj)/,$(2)))
+$(obj)/$(1).pb-c.c $(obj)/$(1).pb-c.h: $(obj)/$(1).proto $(addsuffix .pb-c.c,$(addprefix $(obj)/,$(2))) $(makefile-deps)
 	$$(E) "  PBCC    " $$@
 	$$(Q) protoc-c --proto_path=$(obj)/ --c_out=$(obj)/ $$<
 ifeq ($(PROTOUFIX),y)
@@ -86,7 +88,7 @@ ifeq ($(PROTOUFIX),y)
 	$$(Q) sed -i -e 's/4294967295/0xFFFFFFFF/g' $$(patsubst %.c,%.h,$$@)
 	$$(Q) sed -i -e 's/4294967295/0xFFFFFFFF/g' $$(patsubst %.h,%.c,$$@)
 endif
-$(obj)/$(1).pb-c.d: $(obj)/$(1).pb-c.c $(addsuffix .pb-c.d,$(addprefix $(obj)/,$(2)))
+$(obj)/$(1).pb-c.d: $(obj)/$(1).pb-c.c $(addsuffix .pb-c.d,$(addprefix $(obj)/,$(2))) $(makefile-deps)
 	$$(E) "  DEP     " $$@
 	$$(Q) $$(CC) -M -MT $$@ -MT $(patsubst %.d,%.o,$$@) $$(CFLAGS) $$< -o $$@
 endef
-- 
2.11.0



More information about the CRIU mailing list