[CRIU] [PATCH 1/2] criu/Makefile: fix rebuilding criu/pie/pie.lib.a

Kir Kolyshkin kir at openvz.org
Sat Jan 7 15:52:49 PST 2017


As reported by Andrei Vagin:

 touch criu/pie/parasite-vdso.c

does not lead to rebuild pie.lib.a and its dependencies.

This happened because the real dependencies of criu/pie/pie.lib.a
are listed in criu/pie/Makefile.library, which is never included
or called with sub-make, because the criu/Makefile says:

 criu/pie/pie.lib.a: $(ARCH-LIB)
 	$(Q) $(MAKE) $(call build-as,Makefile.library,criu/pie) all

essentially saying we only need to call a sub-make with Makefile.library
if the target is absent, or $(ARCH-LIB) is newer than the target.

A workaround is to use .FORCE so that the Makefile.library is always
called and so the dependencies are checked.

Note the above is also true for any target that involves calling
a sub-make -- it should either be used with .FORCE or otherwise
depend on a phony target. I haven't checked all the CRIU makefiles
but suspect there might be more cases like this one.

Cc: Cyrill Gorcunov <gorcunov at openvz.org>
Reported-by: Andrei Vagin <avagin at virtuozzo.com>
Signed-off-by: Kir Kolyshkin <kir at openvz.org>
---
 criu/Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/criu/Makefile b/criu/Makefile
index 01b1d98..fa6675e 100644
--- a/criu/Makefile
+++ b/criu/Makefile
@@ -1,3 +1,5 @@
+.PHONY: .FORCE
+
 # here is a workaround for a bug in libnl-3:
 # 6a8d90f5fec4 "attr: Allow attribute type 0" 
 WRAPFLAGS		+= -Wl,--wrap=nla_parse,--wrap=nlmsg_parse
@@ -47,7 +49,7 @@ $(ARCH-LIB):
 
 #
 # PIE library code.
-criu/pie/pie.lib.a: $(ARCH-LIB)
+criu/pie/pie.lib.a: $(ARCH-LIB) .FORCE
 	$(Q) $(MAKE) $(call build-as,Makefile.library,criu/pie) all
 
 #
-- 
2.9.3



More information about the CRIU mailing list