2016-02-15 15:26:55 +03:00
|
|
|
#
|
2016-02-15 15:26:49 +03:00
|
|
|
# Import the build engine first
|
|
|
|
__nmk_dir=$(CURDIR)/scripts/nmk/scripts/
|
|
|
|
export __nmk_dir
|
|
|
|
|
2016-09-19 13:58:01 -07:00
|
|
|
include $(__nmk_dir)include.mk
|
|
|
|
include $(__nmk_dir)macro.mk
|
2012-11-22 18:54:21 +04:00
|
|
|
|
2014-02-07 12:04:42 -05:00
|
|
|
CFLAGS += $(USERCFLAGS)
|
2016-02-15 15:26:55 +03:00
|
|
|
export CFLAGS
|
2015-09-29 22:26:21 +03:00
|
|
|
|
2016-02-15 15:26:55 +03:00
|
|
|
HOSTCFLAGS ?= $(CFLAGS)
|
2015-09-29 22:26:21 +03:00
|
|
|
export HOSTCFLAGS
|
2014-02-07 12:04:42 -05:00
|
|
|
|
2016-02-15 15:26:55 +03:00
|
|
|
#
|
|
|
|
# Where we live.
|
|
|
|
SRC_DIR := $(CURDIR)
|
|
|
|
export SRC_DIR
|
2016-02-15 15:26:52 +03:00
|
|
|
|
2016-02-15 15:26:55 +03:00
|
|
|
#
|
2016-04-14 14:01:00 +03:00
|
|
|
# Architecture specific options.
|
|
|
|
ifneq ($(filter-out x86 arm arm64 ppc64,$(ARCH)),)
|
|
|
|
$(error "The architecture $(ARCH) isn't supported")
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(ARCH),x86)
|
|
|
|
SRCARCH := x86
|
|
|
|
LDARCH := i386:x86-64
|
|
|
|
VDSO := y
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(ARCH),arm)
|
|
|
|
SRCARCH := arm
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(ARCH),arm64)
|
|
|
|
ARCH := aarch64
|
|
|
|
SRCARCH := aarch64
|
|
|
|
VDSO := y
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(ARCH),ppc64)
|
|
|
|
SRCARCH := ppc64
|
|
|
|
LDARCH := powerpc:common64
|
|
|
|
VDSO := y
|
|
|
|
endif
|
|
|
|
|
|
|
|
LDARCH ?= $(SRCARCH)
|
|
|
|
|
|
|
|
export SRCARCH LDARCH VDSO
|
|
|
|
|
|
|
|
SRCARCH ?= $(ARCH)
|
|
|
|
LDARCH ?= $(SRCARCH)
|
|
|
|
|
|
|
|
export SRCARCH LDARCH VDSO
|
|
|
|
|
2016-02-15 15:26:55 +03:00
|
|
|
UNAME-M := $(shell uname -m)
|
|
|
|
export UNAME-M
|
2012-11-22 18:54:21 +04:00
|
|
|
|
2016-02-15 15:26:55 +03:00
|
|
|
ifeq ($(ARCH),arm)
|
|
|
|
ARMV := $(shell echo $(UNAME-M) | sed -nr 's/armv([[:digit:]]).*/\1/p; t; i7')
|
|
|
|
DEFINES := -DCONFIG_ARMV$(ARMV)
|
2015-12-29 13:56:00 +03:00
|
|
|
|
2016-02-15 15:26:55 +03:00
|
|
|
ifeq ($(ARMV),6)
|
|
|
|
USERCFLAGS += -march=armv6
|
|
|
|
endif
|
2014-12-24 11:42:00 +03:00
|
|
|
|
2016-02-15 15:26:55 +03:00
|
|
|
ifeq ($(ARMV),7)
|
|
|
|
USERCFLAGS += -march=armv7-a
|
|
|
|
endif
|
2013-07-10 10:15:54 +04:00
|
|
|
|
2016-02-15 15:26:55 +03:00
|
|
|
PROTOUFIX := y
|
|
|
|
endif
|
2013-01-22 22:53:24 +04:00
|
|
|
|
2016-12-17 03:21:59 -08:00
|
|
|
ifeq ($(ARCH),aarch64)
|
|
|
|
DEFINES := -DCONFIG_AARCH64
|
|
|
|
endif
|
|
|
|
|
2016-02-15 15:26:55 +03:00
|
|
|
ifeq ($(ARCH),x86)
|
|
|
|
DEFINES := -DCONFIG_X86_64
|
2015-04-22 20:19:59 +03:00
|
|
|
endif
|
|
|
|
|
2015-04-30 09:57:49 +03:00
|
|
|
#
|
|
|
|
# The PowerPC 64 bits architecture could be big or little endian.
|
|
|
|
# They are handled in the same way.
|
|
|
|
#
|
2016-02-24 17:21:31 +01:00
|
|
|
ifeq ($(ARCH),ppc64)
|
2016-02-15 15:26:55 +03:00
|
|
|
ifeq ($(UNAME-M),ppc64)
|
|
|
|
error := $(error ppc64 big endian not yet supported)
|
|
|
|
endif
|
2013-10-11 10:48:00 +04:00
|
|
|
|
2016-02-15 15:26:55 +03:00
|
|
|
DEFINES := -DCONFIG_PPC64
|
2015-06-16 12:31:00 +03:00
|
|
|
endif
|
|
|
|
|
2016-02-15 15:26:55 +03:00
|
|
|
export PROTOUFIX DEFINES USERCFLAGS
|
2012-11-22 18:54:21 +04:00
|
|
|
|
2016-02-15 15:26:55 +03:00
|
|
|
#
|
|
|
|
# Independent options for all tools.
|
|
|
|
DEFINES += -D_FILE_OFFSET_BITS=64
|
|
|
|
DEFINES += -D_GNU_SOURCE
|
2012-11-22 18:54:21 +04:00
|
|
|
|
2016-02-15 15:26:55 +03:00
|
|
|
CFLAGS += $(USERCFLAGS)
|
2012-11-22 18:54:21 +04:00
|
|
|
|
2016-08-31 23:09:00 +03:00
|
|
|
WARNINGS := -Wall -Wformat-security
|
2012-11-22 18:54:21 +04:00
|
|
|
|
2016-02-25 11:41:00 +03:00
|
|
|
CFLAGS-GCOV := --coverage -fno-exceptions -fno-inline
|
|
|
|
export CFLAGS-GCOV
|
|
|
|
|
2016-10-20 20:04:47 -07:00
|
|
|
ifneq ($(GCOV),)
|
2016-02-19 18:18:00 +03:00
|
|
|
LDFLAGS += -lgcov
|
2016-02-25 11:41:00 +03:00
|
|
|
CFLAGS += $(CFLAGS-GCOV)
|
2016-02-19 18:18:00 +03:00
|
|
|
endif
|
|
|
|
|
2017-02-06 13:14:15 +03:00
|
|
|
ifeq ($(ASAN),1)
|
|
|
|
CFLAGS-ASAN := -fsanitize=address
|
|
|
|
export CFLAGS-ASAN
|
|
|
|
CFLAGS += $(CFLAGS-ASAN)
|
|
|
|
endif
|
|
|
|
|
2012-11-22 18:54:21 +04:00
|
|
|
ifneq ($(WERROR),0)
|
2016-02-15 15:26:55 +03:00
|
|
|
WARNINGS += -Werror
|
2012-11-22 18:54:21 +04:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(DEBUG),1)
|
2016-02-15 15:26:55 +03:00
|
|
|
DEFINES += -DCR_DEBUG
|
|
|
|
CFLAGS += -O0 -ggdb3
|
2012-11-22 18:54:21 +04:00
|
|
|
else
|
2016-02-15 15:26:55 +03:00
|
|
|
CFLAGS += -O2 -g
|
2015-06-05 00:04:02 +03:00
|
|
|
endif
|
2012-11-22 18:54:21 +04:00
|
|
|
|
2016-05-04 14:56:00 +03:00
|
|
|
ifeq ($(GMON),1)
|
|
|
|
CFLAGS += -pg
|
|
|
|
GMONLDOPT += -pg
|
|
|
|
export GMON GMONLDOPT
|
|
|
|
endif
|
|
|
|
|
2016-10-27 19:24:13 +03:00
|
|
|
CFLAGS += $(WARNINGS) $(DEFINES) -iquote include/
|
2013-02-15 23:40:33 +04:00
|
|
|
|
2016-10-05 22:08:00 +03:00
|
|
|
# Default target
|
2016-07-18 22:22:43 +03:00
|
|
|
all: criu lib
|
2016-10-05 22:08:00 +03:00
|
|
|
.PHONY: all
|
|
|
|
|
2016-04-14 14:01:01 +03:00
|
|
|
#
|
|
|
|
# Version headers.
|
|
|
|
include Makefile.versions
|
|
|
|
|
|
|
|
VERSION_HEADER := $(SRC_DIR)/criu/include/version.h
|
|
|
|
GITID_FILE := .gitid
|
2016-05-27 16:16:00 +03:00
|
|
|
GITID := $(shell if [ -d ".git" ]; then git describe --always; fi)
|
2016-04-14 14:01:01 +03:00
|
|
|
|
2016-05-27 16:16:00 +03:00
|
|
|
# Git repository wasn't inited in CRIU folder
|
2016-04-14 14:01:01 +03:00
|
|
|
ifeq ($(GITID),)
|
|
|
|
GITID := 0
|
|
|
|
else
|
|
|
|
GITID_FILE_VALUE := $(shell if [ -f '$(GITID_FILE)' ]; then if [ `cat '$(GITID_FILE)'` = $(GITID) ]; then echo y; fi; fi)
|
|
|
|
ifneq ($(GITID_FILE_VALUE),y)
|
|
|
|
.PHONY: $(GITID_FILE)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
$(GITID_FILE):
|
|
|
|
$(call msg-gen, $@)
|
|
|
|
$(Q) echo "$(GITID)" > $(GITID_FILE)
|
|
|
|
|
|
|
|
$(VERSION_HEADER): Makefile.versions $(GITID_FILE)
|
|
|
|
$(call msg-gen, $@)
|
|
|
|
$(Q) echo "/* Autogenerated, do not edit */" > $@
|
|
|
|
$(Q) echo "#ifndef __CR_VERSION_H__" >> $@
|
|
|
|
$(Q) echo "#define __CR_VERSION_H__" >> $@
|
|
|
|
$(Q) echo "#define CRIU_VERSION \"$(CRIU_VERSION)\"" >> $@
|
|
|
|
$(Q) echo "#define CRIU_VERSION_MAJOR " $(CRIU_VERSION_MAJOR) >> $@
|
|
|
|
$(Q) echo "#define CRIU_VERSION_MINOR " $(CRIU_VERSION_MINOR) >> $@
|
|
|
|
ifneq ($(CRIU_VERSION_SUBLEVEL),)
|
|
|
|
$(Q) echo "#define CRIU_VERSION_SUBLEVEL " $(CRIU_VERSION_SUBLEVEL) >> $@
|
|
|
|
endif
|
|
|
|
ifneq ($(CRIU_VERSION_EXTRA),)
|
|
|
|
$(Q) echo "#define CRIU_VERSION_EXTRA " $(CRIU_VERSION_EXTRA) >> $@
|
|
|
|
endif
|
|
|
|
$(Q) echo "#define CRIU_GITID \"$(GITID)\"" >> $@
|
|
|
|
$(Q) echo "#endif /* __CR_VERSION_H__ */" >> $@
|
|
|
|
|
2016-12-17 03:22:09 -08:00
|
|
|
criu-deps += $(VERSION_HEADER)
|
|
|
|
|
2016-10-24 14:58:08 +03:00
|
|
|
#
|
|
|
|
# Setup proper link for asm headers in common code.
|
|
|
|
include/common/asm: include/common/arch/$(ARCH)/asm
|
|
|
|
$(call msg-gen, $@)
|
|
|
|
$(Q) ln -s ./arch/$(ARCH)/asm $@
|
2016-12-17 03:22:09 -08:00
|
|
|
|
|
|
|
criu-deps += include/common/asm
|
2016-10-24 14:58:08 +03:00
|
|
|
|
2016-09-26 16:05:43 +03:00
|
|
|
#
|
|
|
|
# Configure variables.
|
2016-09-23 15:21:51 +03:00
|
|
|
export CONFIG_HEADER := criu/include/config.h
|
2016-09-26 16:05:43 +03:00
|
|
|
ifeq ($(filter clean mrproper,$(MAKECMDGOALS)),)
|
|
|
|
include $(SRC_DIR)/Makefile.config
|
2016-09-23 17:20:32 +03:00
|
|
|
else
|
|
|
|
# To clean all files, enable make/build options here
|
|
|
|
export CONFIG_COMPAT := y
|
2016-09-26 16:05:43 +03:00
|
|
|
endif
|
|
|
|
|
2013-02-15 23:40:28 +04:00
|
|
|
#
|
2016-02-15 15:26:55 +03:00
|
|
|
# Protobuf images first, they are not depending
|
|
|
|
# on anything else.
|
|
|
|
$(eval $(call gen-built-in,images))
|
2016-12-17 03:22:09 -08:00
|
|
|
criu-deps += images/built-in.o
|
2015-06-05 00:04:02 +03:00
|
|
|
|
build/make: return to make from top directory
It looks like, there is not so much that needs to be fixed for
building criu from a top directory.
After the patch it's possible to do `make criu/mount.o` i.e.
It will build protobuf, compel as dependencies (if they are not built),
but no more from criu objects. If something breaks, you can
do make from vim and jump to error. Nice.
Mostly the patch corrects pathes to objects - I tried to make them
depend on $(obj) or $(SRC_DIR)/criu, where it's possible.
After it tested:
`make -j 10`, `make criu/log.o`, `make clean`, `make mrproper`,
`make install DESTDIR=/tmp/criu`, `make uninstall DESTDIR=/tmp/criu`
Note: I improperly called v1 for this patch as "return to make from
top Makefile" -- but I didn't mean that (and it was friday ;)
This patch doesn't yet switch to top-Makefile building, but that's
a step in that way (building from a top Makefile needs correct pathes
in makefiles) which also adds ability to build objects in subdirectories
and etc.
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-18 22:22:48 +03:00
|
|
|
.PHONY: .FORCE
|
|
|
|
|
2016-09-21 23:54:18 +03:00
|
|
|
#
|
2016-04-05 18:41:15 +03:00
|
|
|
# Compel get used by CRIU, build it earlier
|
2016-09-21 23:54:18 +03:00
|
|
|
include Makefile.compel
|
2016-05-11 15:49:00 +03:00
|
|
|
|
2016-08-05 14:49:22 +03:00
|
|
|
#
|
|
|
|
# Next the socket CR library
|
|
|
|
#
|
|
|
|
SOCCR_A := soccr/libsoccr.a
|
2016-10-05 17:05:00 +03:00
|
|
|
SOCCR_CONFIG := $(SRC_DIR)/soccr/config.h
|
|
|
|
$(SOCCR_CONFIG): $(CONFIG_HEADER)
|
2016-09-23 15:21:51 +03:00
|
|
|
$(Q) test -f $@ || ln -s ../$(CONFIG_HEADER) $@
|
2016-10-05 17:05:00 +03:00
|
|
|
soccr/%: $(SOCCR_CONFIG) .FORCE
|
2016-08-05 14:49:22 +03:00
|
|
|
$(Q) $(MAKE) $(build)=soccr $@
|
2016-10-05 17:05:00 +03:00
|
|
|
soccr/built-in.o: $(SOCCR_CONFIG) .FORCE
|
2016-08-05 14:49:22 +03:00
|
|
|
$(Q) $(MAKE) $(build)=soccr all
|
|
|
|
$(SOCCR_A): |soccr/built-in.o
|
2016-12-17 03:22:09 -08:00
|
|
|
criu-deps += $(SOCCR_A)
|
2016-08-05 14:49:22 +03:00
|
|
|
|
2016-02-15 15:26:55 +03:00
|
|
|
#
|
|
|
|
# CRIU building done in own directory
|
|
|
|
# with slightly different rules so we
|
|
|
|
# can't use nmk engine directly (we
|
|
|
|
# build syscalls library and such).
|
|
|
|
#
|
|
|
|
# But note that we're already included
|
|
|
|
# the nmk so we can reuse it there.
|
2016-12-17 03:22:09 -08:00
|
|
|
criu/%: $(criu-deps) .FORCE
|
build/make: return to make from top directory
It looks like, there is not so much that needs to be fixed for
building criu from a top directory.
After the patch it's possible to do `make criu/mount.o` i.e.
It will build protobuf, compel as dependencies (if they are not built),
but no more from criu objects. If something breaks, you can
do make from vim and jump to error. Nice.
Mostly the patch corrects pathes to objects - I tried to make them
depend on $(obj) or $(SRC_DIR)/criu, where it's possible.
After it tested:
`make -j 10`, `make criu/log.o`, `make clean`, `make mrproper`,
`make install DESTDIR=/tmp/criu`, `make uninstall DESTDIR=/tmp/criu`
Note: I improperly called v1 for this patch as "return to make from
top Makefile" -- but I didn't mean that (and it was friday ;)
This patch doesn't yet switch to top-Makefile building, but that's
a step in that way (building from a top Makefile needs correct pathes
in makefiles) which also adds ability to build objects in subdirectories
and etc.
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-18 22:22:48 +03:00
|
|
|
$(Q) $(MAKE) $(build)=criu $@
|
2016-12-17 03:22:09 -08:00
|
|
|
criu: $(criu-deps)
|
build/make: return to make from top directory
It looks like, there is not so much that needs to be fixed for
building criu from a top directory.
After the patch it's possible to do `make criu/mount.o` i.e.
It will build protobuf, compel as dependencies (if they are not built),
but no more from criu objects. If something breaks, you can
do make from vim and jump to error. Nice.
Mostly the patch corrects pathes to objects - I tried to make them
depend on $(obj) or $(SRC_DIR)/criu, where it's possible.
After it tested:
`make -j 10`, `make criu/log.o`, `make clean`, `make mrproper`,
`make install DESTDIR=/tmp/criu`, `make uninstall DESTDIR=/tmp/criu`
Note: I improperly called v1 for this patch as "return to make from
top Makefile" -- but I didn't mean that (and it was friday ;)
This patch doesn't yet switch to top-Makefile building, but that's
a step in that way (building from a top Makefile needs correct pathes
in makefiles) which also adds ability to build objects in subdirectories
and etc.
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-18 22:22:48 +03:00
|
|
|
$(Q) $(MAKE) $(build)=criu all
|
2016-02-24 19:10:38 +03:00
|
|
|
.PHONY: criu
|
2012-01-26 14:00:40 +04:00
|
|
|
|
2016-02-15 15:26:55 +03:00
|
|
|
#
|
|
|
|
# Libraries next once criu it ready
|
|
|
|
# (we might generate headers and such
|
|
|
|
# when building criu itself).
|
build/make: return to make from top directory
It looks like, there is not so much that needs to be fixed for
building criu from a top directory.
After the patch it's possible to do `make criu/mount.o` i.e.
It will build protobuf, compel as dependencies (if they are not built),
but no more from criu objects. If something breaks, you can
do make from vim and jump to error. Nice.
Mostly the patch corrects pathes to objects - I tried to make them
depend on $(obj) or $(SRC_DIR)/criu, where it's possible.
After it tested:
`make -j 10`, `make criu/log.o`, `make clean`, `make mrproper`,
`make install DESTDIR=/tmp/criu`, `make uninstall DESTDIR=/tmp/criu`
Note: I improperly called v1 for this patch as "return to make from
top Makefile" -- but I didn't mean that (and it was friday ;)
This patch doesn't yet switch to top-Makefile building, but that's
a step in that way (building from a top Makefile needs correct pathes
in makefiles) which also adds ability to build objects in subdirectories
and etc.
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-18 22:22:48 +03:00
|
|
|
lib/%: criu .FORCE
|
2017-02-22 15:15:42 -08:00
|
|
|
$(Q) $(MAKE) $(build)=lib $@
|
2016-02-24 19:10:38 +03:00
|
|
|
lib: criu
|
2017-02-22 15:15:42 -08:00
|
|
|
$(Q) $(MAKE) $(build)=lib all
|
2016-03-10 22:19:51 +03:00
|
|
|
.PHONY: lib
|
2016-02-15 15:26:53 +03:00
|
|
|
|
2016-03-18 13:09:33 +03:00
|
|
|
subclean:
|
2016-02-15 22:32:00 +03:00
|
|
|
$(Q) $(MAKE) -C Documentation clean
|
2016-05-11 15:49:00 +03:00
|
|
|
$(Q) $(MAKE) $(build)=test/compel clean
|
2016-03-18 13:09:33 +03:00
|
|
|
$(Q) $(RM) .gitid
|
|
|
|
.PHONY: subclean
|
2013-08-28 23:57:47 +04:00
|
|
|
|
2016-03-18 13:09:33 +03:00
|
|
|
clean: subclean
|
|
|
|
$(Q) $(MAKE) $(build)=images $@
|
build/make: return to make from top directory
It looks like, there is not so much that needs to be fixed for
building criu from a top directory.
After the patch it's possible to do `make criu/mount.o` i.e.
It will build protobuf, compel as dependencies (if they are not built),
but no more from criu objects. If something breaks, you can
do make from vim and jump to error. Nice.
Mostly the patch corrects pathes to objects - I tried to make them
depend on $(obj) or $(SRC_DIR)/criu, where it's possible.
After it tested:
`make -j 10`, `make criu/log.o`, `make clean`, `make mrproper`,
`make install DESTDIR=/tmp/criu`, `make uninstall DESTDIR=/tmp/criu`
Note: I improperly called v1 for this patch as "return to make from
top Makefile" -- but I didn't mean that (and it was friday ;)
This patch doesn't yet switch to top-Makefile building, but that's
a step in that way (building from a top Makefile needs correct pathes
in makefiles) which also adds ability to build objects in subdirectories
and etc.
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-18 22:22:48 +03:00
|
|
|
$(Q) $(MAKE) $(build)=criu $@
|
2016-08-05 14:49:22 +03:00
|
|
|
$(Q) $(MAKE) $(build)=soccr $@
|
2017-02-22 15:15:42 -08:00
|
|
|
$(Q) $(MAKE) $(build)=lib $@
|
2016-04-05 18:41:15 +03:00
|
|
|
$(Q) $(MAKE) $(build)=compel $@
|
2016-09-26 22:36:39 +03:00
|
|
|
$(Q) $(MAKE) $(build)=compel/plugins $@
|
2017-02-22 15:15:42 -08:00
|
|
|
$(Q) $(MAKE) $(build)=lib $@
|
2016-03-18 13:09:33 +03:00
|
|
|
.PHONY: clean
|
|
|
|
|
|
|
|
# mrproper depends on clean in nmk
|
|
|
|
mrproper: subclean
|
|
|
|
$(Q) $(MAKE) $(build)=images $@
|
build/make: return to make from top directory
It looks like, there is not so much that needs to be fixed for
building criu from a top directory.
After the patch it's possible to do `make criu/mount.o` i.e.
It will build protobuf, compel as dependencies (if they are not built),
but no more from criu objects. If something breaks, you can
do make from vim and jump to error. Nice.
Mostly the patch corrects pathes to objects - I tried to make them
depend on $(obj) or $(SRC_DIR)/criu, where it's possible.
After it tested:
`make -j 10`, `make criu/log.o`, `make clean`, `make mrproper`,
`make install DESTDIR=/tmp/criu`, `make uninstall DESTDIR=/tmp/criu`
Note: I improperly called v1 for this patch as "return to make from
top Makefile" -- but I didn't mean that (and it was friday ;)
This patch doesn't yet switch to top-Makefile building, but that's
a step in that way (building from a top Makefile needs correct pathes
in makefiles) which also adds ability to build objects in subdirectories
and etc.
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-18 22:22:48 +03:00
|
|
|
$(Q) $(MAKE) $(build)=criu $@
|
2016-08-05 14:49:22 +03:00
|
|
|
$(Q) $(MAKE) $(build)=soccr $@
|
2017-02-22 15:15:42 -08:00
|
|
|
$(Q) $(MAKE) $(build)=lib $@
|
2016-04-05 18:41:15 +03:00
|
|
|
$(Q) $(MAKE) $(build)=compel $@
|
2016-09-26 22:36:39 +03:00
|
|
|
$(Q) $(MAKE) $(build)=compel/plugins $@
|
2016-09-26 16:05:43 +03:00
|
|
|
$(Q) $(RM) $(CONFIG_HEADER)
|
2016-10-05 17:05:00 +03:00
|
|
|
$(Q) $(RM) $(SOCCR_CONFIG)
|
2016-04-14 14:01:01 +03:00
|
|
|
$(Q) $(RM) $(VERSION_HEADER)
|
2016-09-21 23:54:18 +03:00
|
|
|
$(Q) $(RM) $(COMPEL_VERSION_HEADER)
|
2016-10-24 14:58:08 +03:00
|
|
|
$(Q) $(RM) include/common/asm
|
2016-10-27 01:15:00 +03:00
|
|
|
$(Q) $(RM) compel/include/asm
|
2016-02-24 15:21:39 +01:00
|
|
|
$(Q) $(RM) cscope.*
|
|
|
|
$(Q) $(RM) tags TAGS
|
2016-03-18 13:09:33 +03:00
|
|
|
.PHONY: mrproper
|
2013-05-24 01:42:11 +04:00
|
|
|
|
2016-02-15 15:26:55 +03:00
|
|
|
#
|
|
|
|
# Non-CRIU stuff.
|
|
|
|
#
|
2013-05-24 01:42:12 +04:00
|
|
|
|
2016-02-15 15:26:55 +03:00
|
|
|
docs:
|
|
|
|
$(Q) $(MAKE) -s -C Documentation all
|
2016-03-10 22:19:51 +03:00
|
|
|
.PHONY: docs
|
2011-09-23 12:00:45 +04:00
|
|
|
|
2012-05-29 18:33:00 +04:00
|
|
|
zdtm: all
|
2016-02-20 12:38:53 +03:00
|
|
|
$(Q) MAKEFLAGS= $(MAKE) -C test/zdtm all
|
2016-03-10 22:19:51 +03:00
|
|
|
.PHONY: zdtm
|
2012-01-24 19:37:44 +04:00
|
|
|
|
|
|
|
test: zdtm
|
2016-02-20 12:38:53 +03:00
|
|
|
$(Q) MAKEFLAGS= $(MAKE) -C test
|
2016-03-10 22:19:51 +03:00
|
|
|
.PHONY: test
|
2011-09-29 16:03:36 +04:00
|
|
|
|
2016-03-08 12:28:00 +03:00
|
|
|
#
|
|
|
|
# Generating tar requires tag matched CRIU_VERSION.
|
|
|
|
# If not found then simply use GIT's describe with
|
|
|
|
# "v" prefix stripped.
|
|
|
|
head-name := $(shell git tag -l v$(CRIU_VERSION))
|
|
|
|
ifeq ($(head-name),)
|
2016-05-27 16:16:00 +03:00
|
|
|
head-name := $(shell git describe 2>/dev/null)
|
|
|
|
endif
|
|
|
|
# If no git tag could describe current commit,
|
|
|
|
# use pre-defined CRIU_VERSION with GITID (if any).
|
|
|
|
ifeq ($(head-name),)
|
|
|
|
ifneq ($(GITID),)
|
|
|
|
head-name := $(CRIU_VERSION)-$(GITID)
|
|
|
|
else
|
|
|
|
head-name := $(CRIU_VERSION)
|
|
|
|
endif
|
2016-02-18 12:43:29 +03:00
|
|
|
endif
|
2016-03-08 12:28:00 +03:00
|
|
|
tar-name := $(shell echo $(head-name) | sed -e 's/^v//g')
|
2016-02-18 12:43:29 +03:00
|
|
|
criu-$(tar-name).tar.bz2:
|
2016-03-08 12:28:00 +03:00
|
|
|
git archive --format tar --prefix 'criu-$(tar-name)/' $(head-name) | bzip2 > $@
|
2016-02-18 12:43:29 +03:00
|
|
|
dist tar: criu-$(tar-name).tar.bz2
|
|
|
|
@true
|
2016-02-15 15:26:55 +03:00
|
|
|
.PHONY: dist tar
|
2012-02-14 03:10:29 +04:00
|
|
|
|
2011-09-23 12:00:45 +04:00
|
|
|
tags:
|
2016-02-15 15:26:55 +03:00
|
|
|
$(call msg-gen, $@)
|
2013-02-15 17:37:20 +04:00
|
|
|
$(Q) $(RM) tags
|
2016-02-24 15:21:39 +01:00
|
|
|
$(Q) $(FIND) . -name '*.[hcS]' ! -path './.*' ! -path './test/*' -print | xargs $(CTAGS) -a
|
2016-03-10 22:19:51 +03:00
|
|
|
.PHONY: tags
|
2011-09-23 12:00:45 +04:00
|
|
|
|
2016-02-25 16:25:00 +03:00
|
|
|
etags:
|
|
|
|
$(call msg-gen, $@)
|
|
|
|
$(Q) $(RM) TAGS
|
|
|
|
$(Q) $(FIND) . -name '*.[hcS]' ! -path './.*' ! -path './test/*' -print | xargs $(ETAGS) -a
|
2016-03-10 22:19:51 +03:00
|
|
|
.PHONY: etags
|
2016-02-25 16:25:00 +03:00
|
|
|
|
|
|
|
|
2011-09-23 12:00:45 +04:00
|
|
|
cscope:
|
2016-02-15 15:26:55 +03:00
|
|
|
$(call msg-gen, $@)
|
2015-05-05 12:44:00 +03:00
|
|
|
$(Q) $(FIND) . -name '*.[hcS]' ! -path './.*' ! -path './test/*' ! -type l -print > cscope.files
|
2011-09-23 12:00:45 +04:00
|
|
|
$(Q) $(CSCOPE) -bkqu
|
2016-03-10 22:19:51 +03:00
|
|
|
.PHONY: cscope
|
2012-01-17 16:08:22 +03:00
|
|
|
|
2016-02-15 15:26:55 +03:00
|
|
|
gcov:
|
|
|
|
$(E) " GCOV"
|
|
|
|
$(Q) test -d gcov || mkdir gcov && \
|
2016-03-05 00:37:00 +03:00
|
|
|
geninfo --output-filename gcov/criu.info --no-recursion criu/ && \
|
2016-02-15 15:26:55 +03:00
|
|
|
cd gcov && \
|
|
|
|
genhtml --rc lcov_branch_coverage=1 --output-directory html criu.info
|
|
|
|
@echo "Code coverage report is in `pwd`/gcov/html/ directory."
|
2016-03-10 22:19:51 +03:00
|
|
|
.PHONY: gcov
|
2012-01-28 18:45:28 +04:00
|
|
|
|
2016-02-15 15:26:55 +03:00
|
|
|
docker-build:
|
2016-02-18 20:41:08 +03:00
|
|
|
$(MAKE) -C scripts/build/ x86_64
|
2016-03-10 22:19:51 +03:00
|
|
|
.PHONY: docker-build
|
2013-04-30 13:25:06 -07:00
|
|
|
|
2016-02-15 15:26:55 +03:00
|
|
|
docker-test:
|
2016-02-20 19:27:00 +03:00
|
|
|
docker run --rm -it --privileged criu-x86_64 ./test/zdtm.py run -a -x tcp6 -x tcpbuf6 -x static/rtc -x cgroup
|
2016-03-10 22:19:51 +03:00
|
|
|
.PHONY: docker-test
|
2013-05-03 01:56:30 +04:00
|
|
|
|
2012-01-27 18:41:09 +04:00
|
|
|
help:
|
2013-05-01 20:17:05 -07:00
|
|
|
@echo ' Targets:'
|
|
|
|
@echo ' all - Build all [*] targets'
|
2013-05-01 20:17:06 -07:00
|
|
|
@echo ' * criu - Build criu'
|
2013-05-01 20:17:05 -07:00
|
|
|
@echo ' zdtm - Build zdtm test-suite'
|
|
|
|
@echo ' docs - Build documentation'
|
2016-04-22 18:45:52 +03:00
|
|
|
@echo ' install - Install CRIU (see INSTALL.md)'
|
|
|
|
@echo ' uninstall - Uninstall CRIU'
|
2013-05-03 01:56:31 +04:00
|
|
|
@echo ' dist - Create a source tarball'
|
2016-03-18 13:09:33 +03:00
|
|
|
@echo ' clean - Clean most, but leave enough to navigate'
|
|
|
|
@echo ' mrproper - Delete all compiled/generated files'
|
2013-05-01 20:17:05 -07:00
|
|
|
@echo ' tags - Generate tags file (ctags)'
|
2016-02-25 16:25:00 +03:00
|
|
|
@echo ' etags - Generate TAGS file (etags)'
|
2013-05-01 20:17:05 -07:00
|
|
|
@echo ' cscope - Generate cscope database'
|
|
|
|
@echo ' test - Run zdtm test-suite'
|
2016-02-15 15:26:55 +03:00
|
|
|
@echo ' gcov - Make code coverage report'
|
2016-03-10 22:19:51 +03:00
|
|
|
.PHONY: help
|
2012-12-25 22:43:14 +04:00
|
|
|
|
2016-06-03 05:33:00 +03:00
|
|
|
lint:
|
|
|
|
flake8 --config=scripts/flake8.cfg test/zdtm.py
|
|
|
|
|
2016-02-15 15:26:55 +03:00
|
|
|
include Makefile.install
|
2015-03-20 11:33:09 +03:00
|
|
|
|
2016-02-15 15:26:55 +03:00
|
|
|
.DEFAULT_GOAL := all
|
2015-05-01 02:25:00 +03:00
|
|
|
|
2016-09-20 19:20:57 +03:00
|
|
|
# Disable implicit rules in _this_ Makefile.
|
|
|
|
.SUFFIXES:
|
|
|
|
|
2016-02-15 15:26:55 +03:00
|
|
|
#
|
|
|
|
# Optional local include.
|
2015-05-01 02:25:00 +03:00
|
|
|
-include Makefile.local
|