fathom/Makefile

59 lines
1.2 KiB
Makefile
Raw Normal View History

2016-12-25 15:33:09 +00:00
DIST := dist
2018-04-24 08:12:38 +00:00
EXECUTABLE := fathom
2016-12-25 15:33:09 +00:00
LDFLAGS += -extldflags "-static" -X "main.Version=$(shell git describe --tags --always | sed 's/-/+/' | sed 's/^v//')"
TARGETS ?= linux/*,darwin/*,windows/*
PACKAGES ?= $(shell go list ./... | grep -v /vendor/)
SOURCES ?= $(shell find . -name "*.go" -type f)
ENV ?= $(shell export $(cat .env | xargs))
.PHONY: all
all: build assets
2016-12-25 15:33:09 +00:00
.PHONY: clean
clean:
go clean -i ./...
rm -rf $(EXECUTABLE) $(DIST) $(BINDATA)
.PHONY: fmt
fmt:
go fmt $(PACKAGES)
.PHONY: vet
vet:
go vet $(PACKAGES)
.PHONY: errcheck
errcheck:
@which errcheck > /dev/null; if [ $$? -ne 0 ]; then \
go get -u github.com/kisielk/errcheck; \
fi
errcheck $(PACKAGES)
.PHONY: lint
lint:
@which golint > /dev/null; if [ $$? -ne 0 ]; then \
go get -u github.com/golang/lint/golint; \
fi
for PKG in $(PACKAGES); do golint -set_exit_status $$PKG || exit 1; done;
.PHONY: test
test:
for PKG in $(PACKAGES); do go test -cover -coverprofile $$GOPATH/src/$$PKG/coverage.out $$PKG || exit 1; done;
.PHONY: install
install: $(wildcard *.go)
go install -v -ldflags '-w $(LDFLAGS)'
2016-12-25 15:33:09 +00:00
.PHONY: build
build: $(EXECUTABLE)
$(EXECUTABLE): $(SOURCES)
go build -v -ldflags '-w $(LDFLAGS)' -o $@
2016-12-25 15:33:09 +00:00
.PHONY: docker
docker:
docker build -t metalmatze/ana:latest .