[CRIU] [PATCH 01/12] soccr: Wire into builder (v2)

Pavel Emelyanov xemul at virtuozzo.com
Fri Aug 5 07:58:52 PDT 2016


For now build the .a library not to produce criu wrappers.
Next version should include the .so library as well.

Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
 Makefile                     | 14 +++++++++++++-
 criu/Makefile.packages       |  2 +-
 criu/sk-tcp.c                |  2 ++
 scripts/nmk/scripts/tools.mk |  1 +
 soccr/Makefile               |  2 ++
 soccr/soccr.c                |  1 +
 soccr/soccr.h                |  3 +++
 8 files changed, 23 insertions(+), 2 deletions(-)
 create mode 100644 soccr/Makefile
 create mode 100644 soccr/soccr.c
 create mode 100644 soccr/soccr.h

diff --git a/Makefile b/Makefile
index 271c39e..561e6a3 100644
--- a/Makefile
+++ b/Makefile
@@ -189,6 +189,16 @@ test/compel/%: .FORCE
 	$(Q) $(MAKE) $(build)=compel $@
 
 #
+# Next the socket CR library
+#
+SOCCR_A := soccr/libsoccr.a
+soccr/%: .FORCE
+	$(Q) $(MAKE) $(build)=soccr $@
+soccr/built-in.o: .FORCE
+	$(Q) $(MAKE) $(build)=soccr all
+$(SOCCR_A): |soccr/built-in.o
+
+#
 # CRIU building done in own directory
 # with slightly different rules so we
 # can't use nmk engine directly (we
@@ -198,7 +208,7 @@ test/compel/%: .FORCE
 # the nmk so we can reuse it there.
 criu/%: images/built-in.o compel/compel $(VERSION_HEADER) .FORCE
 	$(Q) $(MAKE) $(build)=criu $@
-criu: images/built-in.o compel/compel $(VERSION_HEADER)
+criu: images/built-in.o compel/compel $(SOCCR_A) $(VERSION_HEADER)
 	$(Q) $(MAKE) $(build)=criu all
 .PHONY: criu
 
@@ -227,6 +237,7 @@ clean: subclean
 	$(Q) $(MAKE) $(build)=images $@
 	$(Q) $(MAKE) $(build)=compel $@
 	$(Q) $(MAKE) $(build)=criu $@
+	$(Q) $(MAKE) $(build)=soccr clean
 .PHONY: clean
 
 # mrproper depends on clean in nmk
@@ -234,6 +245,7 @@ mrproper: subclean
 	$(Q) $(MAKE) $(build)=images $@
 	$(Q) $(MAKE) $(build)=compel $@
 	$(Q) $(MAKE) $(build)=criu $@
+	$(Q) $(MAKE) $(build)=soccr clean
 	$(Q) $(RM) $(VERSION_HEADER)
 	$(Q) $(RM) cscope.*
 	$(Q) $(RM) tags TAGS
diff --git a/criu/Makefile.packages b/criu/Makefile.packages
index 1b4eb1d..9173a2b 100644
--- a/criu/Makefile.packages
+++ b/criu/Makefile.packages
@@ -19,7 +19,7 @@ REQ-DEB-PKG-NAMES	+= libcap-dev
 
 REQ-DEB-PKG-TEST-NAMES  += libaio-dev
 
-export LIBS		:= -lrt -lpthread -lprotobuf-c -ldl -lnl-3
+export LIBS		:= -lrt -lpthread -lprotobuf-c -ldl -lnl-3 -lsoccr -Lsoccr/
 
 #
 # Make sure all required libs are installed
diff --git a/criu/sk-tcp.c b/criu/sk-tcp.c
index ae1d8a2..8168138 100644
--- a/criu/sk-tcp.c
+++ b/criu/sk-tcp.c
@@ -8,6 +8,8 @@
 #include <sched.h>
 #include <netinet/in.h>
 
+#include "../soccr/soccr.h"
+
 #include "cr_options.h"
 #include "util.h"
 #include "list.h"
diff --git a/scripts/nmk/scripts/tools.mk b/scripts/nmk/scripts/tools.mk
index 0538dde..b1d260c 100644
--- a/scripts/nmk/scripts/tools.mk
+++ b/scripts/nmk/scripts/tools.mk
@@ -3,6 +3,7 @@ ifndef ____nmk_defined__tools
 #
 # System tools shorthands
 RM		:= rm -f
+CP		:= cp
 LD		:= $(CROSS_COMPILE)ld
 CC		:= $(CROSS_COMPILE)gcc
 CPP		:= $(CC) -E
diff --git a/soccr/Makefile b/soccr/Makefile
new file mode 100644
index 0000000..dd37eb1
--- /dev/null
+++ b/soccr/Makefile
@@ -0,0 +1,2 @@
+lib-name := libsoccr.a
+lib-y += soccr.o
diff --git a/soccr/soccr.c b/soccr/soccr.c
new file mode 100644
index 0000000..f33c50c
--- /dev/null
+++ b/soccr/soccr.c
@@ -0,0 +1 @@
+#include "soccr.h"
diff --git a/soccr/soccr.h b/soccr/soccr.h
new file mode 100644
index 0000000..eaae1a2
--- /dev/null
+++ b/soccr/soccr.h
@@ -0,0 +1,3 @@
+#ifndef __LIBSOCCR_H__
+#define __LIBSOCCR_H__
+#endif
-- 
2.5.0



More information about the CRIU mailing list