[CRIU] [PATCH]v3 criu: Initial skeleton for criu library

Kупреев Руслан kupruser at gmail.com
Fri Jul 19 09:46:26 EDT 2013


Hello all!

I make an initial skeleton for CRIU library. It will be used to add 
different useful functionality.


Signed-off-by: Ruslan Kupreev kupruser at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvz.org/pipermail/criu/attachments/20130719/8224ce1c/attachment.html>
-------------- next part --------------
commit a92954013f801c88405bcb84768d3074acc2fec6
Author: Ruslan Kupreev <kupruser at gmail.com>
Date:   Fri Jul 19 16:43:28 2013 +0300

      Added target lib to Makefile.
      Added directory lib that contains Makefile and criu.c - skeleton for criu library.

diff --git a/Makefile b/Makefile
index aabfded..549434c 100644
--- a/Makefile
+++ b/Makefile
@@ -101,6 +101,7 @@ endif
 CFLAGS		+= $(WARNINGS) $(DEFINES)
 SYSCALL-LIB	:= arch/$(ARCH)/syscalls.built-in.o
 ARCH-LIB	:= arch/$(ARCH)/crtools.built-in.o
+CRIU-LIB	:= lib/libcriu.so
 
 export CC MAKE CFLAGS LIBS ARCH DEFINES MAKEFLAGS
 export SRC_DIR SYSCALL-LIB SH RM ARCH_DIR OBJCOPY LDARCH LD
@@ -119,15 +120,18 @@ build-crtools := -r -R -f scripts/Makefile.build makefile=Makefile.crtools obj
 PROGRAM		:= criu
 
 .PHONY: all zdtm test rebuild clean distclean tags cscope	\
-	docs help pie protobuf arch/$(ARCH) clean-built
+	docs help pie protobuf arch/$(ARCH) clean-built lib
 
 ifeq ($(GCOV),1)
 %.o $(PROGRAM): override CFLAGS += --coverage
 endif
 
-all: config pie $(VERSION_HEADER)
+all: config pie $(VERSION_HEADER) lib
 	$(Q) $(MAKE) $(PROGRAM)
 
+lib: $(VERSION_HEADER)	
+	$(Q) $(MAKE) -C lib all
+
 protobuf/%::
 	$(Q) $(MAKE) $(build)=protobuf $@
 protobuf:
@@ -175,6 +179,7 @@ clean-built:
 	$(Q) $(MAKE) -C Documentation clean
 	$(Q) $(RM) ./include/config.h
 	$(Q) $(RM) ./$(PROGRAM)
+	$(Q) $(MAKE) -C lib clean
 
 rebuild: clean-built
 	$(E) "  FORCE-REBUILD"
diff --git a/lib/Makefile b/lib/Makefile
new file mode 100644
index 0000000..bdbe1c6
--- /dev/null
+++ b/lib/Makefile
@@ -0,0 +1,13 @@
+.PHONY: all clean
+
+all: libcriu.so
+
+libcriu.so: criu.o
+	$(Q) $(CC) $(CFLAGS) -shared -o $@ criu.o
+
+criu.o: 
+	$(Q) $(CC) $(CFLAGS) -fPIC -c criu.c -I ../include/
+
+clean:
+	$(Q) $(RM) -f *.o
+	$(Q) $(RM) -f *.so
diff --git a/lib/criu.c b/lib/criu.c
new file mode 100644
index 0000000..196d2dc
--- /dev/null
+++ b/lib/criu.c
@@ -0,0 +1,3 @@
+#include "version.h"
+
+const char* criu_lib_version = version;


More information about the CRIU mailing list