2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-22 01:51:51 +00:00
criu/Makefile

228 lines
5.0 KiB
Makefile
Raw Normal View History

#
# Import the build engine first
__nmk_dir=$(CURDIR)/scripts/nmk/scripts/
export __nmk_dir
include $(__nmk_dir)/include.mk
include $(__nmk_dir)/macro.mk
#
# Import tools versions early
# so subsequents may refer them.
include Makefile.versions
#
# To build host helpers.
HOSTCC ?= gcc
HOSTLD ?= ld
export HOSTCC HOSTLD
CFLAGS += $(USERCFLAGS)
export CFLAGS
HOSTCFLAGS ?= $(CFLAGS)
export HOSTCFLAGS
#
# Where we live.
SRC_DIR := $(CURDIR)
export SRC_DIR
#
# General architecture specific options.
UNAME-M := $(shell uname -m)
export UNAME-M
ifeq ($(ARCH),arm)
ARMV := $(shell echo $(UNAME-M) | sed -nr 's/armv([[:digit:]]).*/\1/p; t; i7')
DEFINES := -DCONFIG_ARMV$(ARMV)
USERCFLAGS += -Wa,-mimplicit-it=always
ifeq ($(ARMV),6)
USERCFLAGS += -march=armv6
endif
ifeq ($(ARMV),7)
USERCFLAGS += -march=armv7-a
endif
PROTOUFIX := y
endif
ifeq ($(ARCH),x86)
DEFINES := -DCONFIG_X86_64
endif
ifeq ($(ARCH),aarch64)
VDSO := y
endif
arch/ppc64: Add PowerPC 64 LE support This patch initiates the ppc64le architecture support in CRIU. Note that ppc64 (Big Endian) architecture is not yet supported since there are still several issues to address with this architecture. However, in the long term, the two architectures should be addressed using the almost the same code, so sharing the ppc64 directory. Major ppc64 issues: Loader is not involved when the parasite code is loaded. So no relocation is done for the parasite code. As a consequence r2 must be set manually when entering the parasite code, and GOT is not filled. Furthermore, the r2 fixup code at the services's global address which has not been fixed by the loader should not be run. Branching at local address, as the assembly code does is jumping over it. On the long term, relocation should be done when loading the parasite code. We are introducing 2 trampolines for the 2 entry points of the restorer blob. These entry points are dealing with r2. These ppc64 specific entry points are overwritting the standard one in sigreturn_restore() from cr-restore.c. Instead of using #ifdef, we may introduce a per arch wrapper here. CRIU needs 2 kernel patches to be run powerpc which are not yet upstream: - Tracking the vDSO remapping - Enabling the kcmp system call on powerpc Feature not yet supported: - Altivec registers C/R - VSX registers C/R - TM support - all lot of things I missed.. Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
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.
#
ifeq ($(ARCH),powerpc)
ifeq ($(UNAME-M),ppc64)
error := $(error ppc64 big endian not yet supported)
endif
DEFINES := -DCONFIG_PPC64
endif
export PROTOUFIX DEFINES USERCFLAGS
#
# Independent options for all tools.
DEFINES += -D_FILE_OFFSET_BITS=64
DEFINES += -D_GNU_SOURCE
CFLAGS += $(USERCFLAGS)
WARNINGS := -Wall
ifneq ($(WERROR),0)
WARNINGS += -Werror
endif
ifeq ($(DEBUG),1)
DEFINES += -DCR_DEBUG
CFLAGS += -O0 -ggdb3
else
CFLAGS += -O2 -g
endif
CFLAGS += $(WARNINGS) $(DEFINES)
#
# Protobuf images first, they are not depending
# on anything else.
$(eval $(call gen-built-in,images))
PHONY += images
#
# 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.
criu/%: images/built-in.o
$(Q) $(MAKE) -C criu $@
criu: images/built-in.o
$(Q) $(MAKE) -C criu all
criu/criu: criu
PHONY += criu
#
# Libraries next once criu it ready
# (we might generate headers and such
# when building criu itself).
lib/%: criu
$(Q) $(MAKE) -C lib $@
lib: criu
$(Q) $(MAKE) -C lib all
PHONY += lib
all: criu lib
PHONY += all
clean-built:
$(Q) $(MAKE) $(build)=images clean
$(Q) $(MAKE) -C criu clean
$(Q) $(MAKE) -C lib clean
$(Q) $(MAKE) -C Documentation clean
PHONY += clean-built
clean: clean-built
$(call msg-clean, criu)
PHONY += clean
#
# Non-CRIU stuff.
#
docs:
$(Q) $(MAKE) -s -C Documentation all
PHONY += docs
zdtm: all
$(Q) $(MAKE) -C test/zdtm all
PHONY += zdtm
test: zdtm
$(Q) $(MAKE) -C test
PHONY += test
tar-name := $(shell git tag -l v$(CRIU_VERSION))
ifeq ($(tar-name),)
tar-name := $(shell git describe)
endif
criu-$(tar-name).tar.bz2:
git archive --format tar --prefix 'criu-$(tar-name)/' $(tar-name) | bzip2 > $@
dist tar: criu-$(tar-name).tar.bz2
@true
.PHONY: dist tar
tags:
$(call msg-gen, $@)
$(Q) $(RM) tags
$(Q) $(FIND) . -name '*.[hcS]' ! -path './.*' ! -path './test/*' -print | xargs ctags -a
PHONY += tags
cscope:
$(call msg-gen, $@)
$(Q) $(FIND) . -name '*.[hcS]' ! -path './.*' ! -path './test/*' ! -type l -print > cscope.files
$(Q) $(CSCOPE) -bkqu
PHONY += cscope
gcov:
$(E) " GCOV"
$(Q) test -d gcov || mkdir gcov && \
cp *.{gcno,c} test/`pwd`/ && \
geninfo --output-filename gcov/crtools.h.info --no-recursion . && \
geninfo --output-filename gcov/crtools.ns.info --no-recursion test/`pwd`/ && \
sed -i 's#/test/`pwd`##' gcov/crtools.ns.info && \
cd gcov && \
lcov --rc lcov_branch_coverage=1 --add-tracefile crtools.h.info \
--add-tracefile crtools.ns.info --output-file criu.info && \
genhtml --rc lcov_branch_coverage=1 --output-directory html criu.info
@echo "Code coverage report is in `pwd`/gcov/html/ directory."
PHONY += gcov
docker-build:
$(MAKE) -C scripts/build/ x86_64
PHONY += docker-build
docker-test:
docker run --rm -it --privileged criu-x86_64 ./test/zdtm.sh -C -x tcp6 -x tcpbuf6 -x static/rtc -x cgroup -x mountpoint
PHONY += docker-test
help:
@echo ' Targets:'
@echo ' all - Build all [*] targets'
@echo ' * criu - Build criu'
@echo ' zdtm - Build zdtm test-suite'
@echo ' docs - Build documentation'
@echo ' install - Install binary and man page'
@echo ' dist - Create a source tarball'
@echo ' clean - Clean everything'
@echo ' tags - Generate tags file (ctags)'
@echo ' cscope - Generate cscope database'
@echo ' rebuild - Force-rebuild of [*] targets'
@echo ' test - Run zdtm test-suite'
@echo ' gcov - Make code coverage report'
PHONY += help
include Makefile.install
.PHONY: $(PHONY)
.DEFAULT_GOAL := all
#
# Optional local include.
-include Makefile.local