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
|
# tools
MAKE = make
default: build
genproto.mk:
@docker pull lightstep/gogoprotoc:latest
@-docker rm -v lightstep-get-genproto-mk
@docker create --name lightstep-get-genproto-mk lightstep/gogoprotoc:latest
@docker cp lightstep-get-genproto-mk:/root/genproto.mk genproto.mk
@docker rm -v lightstep-get-genproto-mk
include genproto.mk
PKG_PREFIX = github.com/lightstep/lightstep-tracer-common
PROTO_SOURCES = \
collector.proto \
lightstep.proto \
metrics.proto
TEST_SOURCES = \
$(GOLANG)/gogo/gogo_test.go \
$(GOLANG)/protobuf/protobuf_test.go
GOGO_GENTGTS = $(call protos_to_gogo_targets,$(PROTO_SOURCES))
PBUF_GENTGTS = $(call protos_to_protobuf_targets,$(PROTO_SOURCES))
GOGO_LINKS = $(call protoc_targets_to_link_targets,$(GOGO_GENTGTS))
PBUF_LINKS = $(call protoc_targets_to_link_targets,$(PBUF_GENTGTS))
FAKES = \
golang/gogo/collectorpb/collectorpbfakes/fake_collector_service_client.go \
golang/protobuf/collectorpb/collectorpbfakes/fake_collector_service_client.go
.PHONY: default build test clean proto-links proto
.PHONY: $(GOGO_GENTGTS) $(PBUF_GENTGTS) $(GOGO_LINKS) $(PBUF_LINKS)
build: test
proto: $(GOGO_GENTGTS) $(PBUF_GENTGTS) $(FAKES)
test: $(TEST_SOURCES)
@mkdir -p $(TMPNAME)
${MAKE} -C golang test
clean:
rm -rf $(TMPNAME)
${MAKE} -C golang clean
$(call clean_protoc_targets,$(GOGO_GENTGTS) $(PBUF_GENTGTS))
proto-links: $(GOGO_LINKS) $(PBUF_LINKS)
$(TMPNAME):
@mkdir -p $(TMPNAME)
$(GOGO_LINKS): $(GOLANG)-$(GOGO)-%-link: %.proto $(TMPNAME)
$(call gen_protoc_link,$<,$@,$(GOGO))
$(PBUF_LINKS): $(GOLANG)-$(PBUF)-%-link: %.proto $(TMPNAME)
$(call gen_protoc_link,$<,$@,$(PBUF))
$(GOGO_GENTGTS): $(GOLANG)-$(GOGO)-%: %.proto proto-links $(TMPNAME)
$(call gen_gogo_target,$<)
$(PBUF_GENTGTS): $(GOLANG)-$(PBUF)-%: %.proto proto-links $(TMPNAME)
$(call gen_protobuf_target,$<)
golang/gogo/collectorpb/collectorpbfakes/fake_collector_service_client.go: golang/gogo/collectorpb/collector.pb.go $(TMPNAME)
$(call generate_fake,$@,$<,CollectorServiceClient)
golang/protobuf/collectorpb/collectorpbfakes/fake_collector_service_client.go: golang/protobuf/collectorpb/collector.pb.go $(TMPNAME)
$(call generate_fake,$@,$<,CollectorServiceClient)
|