add makefile
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing

This commit is contained in:
stryan 2022-07-17 16:02:37 -04:00
parent 3cfe6216f2
commit 27296f8024

19
Makefile Normal file
View File

@ -0,0 +1,19 @@
GOFILES=$(wildcard *.go)
PROG=nunbot
#set variables
GIT_COMMIT := $(shell git rev-list -1 HEAD)
GIT_TAG := $(shell git describe --tags | cut -d- -f1)
ifeq ($(PREFIX),) # PREFIX is environment variable, but if it is not set, then set default value
PREFIX := /usr/local
endif
$(PROG): $(GOFILES)
go build -ldflags "-X main.GitCommit=$(GIT_COMMIT) -X main.GitTag=$(GIT_TAG)"
clean:
rm -f nunbot
install: $(NUNBOT)
install -d $(DESTDIR)$(PREFIX)/bin
install -m 755 $(PROG) $(DESTDIR)$(PREFIX)/bin