forked from itsdalmo/ssm-sh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
50 lines (38 loc) · 1.05 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
BINARY_NAME = ssm-sh
DOCKER_REPO = itsdalmo/ssm-sh
TARGET ?= darwin
ARCH ?= amd64
EXT ?= ""
GIT_REF = $(shell git rev-parse --short HEAD)
GIT_TAG = $(if $(TRAVIS_TAG),$(TRAVIS_TAG),ref-$(GIT_REF))
LDFLAGS = -ldflags "-X=main.version=$(GIT_TAG)"
SRC = $(shell find . -type f -name '*.go' -not -path "./vendor/*")
default: test
run: test
@echo "== Run =="
go run $(LDFLAGS) main.go
build: test
@echo "== Build =="
go build -o $(BINARY_NAME) -v $(LDFLAGS)
test:
@echo "== Test =="
gofmt -s -l -w $(SRC)
go vet -v ./...
go test -race -v ./...
clean:
@echo "== Cleaning =="
@rm -f ssm-sh* || true
lint:
@echo "== Lint =="
golint manager
golint command
run-docker:
@echo "== Docker run =="
docker run --rm $(DOCKER_REPO):latest
build-docker:
@echo "== Docker build =="
docker build -t $(DOCKER_REPO):latest .
build-release: test
@echo "== Release build =="
CGO_ENABLED=0 GOOS=$(TARGET) GOARCH=$(ARCH) go build $(LDFLAGS) -o $(BINARY_NAME)-$(TARGET)-$(ARCH)$(EXT) -v
.PHONY: default build test build-docker run-docker build-release