Commit 85b04c8b authored by Kir Kolyshkin's avatar Kir Kolyshkin Committed by Andrei Vagin

Makefiles: nuke $(SRC_DIR)

As all builds are done from top source dir, there is no need
to have SRC_DIR.
Reviewed-by: 's avatarDmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 0f453c18
...@@ -12,11 +12,6 @@ export CFLAGS ...@@ -12,11 +12,6 @@ export CFLAGS
HOSTCFLAGS ?= $(CFLAGS) HOSTCFLAGS ?= $(CFLAGS)
export HOSTCFLAGS export HOSTCFLAGS
#
# Where we live.
SRC_DIR := $(CURDIR)
export SRC_DIR
# #
# Architecture specific options. # Architecture specific options.
ifneq ($(filter-out x86 arm arm64 ppc64,$(ARCH)),) ifneq ($(filter-out x86 arm arm64 ppc64,$(ARCH)),)
...@@ -144,7 +139,7 @@ all: criu lib ...@@ -144,7 +139,7 @@ all: criu lib
# Version headers. # Version headers.
include Makefile.versions include Makefile.versions
VERSION_HEADER := $(SRC_DIR)/criu/include/version.h VERSION_HEADER := criu/include/version.h
GITID_FILE := .gitid GITID_FILE := .gitid
GITID := $(shell if [ -d ".git" ]; then git describe --always; fi) GITID := $(shell if [ -d ".git" ]; then git describe --always; fi)
...@@ -193,7 +188,7 @@ criu-deps += include/common/asm ...@@ -193,7 +188,7 @@ criu-deps += include/common/asm
# Configure variables. # Configure variables.
export CONFIG_HEADER := criu/include/config.h export CONFIG_HEADER := criu/include/config.h
ifeq ($(filter clean mrproper,$(MAKECMDGOALS)),) ifeq ($(filter clean mrproper,$(MAKECMDGOALS)),)
include $(SRC_DIR)/Makefile.config include Makefile.config
else else
# To clean all files, enable make/build options here # To clean all files, enable make/build options here
export CONFIG_COMPAT := y export CONFIG_COMPAT := y
...@@ -215,7 +210,7 @@ include Makefile.compel ...@@ -215,7 +210,7 @@ include Makefile.compel
# Next the socket CR library # Next the socket CR library
# #
SOCCR_A := soccr/libsoccr.a SOCCR_A := soccr/libsoccr.a
SOCCR_CONFIG := $(SRC_DIR)/soccr/config.h SOCCR_CONFIG := soccr/config.h
$(SOCCR_CONFIG): $(CONFIG_HEADER) $(SOCCR_CONFIG): $(CONFIG_HEADER)
$(Q) test -f $@ || ln -s ../$(CONFIG_HEADER) $@ $(Q) test -f $@ || ln -s ../$(CONFIG_HEADER) $@
soccr/%: $(SOCCR_CONFIG) .FORCE soccr/%: $(SOCCR_CONFIG) .FORCE
...@@ -273,6 +268,7 @@ mrproper: subclean ...@@ -273,6 +268,7 @@ mrproper: subclean
$(Q) $(MAKE) $(build)=lib $@ $(Q) $(MAKE) $(build)=lib $@
$(Q) $(MAKE) $(build)=compel $@ $(Q) $(MAKE) $(build)=compel $@
$(Q) $(MAKE) $(build)=compel/plugins $@ $(Q) $(MAKE) $(build)=compel/plugins $@
$(Q) $(MAKE) $(build)=lib $@
$(Q) $(RM) $(CONFIG_HEADER) $(Q) $(RM) $(CONFIG_HEADER)
$(Q) $(RM) $(SOCCR_CONFIG) $(Q) $(RM) $(SOCCR_CONFIG)
$(Q) $(RM) $(VERSION_HEADER) $(Q) $(RM) $(VERSION_HEADER)
......
COMPEL_BIN := $(SRC_DIR)/compel/compel-host COMPEL_BIN := compel/compel-host
export COMPEL_BIN export COMPEL_BIN
COMPEL_VERSION_HEADER := compel/include/version.h 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)) $(call msg-gen, $(COMPEL_VERSION_HEADER))
$(Q) echo "/* Autogenerated, do not edit */" > $(COMPEL_VERSION_HEADER) $(Q) echo "/* Autogenerated, do not edit */" > $(COMPEL_VERSION_HEADER)
$(Q) echo "#ifndef COMPEL_SO_VERSION_H__" >> $(COMPEL_VERSION_HEADER) $(Q) echo "#ifndef COMPEL_SO_VERSION_H__" >> $(COMPEL_VERSION_HEADER)
......
include $(__nmk_dir)utils.mk include $(__nmk_dir)utils.mk
include $(__nmk_dir)msg.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) ifeq ($(call try-cc,$(FEATURE_TEST_LIBBSD_DEV),-lbsd),true)
LIBS_FEATURES += -lbsd LIBS_FEATURES += -lbsd
...@@ -14,7 +14,7 @@ endif ...@@ -14,7 +14,7 @@ endif
export LIBS += $(LIBS_FEATURES) export LIBS += $(LIBS_FEATURES)
CONFIG_FILE = $(SRC_DIR)/.config CONFIG_FILE = .config
$(CONFIG_FILE): $(CONFIG_FILE):
touch $(CONFIG_FILE) touch $(CONFIG_FILE)
...@@ -42,7 +42,7 @@ endif ...@@ -42,7 +42,7 @@ endif
endef endef
define config-header-rule 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, $$@) $$(call msg-gen, $$@)
$(Q) @echo '#ifndef __CR_CONFIG_H__' > $$@ $(Q) @echo '#ifndef __CR_CONFIG_H__' > $$@
$(Q) @echo '#define __CR_CONFIG_H__' >> $$@ $(Q) @echo '#define __CR_CONFIG_H__' >> $$@
......
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 := $(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)) COMPEL_SO_VERSION_CODE := $(shell expr $(COMPEL_SO_VERSION_MAJOR) \* 65536 \+ $(COMPEL_SO_VERSION_MINOR) \* 256 \+ $(COMPEL_SO_VERSION_SUBLEVEL))
......
...@@ -15,7 +15,7 @@ ccflags-y += -I compel/include/uapi ...@@ -15,7 +15,7 @@ ccflags-y += -I compel/include/uapi
asflags-y += -I compel/include/uapi asflags-y += -I compel/include/uapi
# General compel includes # General compel includes
ccflags-y += -iquote $(SRC_DIR)/compel/include ccflags-y += -iquote compel/include
ccflags-y += -fpie -fno-stack-protector ccflags-y += -fpie -fno-stack-protector
# General compel/plugins includes # General compel/plugins includes
......
...@@ -17,13 +17,13 @@ endif ...@@ -17,13 +17,13 @@ endif
# #
# General flags. # General flags.
ccflags-y += -fno-strict-aliasing ccflags-y += -fno-strict-aliasing
ccflags-y += -iquote $(SRC_DIR)/criu/include ccflags-y += -iquote criu/include
ccflags-y += -iquote $(SRC_DIR)/include ccflags-y += -iquote include
ccflags-y += -iquote $(SRC_DIR)/images ccflags-y += -iquote images
ccflags-y += -iquote $(SRC_DIR)/criu/pie ccflags-y += -iquote criu/pie
ccflags-y += -iquote $(SRC_DIR)/$(ARCH_DIR) ccflags-y += -iquote $(ARCH_DIR)
ccflags-y += -iquote $(SRC_DIR)/$(ARCH_DIR)/include ccflags-y += -iquote $(ARCH_DIR)/include
ccflags-y += -iquote $(SRC_DIR)/ ccflags-y += -iquote .
ccflags-y += -I/usr/include/libnl3 ccflags-y += -I/usr/include/libnl3
ccflags-y += $(COMPEL_UAPI_INCLUDES) ccflags-y += $(COMPEL_UAPI_INCLUDES)
...@@ -39,7 +39,7 @@ include $(__nmk_dir)msg.mk ...@@ -39,7 +39,7 @@ include $(__nmk_dir)msg.mk
# #
# Needed libraries checks # Needed libraries checks
include $(SRC_DIR)/criu/Makefile.packages include criu/Makefile.packages
# #
# Architecture dependent part. # Architecture dependent part.
...@@ -108,8 +108,8 @@ subproper: ...@@ -108,8 +108,8 @@ subproper:
.PHONY: subproper .PHONY: subproper
mrproper: subproper mrproper: subproper
UAPI_HEADERS := $(SRC_DIR)/criu/include/criu-plugin.h UAPI_HEADERS := criu/include/criu-plugin.h
UAPI_HEADERS += $(SRC_DIR)/criu/include/criu-log.h UAPI_HEADERS += criu/include/criu-log.h
install: $(obj)/criu install: $(obj)/criu
$(E) " INSTALL " $(obj)/criu $(E) " INSTALL " $(obj)/criu
...@@ -118,7 +118,7 @@ install: $(obj)/criu ...@@ -118,7 +118,7 @@ install: $(obj)/criu
$(Q) mkdir -p $(DESTDIR)$(INCLUDEDIR)/criu/ $(Q) mkdir -p $(DESTDIR)$(INCLUDEDIR)/criu/
$(Q) install -m 644 $(UAPI_HEADERS) $(DESTDIR)$(INCLUDEDIR)/criu/ $(Q) install -m 644 $(UAPI_HEADERS) $(DESTDIR)$(INCLUDEDIR)/criu/
$(Q) mkdir -p $(DESTDIR)$(LIBEXECDIR)/criu/scripts $(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 .PHONY: install
uninstall: uninstall:
......
...@@ -88,7 +88,7 @@ obj-y += pie-util-vdso-elf32.o ...@@ -88,7 +88,7 @@ obj-y += pie-util-vdso-elf32.o
CFLAGS_pie-util-vdso-elf32.o += -DCONFIG_VDSO_32 CFLAGS_pie-util-vdso-elf32.o += -DCONFIG_VDSO_32
endif endif
PROTOBUF_GEN := $(SRC_DIR)/scripts/protobuf-gen.sh PROTOBUF_GEN := scripts/protobuf-gen.sh
$(obj)/protobuf-desc.d: $(obj)/protobuf-desc-gen.h $(obj)/protobuf-desc.d: $(obj)/protobuf-desc-gen.h
......
builtin-name := crtools.built-in.o builtin-name := crtools.built-in.o
ccflags-y += -iquote $(obj) -iquote $(SRC_DIR) ccflags-y += -iquote $(obj)
ccflags-y += -iquote $(obj)/include -iquote $(SRC_DIR)/criu/include ccflags-y += -iquote $(obj)/include -iquote criu/include
ccflags-y += -iquote $(SRC_DIR)/include ccflags-y += -iquote include
ccflags-y += $(COMPEL_UAPI_INCLUDES) ccflags-y += $(COMPEL_UAPI_INCLUDES)
asflags-y += -D__ASSEMBLY__ asflags-y += -D__ASSEMBLY__
......
builtin-name := crtools.built-in.o builtin-name := crtools.built-in.o
ccflags-y += -iquote $(obj) -iquote $(SRC_DIR) -iquote $(obj)/include ccflags-y += -iquote $(obj) -iquote $(obj)/include
ccflags-y += -iquote $(SRC_DIR)/criu/include -iquote $(SRC_DIR)/include ccflags-y += -iquote criu/include -iquote include
ccflags-y += $(COMPEL_UAPI_INCLUDES) ccflags-y += $(COMPEL_UAPI_INCLUDES)
asflags-y += -D__ASSEMBLY__ asflags-y += -D__ASSEMBLY__
......
builtin-name := crtools.built-in.o builtin-name := crtools.built-in.o
ccflags-y += -iquote $(obj) -iquote $(SRC_DIR) -iquote $(obj)/include ccflags-y += -iquote $(obj) -iquote $(obj)/include
ccflags-y += -iquote $(SRC_DIR)/criu/include -iquote $(SRC_DIR)/include ccflags-y += -iquote criu/include -iquote include
ccflags-y += $(COMPEL_UAPI_INCLUDES) ccflags-y += $(COMPEL_UAPI_INCLUDES)
obj-y += cpu.o obj-y += cpu.o
......
builtin-name := crtools.built-in.o builtin-name := crtools.built-in.o
ccflags-y += -iquote $(obj) -iquote $(SRC_DIR) -iquote $(obj)/include ccflags-y += -iquote $(obj) -iquote . -iquote $(obj)/include
ccflags-y += -iquote $(SRC_DIR)/criu/include -iquote $(SRC_DIR)/include ccflags-y += -iquote criu/include -iquote include
ccflags-y += $(COMPEL_UAPI_INCLUDES) ccflags-y += $(COMPEL_UAPI_INCLUDES)
asflags-y += -Wstrict-prototypes asflags-y += -Wstrict-prototypes
......
...@@ -19,10 +19,9 @@ endif ...@@ -19,10 +19,9 @@ endif
# #
CFLAGS := $(filter-out -pg $(CFLAGS-GCOV),$(CFLAGS)) CFLAGS := $(filter-out -pg $(CFLAGS-GCOV),$(CFLAGS))
CFLAGS := $(filter-out $(CFLAGS-ASAN),$(CFLAGS)) CFLAGS := $(filter-out $(CFLAGS-ASAN),$(CFLAGS))
CFLAGS += -iquote $(SRC_DIR)/criu/arch/$(ARCH)/include CFLAGS += -iquote criu/arch/$(ARCH)/include
CFLAGS += -iquote $(SRC_DIR)/criu/include CFLAGS += -iquote criu/include
CFLAGS += -iquote $(SRC_DIR)/include CFLAGS += -iquote include
CFLAGS += -iquote $(SRC_DIR)
ccflags-y += $(COMPEL_UAPI_INCLUDES) ccflags-y += $(COMPEL_UAPI_INCLUDES)
ccflags-y += -DCR_NOGLIBC ccflags-y += -DCR_NOGLIBC
......
...@@ -34,9 +34,8 @@ endif ...@@ -34,9 +34,8 @@ endif
# applications, which is not the target of the # applications, which is not the target of the
# project. # project.
# #
iquotes := -iquote $(SRC_DIR)/$(PIE_DIR)/piegen iquotes += -iquote $(ARCH_DIR)/include
iquotes += -iquote $(SRC_DIR)/$(ARCH_DIR)/include iquotes += -iquote criu/include -iquote include
iquotes += -iquote $(SRC_DIR) -iquote $(SRC_DIR)/criu/include -iquote $(SRC_DIR)/include
CFLAGS := $(filter-out -pg $(CFLAGS-GCOV),$(CFLAGS)) $(iquotes) CFLAGS := $(filter-out -pg $(CFLAGS-GCOV),$(CFLAGS)) $(iquotes)
CFLAGS := $(filter-out $(CFLAGS-ASAN),$(CFLAGS)) CFLAGS := $(filter-out $(CFLAGS-ASAN),$(CFLAGS))
......
...@@ -40,6 +40,7 @@ clean-lib: ...@@ -40,6 +40,7 @@ clean-lib:
.PHONY: clean-lib .PHONY: clean-lib
clean: clean-lib clean: clean-lib
cleanup-y += lib/c/$(CRIU_SO) lib/c/criu.pc cleanup-y += lib/c/$(CRIU_SO) lib/c/criu.pc
mrproper: clean
install: lib-c lib-py crit/crit lib/c/criu.pc.in install: lib-c lib-py crit/crit lib/c/criu.pc.in
$(E) " INSTALL " lib $(E) " INSTALL " lib
......
obj-y += criu.o 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 criu/$(ARCH_DIR)/include
ccflags-y += -iquote $(SRC_DIR)/criu/include -iquote $(obj)/.. ccflags-y += -iquote criu/include
ccflags-y += -iquote $(SRC_DIR)/images ccflags-y += -iquote images
ccflags-y += -fPIC -fno-stack-protector ccflags-y += -fPIC -fno-stack-protector
ldflags-y += -z noexecstack ldflags-y += -z noexecstack
...@@ -10,7 +10,7 @@ libpy-images: ...@@ -10,7 +10,7 @@ libpy-images:
.PHONY: libpy-images .PHONY: libpy-images
rpc_pb2.py: 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) cleanup-y += $(addprefix $(obj)/,rpc_pb2.py *.pyc)
......
all-y += images magic.py pb.py 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)))) 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. # 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 # Unfortunately, we can't drop ugly _pb2 suffixes here, because
# some _pb2 files depend on others _pb2 files. # some _pb2 files depend on others _pb2 files.
images: 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 .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, $@) $(call msg-gen, $@)
$(Q) python $^ $(obj)/$@ $(Q) python $^ $(obj)/$@
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment