Add simple makefile

This commit is contained in:
Ettore Di Giacinto 2019-06-05 18:20:39 +02:00
parent 632619fe91
commit 6e7cef4710
No known key found for this signature in database
GPG Key ID: F557248F4D256736

53
Makefile Normal file
View File

@ -0,0 +1,53 @@
NAME ?= luet
PACKAGE_NAME ?= $(NAME)
PACKAGE_CONFLICT ?= $(PACKAGE_NAME)-beta
REVISION := $(shell git rev-parse --short HEAD || echo unknown)
VERSION := $(shell git describe --tags || 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"
.PHONY: all
all: deps build
.PHONY: test
test:
ginkgo -r ./...
.PHONY: help
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
.PHONY: clean
clean:
rm -rf release/
.PHONY: deps
deps:
go env
# Installing dependencies...
go get -u github.com/golang/lint/golint
go get github.com/mitchellh/gox
go get golang.org/x/tools/cmd/cover
go get github.com/mattn/goveralls
go get github.com/onsi/ginkgo/ginkgo
go get github.com/onsi/gomega/...
.PHONY: build
build:
go build
.PHONY: gox-build
gox-build:
# Building gitlab-ci-multi-runner for $(BUILD_PLATFORMS)
gox $(BUILD_PLATFORMS) -output="release/$(NAME)-$(VERSION)-{{.OS}}-{{.Arch}}"
.PHONY: lint
lint:
# Checking project code style...
golint ./... | grep -v "be unexported"