-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
34 lines (27 loc) · 994 Bytes
/
Copy pathMakefile
File metadata and controls
34 lines (27 loc) · 994 Bytes
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
PREFIX := /usr/local
PKGNAME := chhoto
GIT_VERSION := $(shell git tag --list | tail -1)
build:
go build -ldflags="-s -w -X 'github.com/SinTan1729/chhoto-url-cli/internal.Version=${GIT_VERSION}'" -o ${PKGNAME}
install: build
install -Dm755 $(PKGNAME) "$(DESTDIR)$(PREFIX)/bin/$(PKGNAME)"
install -Dm644 $(PKGNAME).1 "$(DESTDIR)$(PREFIX)/man/man1/$(PKGNAME).1"
uninstall:
rm -f "$(DESTDIR)$(PREFIX)/bin/$(PKGNAME)"
rm -f "$(DESTDIR)$(PREFIX)/man/man1/$(PKGNAME).1"
clean:
rm -f ./chhoto
rm -f ./chhoto.tar.gz
conf_tag := $(shell cat internal/config.go | sed -rn 's/^const version = "(.+)"$$/\1/p')
last_tag := $(shell git tag -l | tail -1)
bumped := $(shell git log -1 --pretty=%B | grep "build: Bumped version to " | wc -l)
tag:
ifneq (${conf_tag}, ${last_tag})
ifeq (${bumped}, 1)
git tag ${conf_tag} -m "Version ${conf_tag}"
endif
endif
aur: build tag
git push
tar --transform 's/.*\///g' -czf $(PKGNAME).tar.gz $(PKGNAME) $(PKGNAME).1
.PHONY: build install uninstall aur tag