[CRIU] [PATCH] protobuf: build and link of facility introduced
Kinsbursky Stanislav
skinsbursky at openvz.org
Tue May 29 12:20:34 EDT 2012
From: Stanislav Kinsbursky <skinsbursky at openvz.org>
Signed-off-by: Stanislav Kinsbursky <skinsbursky at openvz.org>
---
Makefile | 14 ++++++++++----
protobuf/Makefile | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
protobuf/README | 3 +++
protobuf/tmp.proto | 3 +++
4 files changed, 67 insertions(+), 4 deletions(-)
create mode 100644 protobuf/Makefile
create mode 100644 protobuf/README
create mode 100644 protobuf/tmp.proto
-------------- next part --------------
diff --git a/Makefile b/Makefile
index 13ecd34..15ceba5 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@ include Makefile.inc
CFLAGS += -I./include
CFLAGS += -O0 -ggdb3
-LIBS += -lrt -lpthread
+LIBS += -lrt -lpthread -lprotobuf-c
DEFINES += -D_FILE_OFFSET_BITS=64
DEFINES += -D_GNU_SOURCE
@@ -56,19 +56,24 @@ OBJS += eventpoll.o
OBJS += mount.o
OBJS += inotify.o
+PROTOBUF-LIB = protobuf/protobuf-lib.o
+
DEPS := $(patsubst %.o,%.d,$(OBJS))
include Makefile.syscall
include Makefile.pie
.PHONY: all test-legacy zdtm test rebuild clean distclean tags cscope \
- docs help pie
+ docs help pie protobuf
-all: pie
+all: protobuf pie
$(Q) $(MAKE) $(PROGRAM)
pie: $(PIE-GEN)
+protobuf:
+ $(Q) $(MAKE) -C protobuf/ all
+
%.o: %.c
$(E) " CC " $@
$(Q) $(CC) -c $(CFLAGS) $< -o $@
@@ -85,7 +90,7 @@ pie: $(PIE-GEN)
$(E) " DEP " $@
$(Q) $(CC) -M -MT $@ -MT $(patsubst %.d,%.o,$@) $(CFLAGS) $< -o $@
-$(PROGRAM): $(OBJS) $(LIBS) $(SYS-OBJ)
+$(PROGRAM): $(OBJS) $(LIBS) $(SYS-OBJ) $(PROTOBUF-LIB)
$(E) " LINK " $@
$(Q) $(CC) $(CFLAGS) $^ -o $@
@@ -114,6 +119,7 @@ clean: cleanpie cleansyscall
$(Q) $(RM) -f ./*.bin
$(Q) $(RM) -f ./$(PROGRAM)
$(Q) $(RM) -rf ./test/dump/
+ $(Q) $(MAKE) -C protobuf/ clean
$(Q) $(MAKE) -C test/legacy clean
$(Q) $(MAKE) -C test/zdtm cleandep
$(Q) $(MAKE) -C test/zdtm clean
diff --git a/protobuf/Makefile b/protobuf/Makefile
new file mode 100644
index 0000000..a18f300
--- /dev/null
+++ b/protobuf/Makefile
@@ -0,0 +1,51 @@
+-include ../Makefile.inc
+
+CFLAGS += -I./include
+CFLAGS += -O0 -ggdb3
+
+DEFINES += -D_FILE_OFFSET_BITS=64
+DEFINES += -D_GNU_SOURCE
+
+ifneq ($(WERROR),0)
+ WARNINGS += -Werror
+endif
+
+ifeq ($(DEBUG),1)
+ DEFINES += -DCR_DEBUG
+endif
+
+WARNINGS += -Wall
+CFLAGS += $(WARNINGS) $(DEFINES)
+
+LIBRARY := protobuf-lib.o
+
+PROTO_FILES += tmp.proto
+
+HDRS := $(patsubst %.proto,%.pb-c.h,$(PROTO_FILES))
+SRCS := $(patsubst %.proto,%.pb-c.c,$(PROTO_FILES))
+OBJS := $(patsubst %.c,%.o,$(SRCS))
+
+.DEFAULT_GOAL := all
+
+%.pb-c.c: %.proto
+ $(E) " PROTOBUF "$@
+ $(Q) protoc-c --c_out=./ $<
+
+%.o: %.c
+ $(E) " CC "$@
+ $(Q) $(CC) -c $(CFLAGS) $< -o $@
+
+.SECONDARY:
+
+$(LIBRARY): $(OBJS)
+ $(E) " LINK "$@
+ $(Q) ld -r -o $@ $(OBJS)
+
+.PHONY: all clean
+
+all: $(LIBRARY)
+
+clean:
+ $(E) " CLEAN"
+ $(Q) rm -f $(SRCS) $(HDRS) $(OBJS) $(LIBRARY)
+
diff --git a/protobuf/README b/protobuf/README
new file mode 100644
index 0000000..ae6eb1c
--- /dev/null
+++ b/protobuf/README
@@ -0,0 +1,3 @@
+Protobuf depends on packages:
+"protobuf-c"
+"protobuf-c-devel"
diff --git a/protobuf/tmp.proto b/protobuf/tmp.proto
new file mode 100644
index 0000000..52d6106
--- /dev/null
+++ b/protobuf/tmp.proto
@@ -0,0 +1,3 @@
+message tmp
+{
+}
More information about the CRIU
mailing list