diff --git a/Makefile b/Makefile index ea272e8183e89214d9712b14ea80f58fbd4be8a7..f2b673d8a9e75f66644d330f97d0c8af650c45b7 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,33 @@ ARCH := darwin/amd64 linux/386 linux/amd64 windows/386 windows/amd64 VERSION := $(shell git describe --always --dirty) LDFLAGS := -ldflags "-X main.version=${VERSION}" +BUILD_DIR := build +BINARY_NAME ?= yajsv -yajsv: *.go +.PHONY: build +build: *.go go build ${LDFLAGS} +.PHONY: release release: *.go - gox -output 'build/{{.Dir}}.{{.OS}}.{{.Arch}}' -osarch "${ARCH}" ${LDFLAGS} + gox -output '${BUILD_DIR}/{{.Dir}}.{{.OS}}.{{.Arch}}' -osarch "${ARCH}" ${LDFLAGS} +.PHONY: clean clean: - rm -rf build yajsv + $(eval BINARY := ${BINARY_NAME}$(if $(findstring windows,$(GOOS)),.exe,)) + rm -rf ${BUILD_DIR} ${BINARY} coverage.out + +.PHONY: fmt +fmt: + go fmt ./... + +.PHONY: tidy +tidy: + go mod tidy -v + +.PHONY: test +test: + go test -coverprofile=coverage.out ./... + +.PHONY: ci +ci: clean test build \ No newline at end of file