[CRIU] [PATCH 5/9] Makefiles: nuke $(SRC_DIR)

Kir Kolyshkin kir at openvz.org
Wed Feb 22 15:15:45 PST 2017


As all builds are done from top source dir, there is no need
to have SRC_DIR.

Tag: взять-и-уебать
Reviewed-by: Dmitry Safonov <dsafonov at virtuozzo.com>
Signed-off-by: Kir Kolyshkin <kir at openvz.org>
---
 Makefile                   | 12 ++++--------
 Makefile.compel            |  4 ++--
 Makefile.config            |  6 +++---
 compel/Makefile            |  2 +-
 compel/plugins/Makefile    |  2 +-
 criu/Makefile              | 22 +++++++++++-----------
 criu/Makefile.crtools      |  2 +-
 criu/arch/aarch64/Makefile |  6 +++---
 criu/arch/arm/Makefile     |  5 ++---
 criu/arch/ppc64/Makefile   |  4 ++--
 criu/arch/x86/Makefile     |  4 ++--
 criu/pie/Makefile          |  7 +++----
 criu/pie/Makefile.library  |  5 ++---
 lib/Makefile               |  1 +
 lib/c/Makefile             |  8 ++++----
 lib/py/Makefile            |  2 +-
 lib/py/images/Makefile     |  6 +++---
 17 files changed, 46 insertions(+), 52 deletions(-)

diff --git a/Makefile b/Makefile
index b1a455a..75569f8 100644
--- a/Makefile
+++ b/Makefile
@@ -13,11 +13,6 @@ HOSTCFLAGS	?= $(CFLAGS)
 export HOSTCFLAGS
 
 #
-# Where we live.
-SRC_DIR	:= $(CURDIR)
-export SRC_DIR
-
-#
 # Architecture specific options.
 ifneq ($(filter-out x86 arm arm64 ppc64,$(ARCH)),)
         $(error "The architecture $(ARCH) isn't supported")
@@ -144,7 +139,7 @@ all: criu lib
 # Version headers.
 include Makefile.versions
 
-VERSION_HEADER		:= $(SRC_DIR)/criu/include/version.h
+VERSION_HEADER		:= criu/include/version.h
 GITID_FILE		:= .gitid
 GITID		:= $(shell if [ -d ".git" ]; then git describe --always; fi)
 
@@ -193,7 +188,7 @@ criu-deps	+= include/common/asm
 # Configure variables.
 export CONFIG_HEADER := criu/include/config.h
 ifeq ($(filter clean mrproper,$(MAKECMDGOALS)),)
-include $(SRC_DIR)/Makefile.config
+include Makefile.config
 else
 # To clean all files, enable make/build options here
 export CONFIG_COMPAT := y
@@ -215,7 +210,7 @@ include Makefile.compel
 # Next the socket CR library
 #
 SOCCR_A := soccr/libsoccr.a
-SOCCR_CONFIG := $(SRC_DIR)/soccr/config.h
+SOCCR_CONFIG := soccr/config.h
 $(SOCCR_CONFIG): $(CONFIG_HEADER)
 	$(Q) test -f $@ || ln -s ../$(CONFIG_HEADER) $@
 soccr/%: $(SOCCR_CONFIG) .FORCE
@@ -271,6 +266,7 @@ mrproper: subclean
 	$(Q) $(MAKE) $(build)=soccr $@
 	$(Q) $(MAKE) $(build)=compel $@
 	$(Q) $(MAKE) $(build)=compel/plugins $@
+	$(Q) $(MAKE) $(build)=lib $@
 	$(Q) $(RM) $(CONFIG_HEADER)
 	$(Q) $(RM) $(SOCCR_CONFIG)
 	$(Q) $(RM) $(VERSION_HEADER)
diff --git a/Makefile.compel b/Makefile.compel
index 3e7a174..7586ef3 100644
--- a/Makefile.compel
+++ b/Makefile.compel
@@ -1,9 +1,9 @@
-COMPEL_BIN		:= $(SRC_DIR)/compel/compel-host
+COMPEL_BIN		:= compel/compel-host
 export COMPEL_BIN
 
 COMPEL_VERSION_HEADER	:= compel/include/version.h
 
