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

Submitted by Pavel Emelianov on Aug. 5, 2016, 2:58 p.m.

Details

Message ID 57A4A9AC.4040305@virtuozzo.com
State Rejected
Series "Introduce library for socket C/R"
Headers show

Commit Message

Pavel Emelianov Aug. 5, 2016, 2:58 p.m.
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@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

Patch hide | download patch | download mbox

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

Comments

Dmitry Safonov Aug. 5, 2016, 3:32 p.m.
On 08/05/2016 05:58 PM, Pavel Emelyanov wrote:
> 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@virtuozzo.com>
> ---
[...]
> 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

Don't have any objection about the patch, only small nit:
It's handy if changes for /scripts/nmk/* are in the separate patches.
AFAIK, Cyrill handle his mirror of nmk build engine for other projects,
so applying separate patches on NMK is easier. Especially, if they don't
break something in CRIU and can be applied separately.

Thanks, just dropping a note.
Pavel Emelianov Aug. 5, 2016, 3:55 p.m.
On 08/05/2016 06:32 PM, Dmitry Safonov wrote:
> On 08/05/2016 05:58 PM, Pavel Emelyanov wrote:
>> 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@virtuozzo.com>
>> ---
> [...]
>> 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
> 
> Don't have any objection about the patch, only small nit:

Ocuh... This hunk run away from v1.5 of this patch :) I'll just drop one.

> It's handy if changes for /scripts/nmk/* are in the separate patches.
> AFAIK, Cyrill handle his mirror of nmk build engine for other projects,
> so applying separate patches on NMK is easier. Especially, if they don't
> break something in CRIU and can be applied separately.
> 
> Thanks, just dropping a note.
> .
>