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

build: Move C and Python libraries into lib

Both CRIU library and CRIT python data are moved into
lib/c and lib/py.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
Cyrill Gorcunov 2016-02-15 15:26:53 +03:00 committed by Pavel Emelyanov
parent f07970ae7b
commit da0eb1483b
15 changed files with 61 additions and 18 deletions

View File

@ -162,7 +162,7 @@ CFLAGS += $(WARNINGS) $(DEFINES)
SYSCALL-LIB := $(ARCH_DIR)/syscalls.built-in.o
ARCH-LIB := $(ARCH_DIR)/crtools.built-in.o
CRIU-SO := libcriu
CRIU-LIB := lib/$(CRIU-SO).so
CRIU-LIB := lib/c/$(CRIU-SO).so
CRIU-INC := lib/criu.h include/criu-plugin.h include/criu-log.h protobuf/rpc.proto
ifeq ($(piegen-y),y)
piegen := pie/piegen/piegen
@ -225,9 +225,15 @@ built-in.o: $(VERSION_HEADER) pie
$(Q) $(MAKE) $(build-old-crtools)=. $@
lib/%:: $(VERSION_HEADER) config built-in.o
$(Q) $(MAKE) $(build-old)=lib $@
$(Q) $(MAKE) -C lib $@
lib: $(VERSION_HEADER) config built-in.o
$(Q) $(MAKE) $(build-old)=lib all
$(Q) $(MAKE) -C lib all
$(CRIU-LIB): lib
@true
crit: lib
@true
PROGRAM-BUILTINS += protobuf/built-in.o
PROGRAM-BUILTINS += built-in.o
@ -238,9 +244,6 @@ $(PROGRAM): $(ARCH-LIB) $(PROGRAM-BUILTINS)
$(E) " LINK " $@
$(Q) $(CC) $(CFLAGS) $^ $(LIBS) $(LDFLAGS) $(GMONLDOPT) -rdynamic -o $@
crit:
$(Q) $(MAKE) -C pycriu all
zdtm: all
$(Q) $(MAKE) -C test/zdtm all
@ -253,7 +256,7 @@ clean-built:
$(Q) $(MAKE) $(build-old)=protobuf clean
$(Q) $(MAKE) $(build-old)=pie/piegen clean
$(Q) $(MAKE) $(build-old)=pie clean
$(Q) $(MAKE) $(build-old)=lib clean
$(Q) $(MAKE) -C lib clean
$(Q) $(MAKE) $(build-old-crtools)=. clean
$(Q) $(MAKE) -C Documentation clean
$(Q) $(RM) ./include/config.h
@ -273,7 +276,6 @@ clean: clean-built
$(Q) $(RM) -r ./gcov
$(Q) $(RM) protobuf-desc-gen.h
$(Q) $(MAKE) -C test $@
$(Q) $(MAKE) -C pycriu $@
$(Q) $(RM) ./*.pyc
$(Q) $(RM) -r build
$(Q) $(RM) -r usr

View File

@ -1,14 +1,42 @@
lib-so += $(CRIU-SO)
obj-y += criu.o
obj-ext-src-y += protobuf/rpc.pb-c.o
include $(__nmk_dir)/include.mk
include $(__nmk_dir)/macro.mk
includes += -iquote $(obj)/../$(ARCH_DIR)/include -iquote $(obj)/../include -iquote $(obj)/.. -iquote $(obj)/../protobuf
cflags-y += $(includes) -fPIC -Wa,--noexecstack -fno-stack-protector
cflags-so += $(CFLAGS) -rdynamic -Wl,-soname,$(lib-so).so.$(VERSION_SO_MAJOR)
VERSION_SO_MAJOR := 1
VERSION_SO_MINOR := 0
CRIU_SO := libcriu.so
#
# C language bindings.
c/%:
$(call msg-gen, $@)
$(Q) $(MAKE) $(build)=c $@
c/built-in.o:
$(call msg-gen, $@)
$(Q) $(MAKE) $(build)=c all
ccflags-so += $(CFLAGS) -rdynamic -Wl,-soname,$(lib-so).so.$(VERSION_SO_MAJOR)
ldflags-so += -lprotobuf-c
c/$(CRIU_SO): c/built-in.o
$(call msg-link, $@)
$(Q) $(CC) -shared $(ccflags-so) -o $@ $^ $(ldflags-so) $(LDFLAGS)
lib-c: c/$(CRIU_SO)
PHONY += lib-c
.SECONDARY:
#
# Python bindings.
lib-py:
$(call msg-gen, $@)
$(Q) $(MAKE) -C py/images all
PHONY += lib-py
ifneq ($(MAKECMDGOALS),clean)
incdeps := y
endif
clean:
$(call msg-clean, lib-c)
$(Q) $(MAKE) $(build)=c $@
$(Q) $(RM) c/$(CRIU_SO)
$(call msg-clean, lib-py)
$(Q) $(MAKE) -C py/images $@
all: $(PHONY)
@true
PHONY += all

13
lib/c/Makefile Normal file
View File

@ -0,0 +1,13 @@
obj-y += criu.o
obj-y += $(SRC_DIR)/images/rpc.pb-c.o
ccflags-y += -iquote $(SRC_DIR)/crtools/$(ARCH_DIR)/include
ccflags-y += -iquote $(SRC_DIR)/crtools/include -iquote $(obj)/..
ccflags-y += -iquote $(SRC_DIR)/images
ccflags-y += -fPIC -Wa,--noexecstack -fno-stack-protector
#
# Remove once criu moved into proper place.
ccflags-y += -iquote $(SRC_DIR)/$(ARCH_DIR)/include
ccflags-y += -iquote $(SRC_DIR)/include -iquote $(obj)/..
ccflags-y += -iquote $(SRC_DIR)/images