forked from uber-archive/cherami-thrift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
41 lines (30 loc) · 1.17 KB
/
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
41
.PHONY: bins clean
PROJECT_ROOT=github.com/uber/cherami-thrift
THRIFT_GENDIR=.generated
export PATH := $(GOPATH)/bin:$(PATH)
THRIFT_DIR = idl/cherami
THRIFT_SERVER_DIR = idl/cherami_server
THRIFT_SRCS = $(THRIFT_SERVER_DIR)/metadata.thrift \
$(THRIFT_SERVER_DIR)/controller.thrift \
$(THRIFT_SERVER_DIR)/admin.thrift \
$(THRIFT_SERVER_DIR)/store.thrift \
$(THRIFT_SERVER_DIR)/replicator.thrift \
$(THRIFT_DIR)/cherami.thrift
export GO15VENDOREXPERIMENT=1
NOVENDOR = $(shell GO15VENDOREXPERIMENT=1 glide novendor)
export PATH := $(GOPATH)/bin:$(PATH)
THRIFT_GEN=$(GOPATH)/bin/thrift-gen
define thriftrule
THRIFT_GEN_SRC += $(THRIFT_GENDIR)/go/$1/tchan-$1.go
$(THRIFT_GENDIR)/go/$1/tchan-$1.go:: $2 $(THRIFT_GEN)
@mkdir -p $(THRIFT_GENDIR)/go
$(ECHO_V)$(THRIFT_GEN) --generateThrift --packagePrefix $(PROJECT_ROOT)/$(THRIFT_GENDIR)/go/ --inputFile $2 --outputDir $(THRIFT_GENDIR)/go \
$(foreach template,$(THRIFT_TEMPLATES), --template $(template))
endef
$(foreach tsrc,$(THRIFT_SRCS),$(eval $(call \
thriftrule,$(basename $(notdir \
$(shell echo $(tsrc) | tr A-Z a-z))),$(tsrc))))
thriftc: $(THRIFT_GEN_SRC)
bins: thriftc
clean:
rm -rf .generated