-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
46 lines (37 loc) · 1.31 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
NAME ?= docker-companion
PACKAGE_NAME ?= $(NAME)
PACKAGE_CONFLICT ?= $(PACKAGE_NAME)-beta
REVISION := $(shell git rev-parse --short HEAD || echo unknown)
VERSION := $(shell git describe --tags || cat main.go | grep -o 'VERSION = "[^"]*"' | awk '{ print $3 }' | sed 's:"::g' || echo dev)
VERSION := $(shell echo $(VERSION) | sed -e 's/^v//g')
ITTERATION := $(shell date +%s)
BUILD_PLATFORMS ?= -osarch="linux/amd64" -osarch="linux/386" -osarch="linux/arm"
all: deps build
help:
# make all => deps test lint build
# make deps - install all dependencies
# make test - run project tests
# make lint - check project code style
# make build - build project for all supported OSes
clean:
rm -rf vendor/
rm -rf release/
deps:
go env
# Installing dependencies...
GO111MODULE=off go get golang.org/x/lint/golint
GO111MODULE=off go get github.com/mitchellh/gox
GO111MODULE=off go get golang.org/x/tools/cmd/cover
GO111MODULE=off go get github.com/mattn/goveralls
vendor:
go mod vendor
build:
gox $(BUILD_PLATFORMS) -output="release/$(NAME)-$(VERSION)-{{.OS}}-{{.Arch}}" -ldflags "-extldflags=-Wl,--allow-multiple-definition"
lint:
# Checking project code style...
golint ./... | grep -v "be unexported"
test:
# Running tests... ${TOTEST}
go test -cover
build-and-deploy:
make build BUILD_PLATFORMS="-os=linux -arch=amd64"