From f450ed6514def6235405754689b5bd90636daf92 Mon Sep 17 00:00:00 2001 From: Cory Bennett Date: Sun, 21 Aug 2016 00:18:53 -0700 Subject: [PATCH] add "make debug" target --- Makefile | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 25d14a9..d5ed126 100644 --- a/Makefile +++ b/Makefile @@ -27,11 +27,21 @@ GOBIN ?= $(CWD) CURVER ?= $(patsubst v%,%,$(shell [ -d .git ] && git describe --abbrev=0 --tags || grep ^\#\# CHANGELOG.md | awk '{print $$2; exit}')) LDFLAGS:=-X jira.VERSION=$(CURVER) -w -GOBUILD=go build -v -ldflags "$(LDFLAGS) -s" + +# use make DEBUG=1 and you can get a debuggable golang binary +# see https://github.com/mailgun/godebug +ifneq ($(DEBUG),) + GOBUILD=go get -v github.com/mailgun/godebug && ./bin/godebug build +else + GOBUILD=go build -v -ldflags "$(LDFLAGS) -s" +endif build: $(GOBUILD) -o '$(BIN)' $(NAME).go +debug: + $(MAKE) DEBUG=1 + vet: @go tool vet *.go