github.com/temphia/temphia@v0.0.0-20240217195838-8c2001a6d2da/makefile (about)

     1  .PHONY: clean changelog snapshot
     2  .PHONY: deps
     3  
     4  # Check for required command tools to build or stop immediately
     5  EXECUTABLES = git go find pwd
     6  K := $(foreach exec,$(EXECUTABLES),\
     7          $(if $(shell which $(exec)),some string,$(error "No $(exec) in PATH")))
     8  
     9  VERSION ?= $(shell git describe --tags `git rev-list --tags --max-count=1`)
    10  BINARY = temphia
    11  
    12  BUILDDIR = ../build
    13  GITREV = $(shell git rev-parse --short HEAD)
    14  BUILDTIME = $(shell date +'%FT%TZ%z')
    15  GOLDFLAGS += -X github.com/temphia/temphia/code/backend/xtypes.Version=$(VERSION)
    16  GOLDFLAGS += -X github.com/temphia/temphia/code/backend/xtypes.Buildtime=$(BUILDTIME)
    17  GOFLAGS = -ldflags "$(GOLDFLAGS)"
    18  GO_BUILDER_VERSION=latest
    19  
    20  deps:
    21  	go get -u github.com/git-chglog/git-chglog/cmd/git-chglog
    22  	go get -u golang.org/x/tools/cmd/goimports
    23  
    24  clean:
    25  	rm -rf $(shell pwd)/$(BUILDDIR)/
    26  
    27  changelog:
    28  	git-chglog $(VERSION) > CHANGELOG.md
    29  
    30  snapshot:
    31  	docker run --rm --privileged \
    32  		-v $(CURDIR):/temphia \
    33  		-v /var/run/docker.sock:/var/run/docker.sock \
    34  		-v $(GOPATH)/src:/go/src \
    35  		-w /temphia \
    36  		ghcr.io/gythialy/golang-cross:$(GO_BUILDER_VERSION) --snapshot --clean --rm-dist