-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
48 lines (36 loc) · 1019 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
NAME := para
PLATFORMS := darwin/amd64 linux/amd64
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
.PHONY: clean
clean:
rm -rf $(RELEASE_DIR)
.PHONY: format
format:
GOPROXY="off" GOFLAGS="-mod=vendor" go fmt ./...
.PHONY: test
test:
GOPROXY="off" GOFLAGS="-mod=vendor" go test -v ./...
GOPROXY="off" GOFLAGS="-mod=vendor" go vet ./...
.PHONY: build
build:
GOPROXY="off" GOFLAGS="-mod=vendor" go build -o $(NAME)-dev
.PHONY: run
run:
GOPROXY="off" GOFLAGS="-mod=vendor" go run -race . $(args)
.PHONY: release
release: $(PLATFORMS)
.PHONY: $(PLATFORMS)
$(PLATFORMS):
GOPROXY="off" GOFLAGS="-mod=vendor" GOOS=$(os) GOARCH=$(arch) go build -ldflags="-s -w" -o '$(RELEASE_DIR)/$(BASE)_$(os)-$(arch)'
.PHONY: compress
compress:
upx $(RELEASE_DIR)/*
.PHONY: sums
sums:
cd $(RELEASE_DIR); shasum -a 256 para* > SHA256SUMS