-
Notifications
You must be signed in to change notification settings - Fork 12
/
Makefile
38 lines (28 loc) · 995 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
PREFIX := github.com/nelhage/taktician
PROTOS := $(wildcard proto/tak/proto/*.proto)
PROTONAMES := $(foreach proto,$(PROTOS), $(basename $(notdir $(proto))))
GOPROTOSRC := $(foreach proto,$(PROTONAMES),pb/$(proto).pb.go)
PYPROTOSRC := $(foreach proto,$(PROTONAMES),python/tak/proto/$(proto)_pb2.py)
GENFILES := ai/feature_string.go $(GOPROTOSRC) $(PYPROTOSRC)
ai/feature_string.go: ai/evaluate.go
go generate $(PREFIX)/ai
protoc: $(GOPROTOSRC) $(PYPROTOSRC)
$(GOPROTOSRC) $(PYPROTOSRC): $(PROTOS)
python -m grpc_tools.protoc\
-I proto/ \
--python_out=python/ \
--grpc_python_out=python/ \
--go_out=. \
--go_opt="module=$(PREFIX)" \
--go-grpc_out=. \
--go-grpc_opt="module=$(PREFIX)" \
proto/tak/proto/*.proto
build: $(GENFILES)
go build $(PREFIX)/...
install: $(GENFILES)
go install $(PREFIX)/...
test: $(GENFILES)
go test $(PREFIX)/...
test-%: $(GENFILES)
go test $(PREFIX)/$*...
.PHONY: test install build protoc