-$(COMPEL_VERSION_HEADER): $(SRC_DIR)/Makefile.versions
+$(COMPEL_VERSION_HEADER): Makefile.versions
 	$(call msg-gen, $(COMPEL_VERSION_HEADER))
 	$(Q) echo "/* Autogenerated, do not edit */"	 			 	 > $(COMPEL_VERSION_HEADER)
 	$(Q) echo "#ifndef COMPEL_SO_VERSION_H__"					>> $(COMPEL_VERSION_HEADER)
diff --git a/Makefile.config b/Makefile.config
index 0a04115..5051610 100644
--- a/Makefile.config
+++ b/Makefile.config
@@ -1,6 +1,6 @@
 include $(__nmk_dir)utils.mk
 include $(__nmk_dir)msg.mk
-include $(SRC_DIR)/scripts/feature-tests.mak
+include scripts/feature-tests.mak
 
 ifeq ($(call try-cc,$(FEATURE_TEST_LIBBSD_DEV),-lbsd),true)
         LIBS_FEATURES	+= -lbsd
@@ -14,7 +14,7 @@ endif
 
 export LIBS += $(LIBS_FEATURES)
 
-CONFIG_FILE = $(SRC_DIR)/.config
+CONFIG_FILE = .config
 
 $(CONFIG_FILE):
 	touch $(CONFIG_FILE)
@@ -42,7 +42,7 @@ endif
 endef
 
 define config-header-rule
-$(CONFIG_HEADER): $(SRC_DIR)/scripts/feature-tests.mak $(CONFIG_FILE)
+$(CONFIG_HEADER): scripts/feature-tests.mak $(CONFIG_FILE)
 	$$(call msg-gen, $$@)
 	$(Q) @echo '#ifndef __CR_CONFIG_H__'				> $$@
 	$(Q) @echo '#define __CR_CONFIG_H__'				>> $$@
diff --git a/compel/Makefile b/compel/Makefile
index 159a3e1..983b1a4 100644
--- a/compel/Makefile
+++ b/compel/Makefile
@@ -1,4 +1,4 @@
-include $(SRC_DIR)/Makefile.versions
+include Makefile.versions
 
 COMPEL_SO_VERSION	:= $(COMPEL_SO_VERSION_MAJOR)$(if $(COMPEL_SO_VERSION_MINOR),.$(COMPEL_SO_VERSION_MINOR))$(if $(COMPEL_SO_VERSION_SUBLEVEL),.$(COMPEL_SO_VERSION_SUBLEVEL))
 COMPEL_SO_VERSION_CODE	:= $(shell expr $(COMPEL_SO_VERSION_MAJOR) \* 65536 \+ $(COMPEL_SO_VERSION_MINOR) \* 256 \+ $(COMPEL_SO_VERSION_SUBLEVEL))
diff --git a/compel/plugins/Makefile b/compel/plugins/Makefile
index ac23a11..5a9da91 100644
--- a/compel/plugins/Makefile
+++ b/compel/plugins/Makefile
@@ -14,7 +14,7 @@ ccflags-y		+= -I compel/include/uapi
 asflags-y		+= -I compel/include/uapi
 
 # General compel includes
-ccflags-y		+= -iquote $(SRC_DIR)/compel/include
+ccflags-y		+= -iquote compel/include
 ccflags-y		+= -fpie -fno-stack-protector
 
 # General compel/plugins includes
diff --git a/criu/Makefile b/criu/Makefile
index e5fdde9..c67b9b2 100644
--- a/criu/Makefile
+++ b/criu/Makefile
@@ -17,13 +17,13 @@ endif
 #
 # General flags.
 ccflags-y		+= -fno-strict-aliasing
