-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
81 lines (58 loc) · 2.38 KB
/
Makefile
File metadata and controls
81 lines (58 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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 'github.com/bornholm/corpus/internal/build.ShortVersion=$(GIT_SHORT_VERSION)' \
-X 'github.com/bornholm/corpus/internal/build.LongVersion=$(GIT_LONG_VERSION)'
GCFLAGS ?= -trimpath=$(PWD)
ASMFLAGS ?= -trimpath=$(PWD) \
CI_EVENT ?= push
RELEASE_CHANNEL ?= $(shell git rev-parse --abbrev-ref HEAD)
COMMIT_TIMESTAMP = $(shell git show -s --format=%ct)
RELEASE_VERSION ?= $(shell TZ=Europe/Paris date -d "@$(COMMIT_TIMESTAMP)" +%Y.%-m.%-d)-$(RELEASE_CHANNEL).$(shell date -d "@${COMMIT_TIMESTAMP}" +%-H%M).$(shell git rev-parse --short HEAD)
GORELEASER_ARGS ?= release --snapshot --clean
watch: tools/modd/bin/modd
tools/modd/bin/modd
run-with-env: .env
( set -o allexport && source .env && set +o allexport && $(value CMD))
build: build-server build-client build-desktop
build-%: generate
CGO_ENABLED=0 \
go build \
-ldflags "$(LDFLAGS)" \
-gcflags "$(GCFLAGS)" \
-asmflags "$(ASMFLAGS)" \
-o ./bin/$* ./cmd/$*
purge:
rm -rf *.sqlite* index.bleve
release:
git tag -a v$(RELEASE_VERSION) -m $(RELEASE_VERSION)
git push --tags
generate: tools/templ/bin/templ
tools/templ/bin/templ generate
npx @tailwindcss/cli -i misc/tailwind/templui.css -o internal/http/handler/webui/common/assets/templui.css
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.1001
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)
tools/goreleaser/bin/goreleaser:
mkdir -p tools/goreleaser/bin
GOBIN=$(PWD)/tools/goreleaser/bin go install github.com/goreleaser/goreleaser/v2@latest
tools/templui/bin/templui:
mkdir -p tools/templui/bin
GOBIN=$(PWD)/tools/templui/bin go install github.com/templui/templui/cmd/templui@latest
goreleaser: tools/goreleaser/bin/goreleaser
REPO_OWNER=$(shell whoami) tools/goreleaser/bin/goreleaser $(GORELEASER_ARGS)
.env:
cp .env.dist .env
include misc/*/*.mk