[CRIU] [PATCH]v2 criu: Initial skeleton for criu library
Kупреев Руслан
kupruser at gmail.com
Thu Jul 18 13:28:29 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 --------------
commit a2c7e5209f6b9850404831f988e0a2069ed93f68
Author: Ruslan Kupreev <kupruser at gmail.com>
Date: Thu Jul 18 20:19:38 2013 +0300
Add target lib to Makefile for criu library.
Created directory lib and add there Makefile and criu.c - skelettons for criu library.
diff --git a/Makefile b/Makefile
index aabfded..9a0bdf2 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:
@@ -156,7 +160,7 @@ $(ARCH_DIR)/vdso-pie.o: pie
$(Q) $(MAKE) $(build)=pie $(ARCH_DIR)/vdso-pie.o
PROGRAM-BUILTINS += $(ARCH_DIR)/vdso-pie.o
-$(PROGRAM): $(SYSCALL-LIB) $(ARCH-LIB) $(PROGRAM-BUILTINS)
+$(PROGRAM): $(SYSCALL-LIB) $(ARCH-LIB) $(PROGRAM-BUILTINS) $(CRIU-LIB)
$(E) " LINK " $@
$(Q) $(CC) $(CFLAGS) $^ $(LIBS) $(LDFLAGS) -o $@
@@ -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