-ccflags-y		+= -iquote $(SRC_DIR)/criu/include
-ccflags-y		+= -iquote $(SRC_DIR)/include
-ccflags-y		+= -iquote $(SRC_DIR)/images
-ccflags-y		+= -iquote $(SRC_DIR)/criu/pie
-ccflags-y		+= -iquote $(SRC_DIR)/$(ARCH_DIR)
-ccflags-y		+= -iquote $(SRC_DIR)/$(ARCH_DIR)/include
-ccflags-y		+= -iquote $(SRC_DIR)/
+ccflags-y		+= -iquote criu/include
+ccflags-y		+= -iquote include
+ccflags-y		+= -iquote images
+ccflags-y		+= -iquote criu/pie
+ccflags-y		+= -iquote $(ARCH_DIR)
+ccflags-y		+= -iquote $(ARCH_DIR)/include
+ccflags-y		+= -iquote .
 ccflags-y		+= -I/usr/include/libnl3
 ccflags-y		+= $(COMPEL_UAPI_INCLUDES)
 
@@ -39,7 +39,7 @@ include $(__nmk_dir)msg.mk
 
 #
 # Needed libraries checks
-include $(SRC_DIR)/criu/Makefile.packages
+include criu/Makefile.packages
 
 #
 # Architecture dependent part.
@@ -108,8 +108,8 @@ subproper:
 .PHONY: subproper
 mrproper: subproper
 
-UAPI_HEADERS := $(SRC_DIR)/criu/include/criu-plugin.h
-UAPI_HEADERS += $(SRC_DIR)/criu/include/criu-log.h
+UAPI_HEADERS := criu/include/criu-plugin.h
+UAPI_HEADERS += criu/include/criu-log.h
 
 install: $(obj)/criu
 	$(E) "  INSTALL " $(obj)/criu
@@ -118,7 +118,7 @@ install: $(obj)/criu
 	$(Q) mkdir -p $(DESTDIR)$(INCLUDEDIR)/criu/
 	$(Q) install -m 644 $(UAPI_HEADERS) $(DESTDIR)$(INCLUDEDIR)/criu/
 	$(Q) mkdir -p $(DESTDIR)$(LIBEXECDIR)/criu/scripts
-	$(Q) install -m 755 $(SRC_DIR)/scripts/systemd-autofs-restart.sh $(DESTDIR)$(LIBEXECDIR)/criu/scripts
+	$(Q) install -m 755 scripts/systemd-autofs-restart.sh $(DESTDIR)$(LIBEXECDIR)/criu/scripts
 .PHONY: install
 
 uninstall:
diff --git a/criu/Makefile.crtools b/criu/Makefile.crtools
index afc3daf..3cebd5c 100644
--- a/criu/Makefile.crtools
+++ b/criu/Makefile.crtools
@@ -89,7 +89,7 @@ obj-y			+= pie-util-vdso-elf32.o
 CFLAGS_pie-util-vdso-elf32.o      += -DCONFIG_VDSO_32
 endif
 
-PROTOBUF_GEN := $(SRC_DIR)/scripts/protobuf-gen.sh
+PROTOBUF_GEN := scripts/protobuf-gen.sh
 
 $(obj)/protobuf-desc.d: $(obj)/protobuf-desc-gen.h
 
diff --git a/criu/arch/aarch64/Makefile b/criu/arch/aarch64/Makefile
index 428e808..4203e3d 100644
--- a/criu/arch/aarch64/Makefile
+++ b/criu/arch/aarch64/Makefile
@@ -1,8 +1,8 @@
 builtin-name		:= crtools.built-in.o
 
-ccflags-y		+= -iquote $(obj) -iquote $(SRC_DIR)
-ccflags-y		+= -iquote $(obj)/include -iquote $(SRC_DIR)/criu/include
-ccflags-y		+= -iquote $(SRC_DIR)/include
+ccflags-y		+= -iquote $(obj)
+ccflags-y		+= -iquote $(obj)/include -iquote criu/include
+ccflags-y		+= -iquote include
 ccflags-y		+= $(COMPEL_UAPI_INCLUDES)
 asflags-y		+= -D__ASSEMBLY__
 
