From 0ec1696c342e9038a8fd860545bc6e525faf2183 Mon Sep 17 00:00:00 2001 From: Steve Date: Wed, 31 Mar 2021 16:29:28 -0400 Subject: [PATCH] better makefile --- Makefile | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index f2e404d..dbaa428 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,19 @@ -GIT_COMMIT := $(shell git rev-list -1 HEAD) -all: +#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 + +guildgate: go build -ldflags "-X main.GitCommit=$(GIT_COMMIT)" + +clean: + rm -f guildgate + +install: + install -d $(DESTDIR)$(PREFIX)/bin + install -m 755 guildgate $(DESTDIR)$(PREFIX)/bin + install -d $(DESTDIR)$(PREFIX)/share/guildgate/templates + install -D templates/* $(DESTDIR)$(PREFIX)/share/guildgate/templates +