From 0e7396c9779c12b83011f6a5be9eb3b2ebf78971 Mon Sep 17 00:00:00 2001 From: Steve Date: Fri, 21 May 2021 16:02:18 -0400 Subject: [PATCH] add standard makefile --- Makefile | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..03f75d2 --- /dev/null +++ b/Makefile @@ -0,0 +1,18 @@ +GOFILES=$(wildcard *.go) +PROG=simpbot +#set variables +GIT_COMMIT := $(shell git rev-list -1 HEAD) +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)" + +clean: + rm -f simpbot + +install: $(SIMPBOT) + install -d $(DESTDIR)$(PREFIX)/bin + install -m 755 $(PROG) $(DESTDIR)$(PREFIX)/bin +