2018-12-30 06:21:56 +01:00
|
|
|
.PHONY: test format vet staticcheck magneticod magneticow ensure image image-magneticow image-magneticod
|
2018-08-07 09:31:26 +02:00
|
|
|
|
2018-08-27 10:15:01 +02:00
|
|
|
all: test magneticod magneticow
|
2017-11-03 00:15:13 +01:00
|
|
|
|
|
|
|
magneticod:
|
2018-12-25 16:38:13 +01:00
|
|
|
go install --tags fts5 "-ldflags=-s -w -X main.compiledOn=`date -u +%Y-%m-%dT%H:%M:%SZ`" github.com/boramalper/magnetico/cmd/magneticod
|
2017-11-03 00:15:13 +01:00
|
|
|
|
|
|
|
magneticow:
|
|
|
|
# TODO: minify files!
|
2018-12-25 16:38:13 +01:00
|
|
|
# https://github.com/kevinburke/go-bindata
|
2018-08-27 10:15:01 +02:00
|
|
|
go-bindata -o="cmd/magneticow/bindata.go" -prefix="cmd/magneticow/data/" cmd/magneticow/data/...
|
2018-12-25 16:38:13 +01:00
|
|
|
go install --tags fts5 "-ldflags=-s -w -X main.compiledOn=`date -u +%Y-%m-%dT%H:%M:%SZ`" github.com/boramalper/magnetico/cmd/magneticow
|
2018-08-03 14:40:04 +02:00
|
|
|
|
2018-08-27 10:15:01 +02:00
|
|
|
image-magneticod:
|
|
|
|
docker build -t magneticod -f Dockerfile.magneticod .
|
|
|
|
|
|
|
|
image-magneticow:
|
|
|
|
docker build -t magneticow -f Dockerfile.magneticow .
|
|
|
|
|
|
|
|
image: image-magneticod image-magneticow
|
|
|
|
|
|
|
|
# Download dependencies
|
|
|
|
ensure:
|
|
|
|
dep ensure -v
|
|
|
|
|
2018-12-30 06:21:56 +01:00
|
|
|
vet:
|
|
|
|
go vet github.com/boramalper/magnetico/...
|
2018-08-27 10:15:01 +02:00
|
|
|
|
2018-12-30 06:21:56 +01:00
|
|
|
staticcheck:
|
|
|
|
staticcheck github.com/boramalper/magnetico/...
|
2018-08-27 10:15:01 +02:00
|
|
|
|
2018-12-30 06:21:56 +01:00
|
|
|
test:
|
|
|
|
go test github.com/boramalper/magnetico/...
|
2018-08-27 10:15:01 +02:00
|
|
|
|
2018-08-03 14:40:04 +02:00
|
|
|
format:
|
2018-12-30 06:21:56 +01:00
|
|
|
gofmt -w ${GOPATH}/src/github.com/boramalper/magnetico/cmd/
|
|
|
|
gofmt -w ${GOPATH}/src/github.com/boramalper/magnetico/pkg/
|
|
|
|
|
|
|
|
# Formatting Errors
|
|
|
|
# Since gofmt returns zero even if there are files to be formatted, we use:
|
|
|
|
#
|
|
|
|
# ! gofmt -d ${GOPATH}/path/ 2>&1 | read
|
|
|
|
#
|
|
|
|
# to return 1 if there are files to be formatted, and 0 if not.
|
|
|
|
# https://groups.google.com/forum/#!topic/Golang-Nuts/pdrN4zleUio
|
|
|
|
#
|
|
|
|
# How can I use Bash syntax in Makefile targets?
|
|
|
|
# Because `read` is a bash command.
|
|
|
|
# https://stackoverflow.com/a/589300/4466589
|
|
|
|
#
|
|
|
|
check-formatting: SHELL:=/bin/bash # HERE: this is setting the shell for check-formatting only
|
|
|
|
check-formatting:
|
|
|
|
! gofmt -l ${GOPATH}/src/github.com/boramalper/magnetico/cmd/ 2>&1 | tee /dev/fd/2 | read
|
|
|
|
! gofmt -l ${GOPATH}/src/github.com/boramalper/magnetico/pkg/ 2>&1 | tee /dev/fd/2 | read
|