[CRIU] [PATCH 1/3] make: fix CONFIG_HEADER dependency for make criu/%.o

Dmitry Safonov dsafonov at virtuozzo.com
Tue Sep 20 09:20:56 PDT 2016


Removed `config' target, as it only has $(CONFIG_HEADER) dependency.
$(VERSION_HEADER) dependency is in top-make for CRIU's files:
>  criu/%: images/built-in.o compel/compel $(VERSION_HEADER) .FORCE
Introduced pattern-specific target for CRIU files, so it
got as dependency pie (and config header as pie's deps).
As we're building from NMK and including source Makefile from there,
it adds Makefile dependency - tell GNU/Make, that it's all right,
up-to-date by introducing Makefile target (otherwise, Makefile
would fit pattern-specific rule).
For any PIE's object I just rebuild/regenerate all pie, it may
be smarter - but we have now Makefile.library and Makefile
for PIE, so need to know, who should rebuild it.

Fixes:
[criu]$ make criu/log.o
make[1]: Entering directory '/home/japdoll/tools/criu'
make[1]: Leaving directory '/home/japdoll/tools/criu'
make[1]: Entering directory '/home/japdoll/tools/criu'
make[1]: 'images/built-in.o' is up to date.
make[1]: Leaving directory '/home/japdoll/tools/criu'
make[1]: Entering directory '/home/japdoll/tools/criu'
make[1]: 'compel/compel' is up to date.
make[1]: Leaving directory '/home/japdoll/tools/criu'
make[1]: Entering directory '/home/japdoll/tools/criu'
  DEP      criu/log.d
In file included from criu/log.c:22:0:
/home/japdoll/tools/criu/criu/include/string.h:11:20: fatal error: config.h: No such file or directory
 #include "config.h"
                    ^
compilation terminated.
  CC       criu/log.o
In file included from criu/log.c:22:0:
/home/japdoll/tools/criu/criu/include/string.h:11:20: fatal error: config.h: No such file or directory
 #include "config.h"
                    ^
compilation terminated.
make[1]: *** [/home/japdoll/tools/criu/scripts/nmk/scripts/build.mk:104: criu/log.o] Error 1
make[1]: Leaving directory '/home/japdoll/tools/criu'
make: *** [Makefile:200: criu/log.o] Error 2

Cc: Cyrill Gorcunov <gorcunov at openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
 criu/Makefile        | 12 ++++++++++--
 criu/Makefile.config |  5 +++--
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/criu/Makefile b/criu/Makefile
index ba973e7d26c4..7bcd55d9bac0 100644
--- a/criu/Makefile
+++ b/criu/Makefile
@@ -47,7 +47,6 @@ CONFIG_HEADER := $(obj)/include/config.h
 ifneq ($(filter-out clean mrproper,$(MAKECMDGOALS)),)
 include $(SRC_DIR)/criu/Makefile.config
 endif
-config: $(VERSION_HEADER)
 
 #
 # System calls library.
@@ -57,7 +56,7 @@ SYSCALL-LIB		:= $(ARCH_DIR)/syscalls-64.built-in.o
 else
 SYSCALL-LIB		:= $(ARCH_DIR)/syscalls.built-in.o
 endif
-syscalls_lib: config
+syscalls_lib: $(CONFIG_HEADER)
 	$(Q) $(MAKE) $(call build-as,Makefile.syscalls,$(ARCH_DIR)) all
 .PHONY: syscalls_lib
 
@@ -78,6 +77,9 @@ pie: criu/pie/native.lib.a
 	$(Q) $(MAKE) $(build)=criu/pie all
 .PHONY: pie
 
+criu/pie/%: pie
+	@true
+
 #
 # CRIU executable
 PROGRAM-BUILTINS	+= criu/pie/native.lib.a
@@ -88,6 +90,12 @@ PROGRAM-BUILTINS	+= $(ARCH-LIB)
 $(obj)/built-in.o: pie
 	$(Q) $(MAKE) $(call build-as,Makefile.crtools,criu) all
 
+$(obj)/Makefile:
+	@true
+
+$(obj)/%: pie
+	$(Q) $(MAKE) $(call build-as,Makefile.crtools,criu) $@
+
 $(obj)/criu: $(PROGRAM-BUILTINS)
 	$(call msg-link, $@)
 	$(Q) $(CC) $(CFLAGS) $^ $(LIBS) $(WRAPFLAGS) $(LDFLAGS) $(GMONLDOPT) -rdynamic -o $@
diff --git a/criu/Makefile.config b/criu/Makefile.config
index 73ba0059d1ba..7bcecb380e7a 100644
--- a/criu/Makefile.config
+++ b/criu/Makefile.config
@@ -34,6 +34,9 @@ ifeq ($$(call try-cc,$$(FEATURE_TEST_$(1)),$$(LIBS),$$(DEFINES)),true)
 endif
 endef
 
+$(obj)/include/config-base.h:
+	@true
+
 define config-header-rule
 $(CONFIG_HEADER): $(obj)/include/config-base.h
 	$$(call msg-gen, $$@)
@@ -57,5 +60,3 @@ endef
 $(eval $(config-header-rule))
 
 $(CONFIG_HEADER): $(SRC_DIR)/scripts/feature-tests.mak
-config: $(CONFIG_HEADER)
-.PHONY: config
-- 
2.9.0



More information about the CRIU mailing list