clearcase/Makefile

55 lines
1.4 KiB
Makefile

SHELL := /bin/bash
GIT_SHORT_VERSION ?= $(shell git describe --tags --abbrev=8 --always)
GIT_LONG_VERSION ?= $(shell git describe --tags --abbrev=8 --dirty --always --long)
LDFLAGS ?= -w -s \
-X 'forge.cadoles.com/wpetit/clearcase/internal/build.ShortVersion=$(GIT_SHORT_VERSION)' \
-X 'forge.cadoles.com/wpetit/clearcase/internal/build.LongVersion=$(GIT_LONG_VERSION)'
GCFLAGS ?= -trimpath=$(PWD)
ASMFLAGS ?= -trimpath=$(PWD) \
CI_EVENT ?= push
watch: tools/modd/bin/modd bin/templ
tools/modd/bin/modd
run-with-env: .env
( set -o allexport && source .env && set +o allexport && $(value CMD))
build: generate
CGO_ENABLED=0 \
go build \
-ldflags "$(LDFLAGS)" \
-gcflags "$(GCFLAGS)" \
-asmflags "$(ASMFLAGS)" \
-o ./bin/clearcase ./cmd/clearcase
generate: tools/templ/bin/templ
tools/templ/bin/templ generate
bin/templ: tools/templ/bin/templ
mkdir -p bin
ln -fs $(PWD)/tools/templ/bin/templ bin/templ
tools/templ/bin/templ:
mkdir -p tools/templ/bin
GOBIN=$(PWD)/tools/templ/bin go install github.com/a-h/templ/cmd/templ@v0.3.819
tools/modd/bin/modd:
mkdir -p tools/modd/bin
GOBIN=$(PWD)/tools/modd/bin go install github.com/cortesi/modd/cmd/modd@latest
tools/act/bin/act:
mkdir -p tools/act/bin
cd tools/act && curl https://raw.githubusercontent.com/nektos/act/master/install.sh | bash -
ci: tools/act/bin/act
tools/act/bin/act $(CI_EVENT)
.env:
cp .env.dist .env
include misc/*/*.mk