forked from aspenmesh/istio-vet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
71 lines (50 loc) · 1.39 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
PACKAGE := github.com/aspenmesh/istio-vet
GOOS = $(shell go env GOOS)
GOARCH = $(shell go env GOARCH)
GOBIN = $(GOPATH)/bin/$(GOOS)-$(GOARCH)
GO_BUILD_FLAGS=-v
ALL_PKGS := ./cmd/... ./pkg/...
GENERATED_GO = pkg/generated/api/v1/note.pb.go
#
# Normal build for developers. Just builds source.
#
all: go-build
image:
docker build -t istio-vet .
precommit: go-build image fmt
#
# Debug build, with all verification
#
debug: GO_BUILD_FLAGS=-v -race -gcflags '-N -l'
debug: go-build
#
# Remove all build artifacts
#
clean:
rm -rf _build
rm -rf pkg/generated
info:
@echo "ALL_PKGS: $(ALL_PKGS)"
############################################################################
# NOTE:
# The following targets are supporting targets for the publicly maintained
# targets above. Publicly maintained targets above are always provided.
############################################################################
go-build: $(GENERATED_GO)
go install $(GO_BUILD_FLAGS) $(ALL_PKGS)
fmt:
@if git diff --exit-code; then true; \
else echo "Can't format code with local changes";false; fi
@echo "Files that need formating:"
@go fmt $(ALL_PKGS)
@git diff --exit-code
# Generated go
pkg/generated/api/v1/note.pb.go: api/v1/note.proto
@mkdir -p $(@D)
protoc -I/usr/local/include -I. \
-I$(GOPATH)/src \
--go_out=:pkg/generated \
$<
.PHONY: all
# Disable builtin implicit rules
.SUFFIXES: