From 2324812ee0dcda544f5bfdb3598093d20baa17f3 Mon Sep 17 00:00:00 2001 From: Wolfgang Welz <welzwo@gmail.com> Date: Wed, 8 Jan 2020 08:15:19 +0100 Subject: [PATCH] fix: fix makefile --- Makefile | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 60211a35..045cb830 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,21 @@ SHELL := /bin/bash REPO := $(shell pwd) +GOFILES_NOVENDOR := $(shell go list -f "{{.Dir}}" ./...) +PACKAGES_NOVENDOR := $(shell go list ./...) PROTOC_GEN_GO := $(GOPATH)/bin/protoc-gen-go + # Protobuf generated go files PROTO_FILES = $(shell find . -path ./vendor -prune -o -type f -name '*.proto' -print) PROTO_GO_FILES = $(patsubst %.proto, %.pb.go, $(PROTO_FILES)) +PROTO_GO_FILES_REAL = $(shell find . -path ./vendor -prune -o -type f -name '*.pb.go' -print) + +.PHONY: build +build: proto + go build -o shimmer + +# Protobuffing +.PHONY: proto +proto: $(PROTO_GO_FILES) # If $GOPATH/bin/protoc-gen-go does not exist, we'll run this command to install it. $(PROTOC_GEN_GO): @@ -13,5 +25,15 @@ $(PROTOC_GEN_GO): %.pb.go: %.proto | $(PROTOC_GEN_GO) protoc $< --go_out=plugins=grpc,paths=source_relative:. -.PHONY: compile -compile: $(PROTO_GO_FILES) +.PHONY: clean_proto +clean_proto: + @rm -f $(PROTO_GO_FILES_REAL) + +.PHONY: vet +vet: + @echo "Running go vet." + @go vet ${PACKAGES_NOVENDOR} + +.PHONY: test +test: vet + go test -timeout 30s ./... ${GOPACKAGES_NOVENDOR} -- GitLab