diff --git a/criu/arch/arm/Makefile b/criu/arch/arm/Makefile
index b64d1c9..07daec7 100644
--- a/criu/arch/arm/Makefile
+++ b/criu/arch/arm/Makefile
@@ -1,8 +1,7 @@
 builtin-name		:= crtools.built-in.o
 
-ccflags-y		+= -iquote $(obj) -iquote $(SRC_DIR) -iquote $(obj)/include
-ccflags-y		+= -iquote $(SRC_DIR)/criu/include -iquote $(SRC_DIR)/include
-
+ccflags-y		+= -iquote $(obj) -iquote $(obj)/include
+ccflags-y		+= -iquote criu/include -iquote include
 ccflags-y		+= $(COMPEL_UAPI_INCLUDES)
 
 asflags-y		+= -D__ASSEMBLY__
diff --git a/criu/arch/ppc64/Makefile b/criu/arch/ppc64/Makefile
index 4859bf0..177ea31 100644
--- a/criu/arch/ppc64/Makefile
+++ b/criu/arch/ppc64/Makefile
@@ -1,7 +1,7 @@
 builtin-name		:= crtools.built-in.o
 
-ccflags-y		+= -iquote $(obj) -iquote $(SRC_DIR) -iquote $(obj)/include
-ccflags-y		+= -iquote $(SRC_DIR)/criu/include -iquote $(SRC_DIR)/include
+ccflags-y		+= -iquote $(obj) -iquote $(obj)/include
+ccflags-y		+= -iquote criu/include -iquote include
 ccflags-y		+= $(COMPEL_UAPI_INCLUDES)
 
 obj-y			+= cpu.o
diff --git a/criu/arch/x86/Makefile b/criu/arch/x86/Makefile
index 6bd5ac9..0e1717c 100644
--- a/criu/arch/x86/Makefile
+++ b/criu/arch/x86/Makefile
@@ -1,7 +1,7 @@
 builtin-name		:= crtools.built-in.o
 
-ccflags-y		+= -iquote $(obj) -iquote $(SRC_DIR) -iquote $(obj)/include
-ccflags-y		+= -iquote $(SRC_DIR)/criu/include -iquote $(SRC_DIR)/include
+ccflags-y		+= -iquote $(obj) -iquote . -iquote $(obj)/include
+ccflags-y		+= -iquote criu/include -iquote include
 ccflags-y		+= $(COMPEL_UAPI_INCLUDES)
 
 asflags-y		+= -Wstrict-prototypes
diff --git a/criu/pie/Makefile b/criu/pie/Makefile
index bf5f0fa..b40ea07 100644
--- a/criu/pie/Makefile
+++ b/criu/pie/Makefile
@@ -19,10 +19,9 @@ endif
 #
 CFLAGS		:= $(filter-out -pg $(CFLAGS-GCOV),$(CFLAGS))
 CFLAGS		:= $(filter-out $(CFLAGS-ASAN),$(CFLAGS))
-CFLAGS		+= -iquote $(SRC_DIR)/criu/arch/$(ARCH)/include
-CFLAGS		+= -iquote $(SRC_DIR)/criu/include
-CFLAGS		+= -iquote $(SRC_DIR)/include
-CFLAGS		+= -iquote $(SRC_DIR)
+CFLAGS		+= -iquote criu/arch/$(ARCH)/include
+CFLAGS		+= -iquote criu/include
+CFLAGS		+= -iquote include
 
 ccflags-y	+= $(COMPEL_UAPI_INCLUDES)
 ccflags-y	+= -DCR_NOGLIBC
diff --git a/criu/pie/Makefile.library b/criu/pie/Makefile.library
index e84058c..7fe2596 100644
--- a/criu/pie/Makefile.library
+++ b/criu/pie/Makefile.library
@@ -34,9 +34,8 @@ endif
 # applications, which is not the target of the
 # project.
 #
