2021-10-06 17:33:14 +00:00
|
|
|
include golang.mk
|
|
|
|
.DEFAULT_GOAL := test # override default goal set in library makefile
|
|
|
|
|
2019-07-14 16:51:10 +00:00
|
|
|
SHELL := /bin/bash
|
2021-10-06 17:33:14 +00:00
|
|
|
PKG := github.com/Clever/gitsem
|
|
|
|
PKGS := $(shell go list ./... | grep -v /vendor)
|
2019-07-14 16:51:10 +00:00
|
|
|
EXECUTABLE := gitsem
|
2021-10-06 17:33:14 +00:00
|
|
|
VERSION := $(shell cat VERSION)
|
2019-07-14 16:51:10 +00:00
|
|
|
BUILDS := \
|
|
|
|
build/$(EXECUTABLE)-v$(VERSION)-darwin-amd64 \
|
|
|
|
build/$(EXECUTABLE)-v$(VERSION)-linux-amd64 \
|
|
|
|
build/$(EXECUTABLE)-v$(VERSION)-windows-amd64
|
|
|
|
COMPRESSED_BUILDS := $(BUILDS:%=%.tar.gz)
|
|
|
|
RELEASE_ARTIFACTS := $(COMPRESSED_BUILDS:build/%=release/%)
|
|
|
|
|
2021-10-06 17:33:14 +00:00
|
|
|
.PHONY: test golint build vendor
|
2019-07-14 16:51:10 +00:00
|
|
|
|
2021-10-06 17:33:14 +00:00
|
|
|
$(eval $(call golang-version-check,1.13))
|
2019-07-14 16:51:10 +00:00
|
|
|
|
|
|
|
test: $(PKGS)
|
|
|
|
|
2021-10-06 17:33:14 +00:00
|
|
|
$(PKGS): golang-test-all-strict-deps
|
|
|
|
$(call golang-test-all-strict,$@)
|
|
|
|
|
2019-07-14 16:51:10 +00:00
|
|
|
|
|
|
|
run:
|
|
|
|
@go run main.go
|
|
|
|
|
2021-10-06 17:33:14 +00:00
|
|
|
build:
|
|
|
|
go build -o bin/$(EXECUTABLE) $(PKG)
|
|
|
|
|
2019-07-14 16:51:10 +00:00
|
|
|
build/$(EXECUTABLE)-v$(VERSION)-darwin-amd64:
|
|
|
|
GOARCH=amd64 GOOS=darwin go build -o "$@/$(EXECUTABLE)"
|
|
|
|
build/$(EXECUTABLE)-v$(VERSION)-linux-amd64:
|
|
|
|
GOARCH=amd64 GOOS=linux go build -o "$@/$(EXECUTABLE)"
|
|
|
|
build/$(EXECUTABLE)-v$(VERSION)-windows-amd64:
|
|
|
|
GOARCH=amd64 GOOS=windows go build -o "$@/$(EXECUTABLE).exe"
|
|
|
|
build: $(BUILDS)
|
|
|
|
%.tar.gz: %
|
|
|
|
tar -C `dirname $<` -zcvf "$<.tar.gz" `basename $<`
|
|
|
|
$(RELEASE_ARTIFACTS): release/% : build/%
|
|
|
|
mkdir -p release
|
|
|
|
cp $< $@
|
|
|
|
release: $(RELEASE_ARTIFACTS)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf build release
|
2021-10-06 17:33:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
install_deps:
|
|
|
|
go mod vendor
|