forked from docker-archive/ecs-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
builder.Makefile
39 lines (28 loc) · 1.04 KB
/
builder.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
GOOS?=$(shell go env GOOS)
GOARCH?=$(shell go env GOARCH)
EXTENSION :=
ifeq ($(GOOS),windows)
EXTENSION := .exe
endif
STATIC_FLAGS=CGO_ENABLED=0
LDFLAGS := "-s -w \
-X github.com/docker/ecs-plugin/internal.GitCommit=$(COMMIT) \
-X github.com/docker/ecs-plugin/internal.Version=$(TAG)"
GO_BUILD=$(STATIC_FLAGS) go build -trimpath -ldflags=$(LDFLAGS)
BINARY=dist/docker-ecs
BINARY_WITH_EXTENSION=$(BINARY)$(EXTENSION)
export DOCKER_BUILDKIT=1
all: build
clean:
rm -rf dist/
build:
$(GO_BUILD) -v -o $(BINARY_WITH_EXTENSION) cmd/main/main.go
cross:
@GOOS=linux GOARCH=amd64 $(GO_BUILD) -v -o $(BINARY)-linux-amd64 cmd/main/main.go
@GOOS=darwin GOARCH=amd64 $(GO_BUILD) -v -o $(BINARY)-darwin-amd64 cmd/main/main.go
@GOOS=windows GOARCH=amd64 $(GO_BUILD) -v -o $(BINARY)-windows-amd64.exe cmd/main/main.go
test: ## Run tests
@$(STATIC_FLAGS) go test -cover $(shell go list ./... | grep -vE 'e2e')
lint: ## Verify Go files
$(STATIC_FLAGS) golangci-lint run --timeout 10m0s --config ./golangci.yaml ./...
.PHONY: all clean build cross test dev lint