-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
57 lines (48 loc) · 1.9 KB
/
Makefile
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
# See https://tech.davis-hansson.com/p/make/
SHELL := bash
.DELETE_ON_ERROR:
.SHELLFLAGS := -eu -o pipefail -c
.DEFAULT_GOAL := all
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
MAKEFLAGS += --no-print-directory
BIN := .tmp/bin
COPYRIGHT_YEARS := 2021-2023
LICENSE_IGNORE := --ignore /testdata/
# Set to use a different compiler. For example, `GO=go1.18rc1 make test`.
GO ?= go
.PHONY: help
help: ## Describe useful make targets
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "%-30s %s\n", $$1, $$2}'
.PHONY: all
all: run
.PHONY: clean
clean: ## Delete intermediate build artifacts
@# -X only removes untracked files, -d recurses into directories, -f actually removes files/dirs
git clean -Xdf
.PHONY: generate
generate: $(BIN)/buf $(BIN)/protoc-gen-go $(BIN)/protoc-gen-go-grpc $(BIN)/license-header ## Regenerate code and licenses
rm -rf internal/gen
PATH=$(abspath $(BIN)) $(BIN)/buf generate
$(BIN)/license-header \
--license-type apache \
--copyright-holder "The Connect Authors" \
--year-range "$(COPYRIGHT_YEARS)" $(LICENSE_IGNORE)
.PHONY: run
run: generate ## Run the compose setup (default)
@# Disable buildkit, Podman doesn't support it and we don't need it.
DOCKER_BUILDKIT=0 docker-compose up --build
$(BIN)/buf: Makefile
@mkdir -p $(@D)
GOBIN=$(abspath $(@D)) $(GO) install github.com/bufbuild/buf/cmd/[email protected]
$(BIN)/protoc-gen-go: Makefile go.mod
@mkdir -p $(@D)
GOBIN=$(abspath $(@D)) $(GO) install google.golang.org/protobuf/cmd/[email protected]
.PHONY: $(BIN)/protoc-gen-go-grpc
$(BIN)/protoc-gen-go-grpc:
@mkdir -p $(@D)
GOBIN=$(abspath $(@D)) $(GO) install google.golang.org/grpc/cmd/[email protected]
$(BIN)/license-header: Makefile
@mkdir -p $(@D)
GOBIN=$(abspath $(@D)) $(GO) install \
github.com/bufbuild/buf/private/pkg/licenseheader/cmd/license-header@90fa81df0e9ef86ed505956be1ab1e8ccd49aa52