This repository has been archived by the owner on Mar 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
58 lines (49 loc) · 1.7 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
51
52
53
54
55
56
57
58
NAME ?= mottainai-cli
PACKAGE_NAME ?= $(NAME)
PACKAGE_CONFLICT ?= $(PACKAGE_NAME)-beta
REVISION := $(shell git rev-parse --short HEAD || echo unknown)
VERSION := $(shell git describe --tags || echo $(REVISION) || 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" -osarch="linux/arm64"
BUILD_PLATFORMS ?= -osarch="linux/amd64" -osarch="linux/386" -osarch="linux/arm"
EXTENSIONS ?= lxd
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...
go get golang.org/x/lint/golint
go get github.com/mitchellh/gox
go get golang.org/x/tools/cmd/cover
go get github.com/mattn/goveralls
go get -u github.com/onsi/ginkgo/ginkgo
go get -u github.com/onsi/gomega/...
build:
ifeq ($(EXTENSIONS),)
CGO_ENABLED=0 go build
else
CGO_ENABLED=0 go build -tags $(EXTENSIONS)
endif
multiarch-build:
ifeq ($(EXTENSIONS),)
CGO_ENABLED=0 gox $(BUILD_PLATFORMS) -output="release/$(NAME)-$(VERSION)-{{.OS}}-{{.Arch}}" -ldflags "-extldflags=-Wl,--allow-multiple-definition"
else
CGO_ENABLED=0 gox $(BUILD_PLATFORMS) -tags $(EXTENSIONS) -output="release/$(NAME)-$(VERSION)-{{.OS}}-{{.Arch}}" -ldflags "-extldflags=-Wl,--allow-multiple-definition" -parallel 1 -cgo
endif
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"