-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
42 lines (41 loc) · 1.04 KB
/
Makefile
File metadata and controls
42 lines (41 loc) · 1.04 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
.POSIX:
.SUFFIXES:
NAME = captermscrn
default: help
exit 1
help:
@ printf 'Usage:\n\n\
make <command>\n\n\
Commands:\n\n\
build build program\n\
clean remove built files\n\
docker build Docker image\n\
goversion print Go version (from go.mod)\n\
help print usage\n\
release publish\n\
test run tests\n'
all: build
install: build
build:
go build -o $(NAME) cmd/main.go
clean: cleantag
rm -f $(NAME)
docker: goversion
docker build -t $(NAME) --build-arg GO_VERSION=$$(make goversion) .
release: test cleantag tag
git tag "$$(cat tag)" # https://go.dev/doc/modules/publishing
git push origin "$$(cat tag)"
GOPROXY=proxy.golang.org go list -m \
"github.com/tingstad/termscreen@$$(cat tag)"
tag:
git tag --list
@ echo "Please enter new tag:"\
; read tag\
; echo "$$tag" > tag
cleantag:
rm -f tag
test:
go test ./...
goversion:
@ awk '$$1 == "go" && $$2 ~ /^[1-9]/ && !n++ { print $$2 } END{ if(!n)\
print "ERROR finding Go version in go.mod" | "cat >&2"; exit !n }' go.mod