Hilbish/Makefile

31 lines
806 B
Makefile
Raw Normal View History

PREFIX ?= /usr
BINDIR ?= $(PREFIX)/bin
LIBDIR ?= $(PREFIX)/share/hilbish
2022-04-14 13:45:50 +00:00
MY_GOFLAGS = -ldflags "-s -w"
all: dev
2022-05-16 23:36:34 +00:00
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)"
2022-04-14 13:45:50 +00:00
dev: build
2021-05-17 23:04:20 +00:00
2022-04-14 13:45:50 +00:00
build:
go build $(MY_GOFLAGS)
2022-04-14 14:11:20 +00:00
install:
2022-04-14 13:45:50 +00:00
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)"
2022-04-14 13:45:50 +00:00
grep -qxF "$(DESTDIR)$(BINDIR)/hilbish" /etc/shells || echo "$(DESTDIR)$(BINDIR)/hilbish" >> /etc/shells
uninstall:
2022-04-14 13:45:50 +00:00
rm -vrf \
"$(DESTDIR)$(BINDIR)/hilbish" \
"$(DESTDIR)$(LIBDIR)"
2022-04-14 13:45:50 +00:00
sed -i '/hilbish/d' /etc/shells
clean:
2022-04-14 13:45:50 +00:00
go clean
2022-04-14 13:45:50 +00:00
.PHONY: all dev build install uninstall clean