forked from AeroNotix/ryeboy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
40 lines (31 loc) · 1004 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
PROTOBUF_DEFINITION=https://raw.githubusercontent.com/aphyr/riemann-java-client/master/src/main/proto/riemann/proto.proto
PROTOC=$(shell which protoc 2> /dev/null)
PROTOC_GEN_LISP=git://github.com/brown/protobuf.git
PLUGIN=$(shell which protoc-gen-lisp 2> /dev/null)
PROTO_OUTPUT=proto.lisp
ifeq ($(PLUGIN),)
PLUGIN_PATH=./bin/protoc-gen-lisp
else
PLUGIN_PATH=$(PLUGIN)
endif
LISP=sbcl
TEST_COMMAND='(asdf:test-system :ryeboy)'
sbcl_TEST_OPTS=--noinform --eval $(TEST_COMMAND) --quit
all: protobuf-compiler compile-proto
compile-proto: $(PROTO_OUTPUT)
$(PLUGIN_PATH):
@mkdir -p bin
@git clone $(PROTOC_GEN_LISP) /tmp/protobufs/ && \
cd /tmp/protobufs/protoc/lisp && \
make
@cp /tmp/protobufs/protoc/lisp/protoc-gen-lisp ./bin/ && \
rm -rf /tmp/protobufs/
protobuf-compiler: $(PLUGIN_PATH)
proto.proto:
wget $(PROTOBUF_DEFINITION)
proto.lisp: proto.proto
$(PROTOC) --plugin=$(PLUGIN_PATH) --proto_path=. --lisp_out=. $<
test:
$(LISP) $($(LISP)_TEST_OPTS)
.PHONY: \
protobuf-compiler