mirror of https://github.com/Hilbis/Hilbish
build!: replace make with task
allows easy windows building (besides literally go build) down the line because getting make on windows is dumb and even if you do it probably wouldnt work as intended on there (i also find task more intuitive for simple things)taskfile
parent
587d08773f
commit
d057f4fe76
30
Makefile
30
Makefile
|
@ -1,30 +0,0 @@
|
||||||
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
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
# https://taskfile.dev
|
||||||
|
|
||||||
|
version: '3'
|
||||||
|
|
||||||
|
vars:
|
||||||
|
PREFIX: '{{default "/usr" .PREFIX}}'
|
||||||
|
bindir__: '{{.PREFIX}}/bin'
|
||||||
|
BINDIR: '{{default .bindir__ .BINDIR}}'
|
||||||
|
libdir__: '{{.PREFIX}}/share/hilbish'
|
||||||
|
LIBDIR: '{{default .libdir__ .LIBDIR}}'
|
||||||
|
GOFLAGS: '-ldflags "-s -w"'
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
default:
|
||||||
|
cmds:
|
||||||
|
- go build {{.GOFLAGS}}
|
||||||
|
vars:
|
||||||
|
GOFLAGS: '-ldflags "-s -w -X main.gitCommit=$(git rev-parse --short HEAD) -X main.gitBranch=$(git rev-parse --abbrev-ref HEAD)"'
|
||||||
|
|
||||||
|
build:
|
||||||
|
cmds:
|
||||||
|
- go build {{.GOFLAGS}}
|
||||||
|
|
||||||
|
install:
|
||||||
|
cmds:
|
||||||
|
- 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:
|
||||||
|
cmds:
|
||||||
|
- rm -vrf
|
||||||
|
"{{.DESTDIR}}{{.BINDIR}}/hilbish"
|
||||||
|
"{{.DESTDIR}}{{.LIBDIR}}"
|
||||||
|
- sed -i '/hilbish/d' /etc/shells
|
Loading…
Reference in New Issue