[CRIU] [PATCH] make: pie -- Add generation of dep files

Cyrill Gorcunov gorcunov at openvz.org
Wed Feb 6 04:16:14 EST 2013


Otherwise pie may not be re-built if headers
are changed.

https://bugzilla.openvz.org/show_bug.cgi?id=2465

Reported-by: Andrey Vagin <avagin at openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 pie/Makefile | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/pie/Makefile b/pie/Makefile
index c77c847..ce81349 100644
--- a/pie/Makefile
+++ b/pie/Makefile
@@ -14,7 +14,9 @@ ASMFLAGS	:= -D__ASSEMBLY__
 
 .DEFAULT_GOAL	:= pie
 
-LIB-OBJS	= log-simple.o blob-util-net.o $(SYSCALL-LIB)
+LIB-OBJS	:= log-simple.o blob-util-net.o
+DEPS		:= $(RESTORER-ARCH-OBJS:.o=.d) $(LIB-OBJS:.o=.d)
+LIB-OBJS	+= $(SYSCALL-LIB)
 
 $(PARASITE): $(LIB-OBJS) $(PASM-OBJS) $(PIELDS)
 $(RESTORER): $(LIB-OBJS) $(RESTORER-ARCH-OBJS) $(PIELDS)
@@ -24,6 +26,11 @@ $(PIELDS): $(PIELDS).in
 	$(Q) $(SH) -c "echo 'OUTPUT_ARCH($(LDARCH))' > $(PIELDS)"
 	$(Q) $(SH) -c "cat $(PIELDS).in >> $(PIELDS)"
 
+blob-util-net.d: $(SRC_DIR)/util-net.c
+%.d: %.c
+	$(E) "  DEP     " $@
+	$(Q) $(CC) -M -MT $@ -MT $(patsubst %.d,%.o,$@) $(CFLAGS) $< -o $@
+
 blob-util-net.o: $(SRC_DIR)/util-net.c
 	$(E) "  CC      " $@
 	$(Q) $(CC) $(CFLAGS) $< -o $@
@@ -50,6 +57,10 @@ blob-util-net.o: $(SRC_DIR)/util-net.c
 
 pie: $(BLOBS)
 
+ifneq ($(MAKECMDGOALS),clean)
+-include $(DEPS)
+endif
+
 clean:
 	$(E) "  CLEAN PIE"
 	$(Q) $(RM) -f ./*-blob.h
-- 
1.8.1



More information about the CRIU mailing list