2016-02-15 15:26:49 +03:00
|
|
|
__nmk_dir=$(CURDIR)/scripts/nmk/scripts/
|
|
|
|
export __nmk_dir
|
|
|
|
|
2017-02-22 15:15:49 -08:00
|
|
|
#
|
|
|
|
# No need to try to remake our Makefiles
|
|
|
|
Makefile: ;
|
|
|
|
Makefile.%: ;
|
|
|
|
scripts/%.mak: ;
|
|
|
|
$(__nmk_dir)%.mk: ;
|
|
|
|
|
|
|
|
#
|
|
|
|
# Import the build engine
|
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
|
|
|
|
2017-04-24 21:37:19 +03:00
|
|
|
ifeq ($(origin HOSTCFLAGS), undefined)
|
|
|
|
HOSTCFLAGS := $(CFLAGS) $(USERCFLAGS)
|
|
|
|
endif
|
2014-02-07 12:04:42 -05:00
|
|
|
|
2016-02-15 15:26:55 +03:00
|
|
|
#
|
2017-04-24 21:37:17 +03:00
|
|
|
# Supported Architectures
|
2017-06-30 20:31:43 +02:00
|
|
|
ifneq ($(filter-out x86 arm aarch64 ppc64 s390,$(ARCH)),)
|
2016-04-14 14:01:00 +03:00
|
|
|
$(error "The architecture $(ARCH) isn't supported")
|
|
|
|
endif
|
|
|
|
|
2017-04-24 21:37:17 +03:00
|
|
|
# The PowerPC 64 bits architecture could be big or little endian.
|
|
|
|
# They are handled in the same way.
|
2019-11-21 21:56:37 +00:00
|
|
|
ifeq ($(SUBARCH),ppc64)
|
2017-04-24 21:37:17 +03:00
|
|
|
error := $(error ppc64 big endian is not yet supported)
|
|
|
|
endif
|
|
|
|
|
|
|
|
#
|
|
|
|
# Architecture specific options.
|
2016-02-15 15:26:55 +03:00
|
|
|
ifeq ($(ARCH),arm)
|
2019-11-21 21:56:37 +00:00
|
|
|
ARMV := $(shell echo $(SUBARCH) | sed -nr 's/armv([[:digit:]]).*/\1/p; t; i7')
|
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
|
|
|
|
2019-11-04 08:56:15 +01:00
|
|
|
ifeq ($(ARMV),8)
|
|
|
|
# Running 'setarch linux32 uname -m' returns armv8l on travis aarch64.
|
|
|
|
# This tells CRIU to handle armv8l just as armv7hf. Right now this is
|
|
|
|
# only used for compile testing. No further verification of armv8l exists.
|
|
|
|
USERCFLAGS += -march=armv7-a
|
|
|
|
ARMV := 7
|
|
|
|
endif
|
|
|
|
|
|
|
|
DEFINES := -DCONFIG_ARMV$(ARMV) -DCONFIG_VDSO_32
|
|
|
|
|
2016-02-15 15:26:55 +03:00
|
|
|
PROTOUFIX := y
|
2019-05-17 23:53:01 +01:00
|
|
|
# For simplicity - compile code in Arm mode without interwork.
|
|
|
|
# We could choose Thumb mode as default instead - but a dirty
|
|
|
|
# experiment shows that with 90Kb PIEs Thumb code doesn't save
|
|
|
|
# even one page. So, let's stick so far to Arm mode as it's more
|
|
|
|
# universal around all different Arm variations, until someone
|
|
|
|
# will find any use for Thumb mode. -dima
|
|
|
|
CFLAGS_PIE := -marm
|
2016-02-15 15:26:55 +03:00
|
|
|
endif
|
2013-01-22 22:53:24 +04:00
|
|
|
|
2016-12-17 03:21:59 -08:00
|
|
|
ifeq ($(ARCH),aarch64)
|
2017-04-24 21:37:18 +03:00
|
|
|
DEFINES := -DCONFIG_AARCH64
|
2015-04-22 20:19:59 +03:00
|
|
|
endif
|
|
|
|
|
2016-02-24 17:21:31 +01:00
|
|
|
ifeq ($(ARCH),ppc64)
|
2017-04-24 21:37:18 +03:00
|
|
|
LDARCH := powerpc:common64
|
2016-04-12 20:52:00 +03:00
|
|
|
DEFINES := -DCONFIG_PPC64 -D__SANE_USERSPACE_TYPES__
|
2015-06-16 12:31:00 +03:00
|
|
|
endif
|
|
|
|
|
2017-04-24 21:37:18 +03:00
|
|
|
ifeq ($(ARCH),x86)
|
|
|
|
LDARCH := i386:x86-64
|
|
|
|
DEFINES := -DCONFIG_X86_64
|
|
|
|
endif
|
|
|
|
|
2017-07-21 19:26:09 +02:00
|
|
|
#
|
|
|
|
# CFLAGS_PIE:
|
|
|
|
#
|
2017-08-10 18:04:52 +02:00
|
|
|
# Ensure with -fno-optimize-sibling-calls that we don't create GOT
|
2017-07-21 19:26:09 +02:00
|
|
|
# (Global Offset Table) relocations with gcc compilers that don't have
|
|
|
|
# commit "S/390: Fix 64 bit sibcall".
|
2017-06-30 20:31:43 +02:00
|
|
|
ifeq ($(ARCH),s390)
|
|
|
|
ARCH := s390
|
|
|
|
DEFINES := -DCONFIG_S390
|
2017-08-10 18:04:52 +02:00
|
|
|
CFLAGS_PIE := -fno-optimize-sibling-calls
|
2017-06-30 20:31:43 +02:00
|
|
|
endif
|
2019-05-17 23:53:07 +01:00
|
|
|
|
|
|
|
CFLAGS_PIE += -DCR_NOGLIBC
|
2017-07-21 19:26:09 +02:00
|
|
|
export CFLAGS_PIE
|
2017-06-30 20:31:43 +02:00
|
|
|
|
2019-11-21 21:56:34 +00:00
|
|
|
LDARCH ?= $(ARCH)
|
2019-05-29 17:15:15 +01:00
|
|
|
export LDARCH
|
2017-04-24 21:37:19 +03:00
|
|
|
export PROTOUFIX DEFINES
|
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
|
|
|
|
2019-12-21 18:08:23 +00:00
|
|
|
WARNINGS := -Wall -Wformat-security -Wdeclaration-after-statement
|
2012-11-22 18:54:21 +04:00
|
|
|
|
2018-03-02 00:49:12 +03:00
|
|
|
CFLAGS-GCOV := --coverage -fno-exceptions -fno-inline -fprofile-update=atomic
|
2016-02-25 11:41:00 +03:00
|
|
|
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
|
|
|
|
|
2019-05-17 23:53:02 +01:00
|
|
|
AFLAGS += -D__ASSEMBLY__
|
2017-04-24 21:37:19 +03:00
|
|
|
CFLAGS += $(USERCFLAGS) $(WARNINGS) $(DEFINES) -iquote include/
|
|
|
|
HOSTCFLAGS += $(WARNINGS) $(DEFINES) -iquote include/
|
2019-05-17 23:53:02 +01:00
|
|
|
export AFLAGS CFLAGS USERCLFAGS HOSTCFLAGS
|
2013-02-15 23:40:33 +04:00
|
|
|
|
2016-10-05 22:08:00 +03:00
|
|
|
# Default target
|
2018-05-16 06:20:24 +00:00
|
|
|
all: criu lib crit
|
2016-10-05 22:08:00 +03:00
|
|
|
.PHONY: all
|
|
|
|
|
2016-04-14 14:01:01 +03:00
|
|
|
#
|
|
|
|
# Version headers.
|
|
|
|
include Makefile.versions
|
|
|
|
|
2017-02-22 15:15:45 -08:00
|
|
|
VERSION_HEADER := criu/include/version.h
|
2016-04-14 14:01:01 +03:00
|
|
|
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.
|
2017-07-19 21:14:24 +03:00
|
|
|
export CONFIG_HEADER := include/common/config.h
|
2017-04-24 15:51:47 +03:00
|
|
|
ifeq ($(filter tags etags cscope clean mrproper,$(MAKECMDGOALS)),)
|
2017-02-22 15:15:45 -08:00
|
|
|
include Makefile.config
|
2016-09-23 17:20:32 +03:00
|
|
|
else
|
|
|
|
# To clean all files, enable make/build options here
|
|
|
|
export CONFIG_COMPAT := y
|
2019-03-31 12:05:22 +01:00
|
|
|
export CONFIG_GNUTLS := 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
|
|
|
|
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
|
2017-02-22 15:15:49 -08:00
|
|
|
soccr/Makefile: ;
|
2017-07-19 21:14:24 +03:00
|
|
|
soccr/%: $(CONFIG_HEADER) .FORCE
|
2016-08-05 14:49:22 +03:00
|
|
|
$(Q) $(MAKE) $(build)=soccr $@
|
2017-07-19 21:14:24 +03:00
|
|
|
soccr/built-in.o: $(CONFIG_HEADER) .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.
|
2017-02-22 15:15:49 -08:00
|
|
|
criu/Makefile: ;
|
|
|
|
criu/Makefile.packages: ;
|
|
|
|
criu/Makefile.crtools: ;
|
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
|
|
|
|
2018-05-16 06:20:24 +00:00
|
|
|
crit/Makefile: ;
|
|
|
|
crit/%: criu .FORCE
|
|
|
|
$(Q) $(MAKE) $(build)=crit $@
|
|
|
|
crit: criu
|
|
|
|
$(Q) $(MAKE) $(build)=crit all
|
|
|
|
.PHONY: crit
|
|
|
|
|
|
|
|
|
2016-02-15 15:26:55 +03:00
|
|
|
#
|
2018-05-16 06:20:24 +00:00
|
|
|
# Libraries next once crit it ready
|
2016-02-15 15:26:55 +03:00
|
|
|
# (we might generate headers and such
|
|
|
|
# when building criu itself).
|
2017-02-22 15:15:49 -08:00
|
|
|
lib/Makefile: ;
|
2018-05-16 06:20:24 +00:00
|
|
|
lib/%: crit .FORCE
|
2017-02-22 15:15:42 -08:00
|
|
|
$(Q) $(MAKE) $(build)=lib $@
|
2018-05-16 06:20:24 +00:00
|
|
|
lib: crit
|
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
|
|
|
|
2017-02-22 15:15:47 -08:00
|
|
|
clean mrproper:
|
2016-03-18 13:09:33 +03:00
|
|
|
$(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 $@
|
2018-05-16 06:20:24 +00:00
|
|
|
$(Q) $(MAKE) $(build)=crit $@
|
2017-02-22 15:15:47 -08:00
|
|
|
.PHONY: clean mrproper
|
2016-03-18 13:09:33 +03:00
|
|
|
|
2017-02-22 15:15:47 -08:00
|
|
|
clean-top:
|
|
|
|
$(Q) $(MAKE) -C Documentation clean
|
|
|
|
$(Q) $(MAKE) $(build)=test/compel clean
|
|
|
|
$(Q) $(RM) .gitid
|
|
|
|
.PHONY: clean-top
|
|
|
|
|
|
|
|
clean: clean-top
|
|
|
|
|
|
|
|
mrproper-top: clean-top
|
2016-09-26 16:05:43 +03:00
|
|
|
$(Q) $(RM) $(CONFIG_HEADER)
|
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
|
2017-02-22 15:15:47 -08:00
|
|
|
.PHONY: mrproper-top
|
|
|
|
|
|
|
|
mrproper: mrproper-top
|
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
|
2018-04-19 04:22:55 +01:00
|
|
|
$(Q) $(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
|
2018-04-19 04:22:55 +01:00
|
|
|
$(Q) $(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 > $@
|
2017-02-22 15:15:48 -08:00
|
|
|
dist tar: criu-$(tar-name).tar.bz2 ;
|
2016-02-15 15:26:55 +03:00
|
|
|
.PHONY: dist tar
|
2012-02-14 03:10:29 +04:00
|
|
|
|
2017-06-27 12:51:02 +03:00
|
|
|
TAGS_FILES_REGEXP := . -name '*.[hcS]' ! -path './.*' \( ! -path './test/*' -o -path './test/zdtm/lib/*' \)
|
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
|
2017-06-27 12:51:02 +03:00
|
|
|
$(Q) $(FIND) $(TAGS_FILES_REGEXP) -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
|
2017-06-27 12:51:02 +03:00
|
|
|
$(Q) $(FIND) $(TAGS_FILES_REGEXP) -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, $@)
|
2017-06-27 12:51:02 +03:00
|
|
|
$(Q) $(FIND) $(TAGS_FILES_REGEXP) ! -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:
|
2019-06-27 14:18:38 +03:00
|
|
|
flake8 --version
|
2016-06-03 05:33:00 +03:00
|
|
|
flake8 --config=scripts/flake8.cfg test/zdtm.py
|
2018-09-20 22:22:32 +00:00
|
|
|
flake8 --config=scripts/flake8.cfg test/inhfd/*.py
|
2018-08-01 16:31:21 +00:00
|
|
|
flake8 --config=scripts/flake8.cfg test/others/rpc/config_file.py
|
2019-07-01 17:43:56 +03:00
|
|
|
flake8 --config=scripts/flake8.cfg lib/py/images/pb2dict.py
|
2016-06-03 05:33:00 +03:00
|
|
|
|
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
|