-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
32 lines (22 loc) · 805 Bytes
/
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
NAME := terraform-provider-stateful
PLATFORMS := darwin/amd64 linux/amd64 linux/arm64
VERSION = $(shell git describe 1>/dev/null 2>/dev/null && echo "_$$(git describe)")
temp = $(subst /, ,$@)
os = $(word 1, $(temp))
arch = $(word 2, $(temp))
BASE := $(NAME)$(VERSION)
RELEASE_DIR := ./release
all: clean test release
clean:
rm -rf $(RELEASE_DIR) ./$(NAME)*
format:
GOPROXY="off" GOFLAGS="-mod=vendor" go fmt ./...
test:
GOPROXY="off" GOFLAGS="-mod=vendor" go test -v ./...
GOPROXY="off" GOFLAGS="-mod=vendor" go vet ./...
build:
GOPROXY="off" GOFLAGS="-mod=vendor" go build -o $(BASE)
release: $(PLATFORMS)
$(PLATFORMS):
GOPROXY="off" GOFLAGS="-mod=vendor" GOOS=$(os) GOARCH=$(arch) go build -o '$(RELEASE_DIR)/$(BASE)-$(os)-$(arch)'
.PHONY: $(PLATFORMS) release build test fmt clean all