build: return Makefile

pull/194/head
Sơn Phan Trung 2022-08-12 11:46:53 +07:00 committed by GitHub
parent 387d7d2243
commit 59739e929a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 1 deletions

View File

@ -1,7 +1,7 @@
# 🎀 Changelog
## Unreleased
**NOTE:** Hilbish now uses [Task] insead of Make for builds.
**NOTE:** Hilbish now uses [Task] insead of Make for builds. Make is still available as a build method.
[Task]: https://taskfile.dev/#/

30
Makefile 100644
View File

@ -0,0 +1,30 @@
PREFIX ?= /usr
BINDIR ?= $(PREFIX)/bin
LIBDIR ?= $(PREFIX)/share/hilbish
MY_GOFLAGS = -ldflags "-s -w"
all: dev
dev: MY_GOFLAGS = -ldflags "-s -w -X main.gitCommit=$(shell git rev-parse --short HEAD) -X main.gitBranch=$(shell git rev-parse --abbrev-ref HEAD)"
dev: build
build:
go build $(MY_GOFLAGS)
install:
install -v -d "$(DESTDIR)$(BINDIR)/" && install -m 0755 -v hilbish "$(DESTDIR)$(BINDIR)/hilbish"
mkdir -p "$(DESTDIR)$(LIBDIR)"
cp -r libs docs emmyLuaDocs nature .hilbishrc.lua "$(DESTDIR)$(LIBDIR)"
grep -qxF "$(DESTDIR)$(BINDIR)/hilbish" /etc/shells || echo "$(DESTDIR)$(BINDIR)/hilbish" >> /etc/shells
uninstall:
rm -vrf \
"$(DESTDIR)$(BINDIR)/hilbish" \
"$(DESTDIR)$(LIBDIR)"
sed -i '/hilbish/d' /etc/shells
clean:
go clean
.PHONY: all dev build install uninstall clean