vega/testbot/Makefile

38 lines
747 B
Makefile
Raw Normal View History

2020-04-21 16:05:51 -04:00
PREFIX?=/usr/local
_INSTDIR=$(DESTDIR)$(PREFIX)
BINDIR?=$(_INSTDIR)/bin
GO?=go
GOFLAGS?=
GOSRC!=find . -name '*.go'
GOSRC+=go.mod go.sum
RM?=rm -f
testbot: $(GOSRC)
$(GO) build $(GOFLAGS) \
-ldflags "-s -w" \
-o $@
all: testbot
install: all
mkdir -m755 -p $(BINDIR) /etc/testbot
install -m755 testbot $(BINDIR)/testbot
install -m644 config.yaml.sample /etc/testbot/
service: all install
install -m644 testbot.service /etc/systemd/system/
clean:
$(RM) testbot
RMDIR_IF_EMPTY:=sh -c '\
if test -d $$0 && ! ls -1qA $$0 | grep -q . ; then \
rmdir $$0; \
fi'
uninstall:
$(RM) $(BINDIR)/testbot
$(RM) /etc/systemd/system/testbot.service
${RMDIR_IF_EMPTY} /etc/testbot
.DEFAULT_GOAL := all
.PHONY: all install service uninstall clean