Commit da0eb148 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

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: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent f07970ae
......@@ -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
......
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
#
# Python bindings.
lib-py:
$(call msg-gen, $@)
$(Q) $(MAKE) -C py/images all
PHONY += lib-py
.SECONDARY:
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 $@
ifneq ($(MAKECMDGOALS),clean)
incdeps := y
endif
all: $(PHONY)
@true
PHONY += all
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
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