1
0
mirror of https://github.com/danog/gojekyll.git synced 2024-11-26 23:34:47 +01:00
gojekyll/Makefile

50 lines
1.1 KiB
Makefile
Raw Normal View History

2017-06-20 15:00:04 +02:00
BINARY = gojekyll
PACKAGE = github.com/osteele/gojekyll
2017-07-18 15:34:54 +02:00
SOURCEDIR = .
SOURCES := $(shell find $(SOURCEDIR) -name '*.go')
2017-06-20 15:00:04 +02:00
COMMIT_HASH = `git rev-parse --short HEAD 2>/dev/null`
2017-07-18 15:34:54 +02:00
BUILD_DATE = `date +%FT%T%z`
2017-07-19 18:25:59 +02:00
VERSION := $(COMMIT_HASH)
OS := $(shell uname)
2017-06-20 15:00:04 +02:00
2017-08-14 21:23:00 +02:00
LDFLAGS=-ldflags "-X ${PACKAGE}/version.Version=${VERSION} -X ${PACKAGE}/version.BuildDate=${BUILD_DATE}"
2017-06-20 15:00:04 +02:00
2017-07-13 02:01:17 +02:00
.DEFAULT_GOAL: build
2017-07-19 18:25:59 +02:00
.PHONY: build clean deps setup install lint release test help
2017-06-20 15:00:04 +02:00
$(BINARY): $(SOURCES)
go build ${LDFLAGS} -o ${BINARY} ${PACKAGE}
2017-07-14 01:39:53 +02:00
2017-06-20 15:00:04 +02:00
build: $(BINARY) ## compile the package
2017-08-11 19:16:23 +02:00
clean:
2017-07-18 15:34:54 +02:00
rm -f ${BINARY}
2017-06-20 15:00:04 +02:00
2017-08-11 19:16:23 +02:00
imports:
2017-07-14 01:39:53 +02:00
go list -f '{{join .Imports "\n"}}' ./... | grep -v `go list -f '{{.ImportPath}}'` | grep '\.' | sort | uniq
2017-08-11 19:16:23 +02:00
deps:
2017-07-14 01:39:53 +02:00
go list -f '{{join .Deps "\n"}}' ./... | grep -v `go list -f '{{.ImportPath}}'` | grep '\.' | sort | uniq
2017-06-20 15:00:04 +02:00
2017-08-11 19:16:23 +02:00
race:
go build -race ${LDFLAGS} -o ${BINARY}-race ${PACKAGE}
2017-07-19 18:25:59 +02:00
release: build
mkdir -p dist
2017-07-19 19:02:19 +02:00
tar -cvzf dist/$(BINARY)_$(VERSION)_$(OS:GNU/%=%)_$(shell uname -m).tar.gz $(BINARY) LICENSE README.md
2017-07-19 18:25:59 +02:00
2017-08-11 19:16:23 +02:00
setup:
2021-06-16 09:35:59 +02:00
go mod init || true
2017-07-19 18:49:43 +02:00
go get -t -u ./...
2017-06-20 15:00:04 +02:00
2017-08-11 19:16:23 +02:00
install:
2017-07-15 23:03:55 +02:00
go install ${LDFLAGS} ${PACKAGE}
2017-06-20 15:00:04 +02:00
2017-08-11 19:16:23 +02:00
lint:
2021-06-16 09:48:07 +02:00
golangci-lint run
2017-06-20 15:00:04 +02:00
2017-08-11 19:16:23 +02:00
test:
go test ./...