-iquotes			:= -iquote $(SRC_DIR)/$(PIE_DIR)/piegen
-iquotes			+= -iquote $(SRC_DIR)/$(ARCH_DIR)/include
-iquotes			+= -iquote $(SRC_DIR) -iquote $(SRC_DIR)/criu/include -iquote $(SRC_DIR)/include
+iquotes			+= -iquote $(ARCH_DIR)/include
+iquotes			+= -iquote criu/include -iquote include
 CFLAGS			:= $(filter-out -pg $(CFLAGS-GCOV),$(CFLAGS)) $(iquotes)
 CFLAGS			:= $(filter-out $(CFLAGS-ASAN),$(CFLAGS))
 
diff --git a/lib/Makefile b/lib/Makefile
index 589e725..4bc865a 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -40,6 +40,7 @@ clean-lib:
 .PHONY: clean-lib
 clean: clean-lib
 cleanup-y	+= lib/c/$(CRIU_SO) lib/c/criu.pc
+mrproper: clean
 
 install: lib-c lib-py crit/crit lib/c/criu.pc.in
 	$(E) "  INSTALL " lib
diff --git a/lib/c/Makefile b/lib/c/Makefile
index 68cf2b9..79a8e69 100644
--- a/lib/c/Makefile
+++ b/lib/c/Makefile
@@ -1,8 +1,8 @@
 obj-y			+= criu.o
-obj-y			+= $(SRC_DIR)/images/rpc.pb-c.o
+obj-y			+= ./images/rpc.pb-c.o
 
-ccflags-y		+= -iquote $(SRC_DIR)/criu/$(ARCH_DIR)/include
-ccflags-y		+= -iquote $(SRC_DIR)/criu/include -iquote $(obj)/..
-ccflags-y		+= -iquote $(SRC_DIR)/images
+ccflags-y		+= -iquote criu/$(ARCH_DIR)/include
+ccflags-y		+= -iquote criu/include
+ccflags-y		+= -iquote images
 ccflags-y		+= -fPIC -fno-stack-protector
 ldflags-y		+= -z noexecstack
diff --git a/lib/py/Makefile b/lib/py/Makefile
index 9605292..413b3da 100644
--- a/lib/py/Makefile
+++ b/lib/py/Makefile
@@ -10,7 +10,7 @@ libpy-images:
 .PHONY: libpy-images
 
 rpc_pb2.py:
-	$(Q) protoc -I=$(SRC_DIR)/images/ --python_out=$(obj) $(SRC_DIR)/images/$(@:_pb2.py=.proto)
+	$(Q) protoc -I=images/ --python_out=$(obj) images/$(@:_pb2.py=.proto)
 
 cleanup-y	+= $(addprefix $(obj)/,rpc_pb2.py *.pyc)
 
diff --git a/lib/py/images/Makefile b/lib/py/images/Makefile
index a5990c4..a95f612 100644
--- a/lib/py/images/Makefile
+++ b/lib/py/images/Makefile
@@ -1,16 +1,16 @@
 all-y	+= images magic.py pb.py
 
-proto := $(filter-out $(SRC_DIR)/images/rpc.proto, $(sort $(wildcard $(SRC_DIR)/images/*.proto)))
+proto := $(filter-out images/rpc.proto, $(sort $(wildcard images/*.proto)))
 proto-py-modules := $(foreach m,$(proto),$(subst -,_,$(notdir $(m:.proto=_pb2))))
 
 # We don't need rpc_pb2.py here, as it is not related to the images.
 # Unfortunately, we can't drop ugly _pb2 suffixes here, because
 # some _pb2 files depend on others _pb2 files.
 images:
-	$(Q) protoc -I=$(SRC_DIR)/images -I=/usr/include/ --python_out=$(obj) $(proto)
+	$(Q) protoc -I=images/ -I=/usr/include/ --python_out=$(obj) $(proto)
 .PHONY: images
 
-magic.py: $(SRC_DIR)/scripts/magic-gen.py $(SRC_DIR)/criu/include/magic.h
+magic.py: scripts/magic-gen.py criu/include/magic.h
 	$(call msg-gen, $@)
 	$(Q) python $^ $(obj)/$@
 
-- 
2.9.3



More information about the CRIU mailing list