-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathMakefile
77 lines (64 loc) · 2.53 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
export GOPATH := $(PWD):$(PWD)/gopath
export PATH := $(PWD)/gopath/bin:$(PATH)
export GOMAXPROCS := 1
GOCMD := go
CAPNP_VERSION := 0.5.2
CAPNP_NAME := capnproto-c++-$(CAPNP_VERSION)
CAPNP_CMD := $(CAPNP_NAME)/capnp
PROTOC_VERSION := 2.6.1
PROTOC_NAME := protobuf-$(PROTOC_VERSION)
PROTOC_CMD := $(PROTOC_NAME)/src/protoc
.PHONY: all
all: get capnp proto
go test -c goser
./goser.test -test.benchtime=10s -test.cpuprofile=cpu.prof -test.run=XXX -test.bench=. -test.benchmem
go tool pprof --svg goser.test cpu.prof > cpu.svg
.PHONY: proto
proto: $(PROTOC_CMD)
go version
go install -v github.com/golang/protobuf/protoc-gen-go
go install -v github.com/gogo/protobuf/protoc-gen-gogo
cd src && ../$(PROTOC_CMD) --go_out=. pb/log.proto
cd src && ../$(PROTOC_CMD) -I$(PWD)/gopath/src -I$(PWD)/gopath/src/github.com/gogo/protobuf/protobuf -I. --gogo_out=. gogopb/log.proto
cd src && ../$(PROTOC_CMD) -I$(PWD)/gopath/src -I$(PWD)/gopath/src/github.com/gogo/protobuf/protobuf -I. --gogo_out=. gogopb_nullable/log.proto
cd src && ../$(PROTOC_CMD) -I$(PWD)/gopath/src -I$(PWD)/gopath/src/github.com/gogo/protobuf/protobuf -I. --gogo_out=. gogopb_unsafe/log.proto
cd src && ../$(PROTOC_CMD) -I$(PWD)/gopath/src -I$(PWD)/gopath/src/github.com/gogo/protobuf/protobuf -I. --gogo_out=. gogopb_both/log.proto
$(PROTOC_CMD):
test -d $(PROTOC_NAME) || curl -s -L https://github.com/google/protobuf/releases/download/v$(PROTOC_VERSION)/$(PROTOC_NAME).tar.bz2 | tar jx
cd $(PROTOC_NAME) && \
./configure && \
make -j3
.PHONY: capnp
capnp: $(CAPNP_CMD)
go version
go install -v github.com/glycerine/go-capnproto/capnpc-go
$(CAPNP_CMD) compile --verbose -ogo $(PWD)/src/capnp/log.capnp $(PWD)/src/capnp/country.capnp
$(CAPNP_CMD):
test -d $(CAPNP_NAME) || curl -s -L https://capnproto.org/$(CAPNP_NAME).tar.gz | tar zx
cd $(CAPNP_NAME) && \
./configure && \
make -j3
.PHONY: get
get:
GOPATH=$(PWD)/gopath go get -u -d github.com/golang/protobuf/proto
GOPATH=$(PWD)/gopath go get -u -d github.com/gogo/protobuf/proto
GOPATH=$(PWD)/gopath go get -u -d github.com/gogo/harmonytests
GOPATH=$(PWD)/gopath go get -u -d github.com/glycerine/go-capnproto
GOPATH=$(PWD)/gopath go get -u -d github.com/kaos/capnp_test || true
GOPATH=$(PWD)/gopath go get golang.org/x/tools/cmd/benchcmp
.PHONY: gofmt
gofmt:
$(GOCMD) fmt ./...
.PHONY: test
test:
go test -v ./...
.PHONY: test-compile
test-compile: all
@$(MAKE) --no-print-directory -f Make.tests $@
.PHONY: clean-pkg
clean-pkg:
$(RM) -rf pkg gopath/pkg
.PHONY: clean
clean: clean-pkg
$(RM) -rf bin gopath/bin
DEFAULT_GOAL := all