[CRIU] [PATCH 15/24] Makefile.compel: simplify compel-deps

Kir Kolyshkin kir at openvz.org
Sat Dec 17 03:22:08 PST 2016


Working on CRIU Makefilest feels like walking on a minefield.
This is not an attempt to demine it, but to make some mines
a bit easier to notice.

OK, this is what we're trying to do here:

1. Drop the $(SRC_DIR)/ prefix from the target: as this is a top-level
   Makefile, we can just use paths relative to top-level source  dir.

2. Drop the $(SRC_DIR) from the symlink, use relative one. Relative
   symlinks are always better -- say, if a source directory is
   moved, everything will still work.

3. The "compel/include/asm: compel/arch/$(ARCH)/src/lib/include"
   dependency is useless. Yes, the left side is created as a symlink
   to the right side, but that doesn't mean that "make" should
   compare the timestamps of both to decide whether to remake
   the target.

4. The "$(COMPEL_VERSION_HEADER): compel/include/asm" dependency
   is wrong, the compel/include/asm symlink is not needed for
   $(COMPEL_VERSION_HEADER) generation. Remove it.

5. Move compel/plugins/std.built-in.o prerequisite from the rule
   to compel-plugins variable, and use it.

Signed-off-by: Kir Kolyshkin <kir at openvz.org>
---
 Makefile.compel | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/Makefile.compel b/Makefile.compel
index 301b5a8..46a3b52 100644
--- a/Makefile.compel
+++ b/Makefile.compel
@@ -14,15 +14,15 @@ $(COMPEL_VERSION_HEADER): $(SRC_DIR)/Makefile.versions
 	$(Q) echo "#define COMPEL_SO_VERSION_SUBLEVEL " $(COMPEL_SO_VERSION_SUBLEVEL)	>> $(COMPEL_VERSION_HEADER)
 	$(Q) echo "#endif /* COMPEL_SO_VERSION_H__ */"					>> $(COMPEL_VERSION_HEADER)
 
-$(SRC_DIR)/compel/include/asm: $(SRC_DIR)/compel/arch/$(ARCH)/src/lib/include
+compel/include/asm:
 	$(call msg-gen, $@)
-	$(Q) ln -s $^ $@
-$(COMPEL_VERSION_HEADER): $(SRC_DIR)/compel/include/asm
+	$(Q) ln -s ../arch/$(ARCH)/src/lib/include $@
 
-compel-deps		+= $(SRC_DIR)/compel/include/asm
+compel-deps		+= compel/include/asm
 compel-deps		+= $(COMPEL_VERSION_HEADER)
 compel-deps		+= $(CONFIG_HEADER)
 compel-deps		+= include/common/asm
+compel-plugins		+= compel/plugins/std.built-in.o
 
 LIBCOMPEL_SO		:= libcompel.so
 LIBCOMPEL_A		:= libcompel.a
@@ -30,7 +30,7 @@ export LIBCOMPEL_SO LIBCOMPEL_A
 
 #
 # Compel itself.
-compel/%: $(compel-deps) compel/plugins/std.built-in.o .FORCE
+compel/%: $(compel-deps) $(compel-plugins) .FORCE
 	$(Q) $(MAKE) $(build)=compel $@
 
 #
@@ -61,4 +61,4 @@ compel/$(LIBCOMPEL_SO): compel/$(LIBCOMPEL_A)
 
 compel-install-targets	+= compel/$(LIBCOMPEL_SO)
 compel-install-targets	+= compel/compel
-compel-install-targets	+= compel/plugins/std.built-in.o
+compel-install-targets	+= $(compel-plugins)
-- 
2.7.4



More information about the CRIU mailing list