From 1826db5936c31e4d9b4d53669a1b30057a904ed3 Mon Sep 17 00:00:00 2001 From: dsavvinov Date: Tue, 9 Aug 2016 12:14:37 +0300 Subject: [PATCH] Protobuf: added Makefile for building JAR and protoc-executable --- proto/Makefile | 47 ++++++++++++++++++++++++++++++++++++++ proto/runtime/build.gradle | 1 + 2 files changed, 48 insertions(+) create mode 100644 proto/Makefile diff --git a/proto/Makefile b/proto/Makefile new file mode 100644 index 00000000000..95db3fcd43e --- /dev/null +++ b/proto/Makefile @@ -0,0 +1,47 @@ +CXX = g++ +CXXFLAGS = -O2 -std=c++11 +LDFLAGS = -lprotoc -lprotobuf + +BUILDDIR = build +EXE = $(BUILDDIR)/protoc +JAR = $(BUILDDIR)/protokot-runtime.jar + +# C++ part +PROTOC_DIR = compiler/google/src/google/protobuf/compiler/kotlin +PROTOC_EXE = $(PROTOC_DIR)/protoc + +# Kotlin part +RUNTIME_DIR = runtime +RUNTIME_JAR = $(RUNTIME_DIR)/build/libs/protokot-runtime.jar + +all: $(EXE) $(JAR) + +# Place protoc* into build directory +$(EXE): $(BUILDDIR) $(PROTOC_EXE) + cp $(PROTOC_EXE) $(EXE) + +# Build Protobuf Compiler via delegating call to another Makefile +$(PROTOC_EXE): + $(MAKE) -C $(PROTOC_DIR) + +# Place ProtoKot Runtime JAR into build directory +$(JAR): $(BUILDDIR) $(RUNTIME_JAR) + cp $(RUNTIME_JAR) $(JAR) + +# Build ProtoKot Runtime via delegating call to Gradle Script +$(RUNTIME_JAR): + cd $(RUNTIME_DIR); gradle build + +# Create auxillary directories +$(BINDIR): + mkdir -p $(BINDIR) + +$(BUILDDIR): + mkdir -p $(BUILDDIR) + +clean: + $(MAKE) -C $(PROTOC_DIR) clean + cd $(RUNTIME_DIR); gradle clean + rm -rf $(BUILDDIR) + +.PHONY: clean all generate test diff --git a/proto/runtime/build.gradle b/proto/runtime/build.gradle index ac3f245de65..02ec943605d 100644 --- a/proto/runtime/build.gradle +++ b/proto/runtime/build.gradle @@ -24,5 +24,6 @@ dependencies { } jar { + archiveName = "protokot-runtime.jar" from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } } \ No newline at end of file