forked from nktks/protobuf-elixir
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
25 lines (19 loc) · 879 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
ndef = $(if $(value $(1)),,$(error $(1) not set))
protoc-gen-elixir:
mix escript.build .
clean:
rm protoc-gen-elixir
# PROTO_LIB should be your local path to https://github.com/google/protobuf/tree/master/src/google/protobuf
gen_google_proto: protoc-gen-elixir
$(call ndef,PROTO_LIB)
protoc -I $(PROTO_LIB) --elixir_out=lib/google --plugin=./protoc-gen-elixir $(PROTO_LIB)/descriptor.proto
protoc -I $(PROTO_LIB) --elixir_out=lib/google --plugin=./protoc-gen-elixir $(PROTO_LIB)/compiler/plugin.proto
# it's a hack until extension is implemented
# 1047 is allocated to this project by Google
sed -i "" '/field :ruby_package, 45/a \
\ \ field :elixir_module_prefix, 1047, optional: true, type: :string\
' lib/google/descriptor.pb.ex
sed -i "" '/ :ruby_package,/a \
\ \ \ \ :elixir_module_prefix,\
' lib/google/descriptor.pb.ex
.PHONY: clean gen_google_proto