From 6b0f9f71e05d9b93f1690a267a4c6d4808ff76b9 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Wed, 5 Jun 2019 10:57:43 -0700 Subject: [PATCH] build: use protoc-gen-* from gomod Also, * Make it possible to override the PROTOC binary. * Remove gx targets. --- .gitignore | 1 + Makefile | 2 -- Rules.mk | 5 +++-- bin/Rules.mk | 7 +++++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 9ead6675ade..f96cb84bb88 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ gx-workspace-update.json .ipfs bin/gx +bin/protoc-* bin/gx* bin/tmp bin/gocovmerge diff --git a/Makefile b/Makefile index 4bd63ac03a1..4c175dbc51f 100644 --- a/Makefile +++ b/Makefile @@ -2,8 +2,6 @@ SHELL=PATH='$(PATH)' /bin/sh -PROTOC = protoc --gogofaster_out=. --proto_path=.:$(GOPATH)/src:$(dir $@) $< - # enable second expansion .SECONDEXPANSION: diff --git a/Rules.mk b/Rules.mk index 122aad0d8e5..d4bdf361ac7 100644 --- a/Rules.mk +++ b/Rules.mk @@ -5,6 +5,7 @@ DISTCLEAN := TEST := TEST_SHORT := GOCC ?= go +PROTOC ?= protoc all: help # all has to be first defined target .PHONY: all @@ -58,8 +59,8 @@ include $(dir)/Rules.mk # universal rules # # -------------------- # -%.pb.go: %.proto - $(PROTOC) +%.pb.go: %.proto bin/protoc-gen-gogofaster + $(PROTOC) --gogofaster_out=. --proto_path=.:$(GOPATH)/src:$(dir $@) $< # -------------------- # # core targets # diff --git a/bin/Rules.mk b/bin/Rules.mk index ecb759f3842..f1ee769e005 100644 --- a/bin/Rules.mk +++ b/bin/Rules.mk @@ -2,8 +2,8 @@ include mk/header.mk dist_root_$(d)="/ipfs/QmPrXH9jRVwvd7r5MC5e6nV4uauQGzLk1i2647Ye9Vbbwe" -TGTS_$(d) := $(d)/gx $(d)/gx-go -DISTCLEAN += $(wildcard $(d)/gx-v*) $(wildcard $(d)/gx-go-v*) $(d)/tmp +TGTS_$(d) := $(d)/protoc +DISTCLEAN += $(d)/protoc $(d)/tmp PATH := $(realpath $(d)):$(PATH) @@ -15,5 +15,8 @@ else ln -s $(notdir $^) $@ endif +bin/protoc-gen-gogofaster: + $(call go-build,github.com/gogo/protobuf/protoc-gen-gogofaster) + CLEAN += $(TGTS_$(d)) include mk/footer.mk