Skip to content

Commit bb7b0e0

Browse files
authored
chore: cleanup Makefile
It's important to keep Makefile clean. - Every goal should be a PHONY - It is not necessary to check if the programs are available. - For example, users may want to upgrade to the new versions.
1 parent 39f005f commit bb7b0e0

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

Makefile

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,24 @@
1-
.PHONY: all
21
.DEFAULT_GOAL := all
32

4-
PROTOC := $(shell which protoc)
5-
PROTOC_GEN_GO := $(shell which protoc-gen-go)
6-
PROTOC_VERSION := 3.17.0
3+
PROTOC_VERSION := 3.17.2
74
PROTOC_RELEASE := https://github.com/protocolbuffers/protobuf/releases
85
PROTO_FILES := $(shell find . -name "*.proto" -type f)
96
UNAME := $(shell uname)
10-
GOPATH := ${GOPATH}
117

8+
.PHONY: install
129
install:
13-
ifeq ($(PROTOC),)
1410
ifeq ($(UNAME),Darwin)
1511
brew install protobuf
1612
endif
1713
ifeq ($(UNAME), Linux)
1814
curl -LO "$(PROTOC_RELEASE)/download/v$(PROTOC_VERSION)/protoc-$(PROTOC_VERSION)-linux-x86_64.zip" && \
1915
unzip protoc-$(PROTOC_VERSION)-linux-x86_64.zip -d $${HOME}/.local && \
2016
export PATH="$${PATH}:$${HOME}/.local/bin"
17+
rm protoc-*.zip
2118
endif
22-
endif
23-
ifeq ($(PROTOC_GEN_GO),)
2419
go mod download && grep _ ./cmd/tools/tools.go | cut -d' ' -f2 | sed 's/\r//' | xargs go install -v
25-
endif
2620

21+
.PHONY: all
2722
all:
2823
mkdir -p ./pkg/pbs/
2924
protoc \
@@ -34,5 +29,6 @@ all:
3429
--go-grpc_opt=paths=source_relative \
3530
$(PROTO_FILES)
3631

32+
.PHONY: clean
3733
clean:
3834
rm -rf ./pkg/pbs/*.pb.go

pkg/pbs/messages.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/pbs/services.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)