| 1 |
|
| 2 |
MAKE = make |
| 3 |
|
| 4 |
default: build |
| 5 |
|
| 6 |
genproto.mk: |
| 7 |
@docker pull lightstep/gogoprotoc:latest |
| 8 |
@-docker rm -v lightstep-get-genproto-mk |
| 9 |
@docker create --name lightstep-get-genproto-mk lightstep/gogoprotoc:latest |
| 10 |
@docker cp lightstep-get-genproto-mk:/root/genproto.mk genproto.mk |
| 11 |
@docker rm -v lightstep-get-genproto-mk |
| 12 |
|
| 13 |
include genproto.mk |
| 14 |
|
| 15 |
PKG_PREFIX = github.com/lightstep/lightstep-tracer-common |
| 16 |
|
| 17 |
PROTO_SOURCES = \ |
| 18 |
collector.proto \ |
| 19 |
lightstep.proto \ |
| 20 |
metrics.proto |
| 21 |
|
| 22 |
TEST_SOURCES = \ |
| 23 |
$(GOLANG)/gogo/gogo_test.go \ |
| 24 |
$(GOLANG)/protobuf/protobuf_test.go |
| 25 |
|
| 26 |
GOGO_GENTGTS = $(call protos_to_gogo_targets,$(PROTO_SOURCES)) |
| 27 |
PBUF_GENTGTS = $(call protos_to_protobuf_targets,$(PROTO_SOURCES)) |
| 28 |
|
| 29 |
GOGO_LINKS = $(call protoc_targets_to_link_targets,$(GOGO_GENTGTS)) |
| 30 |
PBUF_LINKS = $(call protoc_targets_to_link_targets,$(PBUF_GENTGTS)) |
| 31 |
|
| 32 |
FAKES = \ |
| 33 |
golang/gogo/collectorpb/collectorpbfakes/fake_collector_service_client.go \ |
| 34 |
golang/protobuf/collectorpb/collectorpbfakes/fake_collector_service_client.go |
| 35 |
|
| 36 |
.PHONY: default build test clean proto-links proto |
| 37 |
.PHONY: $(GOGO_GENTGTS) $(PBUF_GENTGTS) $(GOGO_LINKS) $(PBUF_LINKS) |
| 38 |
|
| 39 |
build: test |
| 40 |
|
| 41 |
proto: $(GOGO_GENTGTS) $(PBUF_GENTGTS) $(FAKES) |
| 42 |
|
| 43 |
test: $(TEST_SOURCES) |
| 44 |
@mkdir -p $(TMPNAME) |
| 45 |
${MAKE} -C golang test |
| 46 |
|
| 47 |
clean: |
| 48 |
rm -rf $(TMPNAME) |
| 49 |
${MAKE} -C golang clean |
| 50 |
$(call clean_protoc_targets,$(GOGO_GENTGTS) $(PBUF_GENTGTS)) |
| 51 |
|
| 52 |
proto-links: $(GOGO_LINKS) $(PBUF_LINKS) |
| 53 |
|
| 54 |
$(TMPNAME): |
| 55 |
@mkdir -p $(TMPNAME) |
| 56 |
|
| 57 |
$(GOGO_LINKS): $(GOLANG)-$(GOGO)-%-link: %.proto $(TMPNAME) |
| 58 |
$(call gen_protoc_link,$<,$@,$(GOGO)) |
| 59 |
|
| 60 |
$(PBUF_LINKS): $(GOLANG)-$(PBUF)-%-link: %.proto $(TMPNAME) |
| 61 |
$(call gen_protoc_link,$<,$@,$(PBUF)) |
| 62 |
|
| 63 |
$(GOGO_GENTGTS): $(GOLANG)-$(GOGO)-%: %.proto proto-links $(TMPNAME) |
| 64 |
$(call gen_gogo_target,$<) |
| 65 |
|
| 66 |
$(PBUF_GENTGTS): $(GOLANG)-$(PBUF)-%: %.proto proto-links $(TMPNAME) |
| 67 |
$(call gen_protobuf_target,$<) |
| 68 |
|
| 69 |
golang/gogo/collectorpb/collectorpbfakes/fake_collector_service_client.go: golang/gogo/collectorpb/collector.pb.go $(TMPNAME) |
| 70 |
$(call generate_fake,$@,$<,CollectorServiceClient) |
| 71 |
|
| 72 |
golang/protobuf/collectorpb/collectorpbfakes/fake_collector_service_client.go: golang/protobuf/collectorpb/collector.pb.go $(TMPNAME) |
| 73 |
$(call generate_fake,$@,$<,CollectorServiceClient) |