Skip to content

Commit

Permalink
option to build for use with delve
Browse files Browse the repository at this point in the history
  • Loading branch information
jokreliable committed Jun 11, 2021
1 parent dc1fc21 commit 8d63045
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions make/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ bootstra%:
#########################################

DATE := $(shell date -u '+%Y-%m-%d %H:%M UTC')
LDFLAGS := -ldflags='-w -X "main.Version=$(VERSION)" -X "main.BuildTime=$(DATE)"'
ifdef DEBUG
LDFLAGS := -ldflags='-X "main.Version=$(VERSION)" -X "main.BuildTime=$(DATE)"'
GCFLAGS := -gcflags "all=-N -l"
else
LDFLAGS := -ldflags='-w -X "main.Version=$(VERSION)" -X "main.BuildTime=$(DATE)"'
GCFLAGS :=
endif

download:
$Q go mod download
Expand All @@ -36,7 +42,7 @@ build: $(PREFIX)bin/$(BINNAME)

$(PREFIX)bin/$(BINNAME): download $(call rwildcard,*.go)
$Q mkdir -p $(@D)
$Q $(GOOS_OVERRIDE) $(CGO_OVERRIDE) go build -v -o $@ $(LDFLAGS) $(PKG)
$Q $(GOOS_OVERRIDE) $(CGO_OVERRIDE) go build -v -o $@ $(GCFLAGS) $(LDFLAGS) $(PKG)

.PHONY: build simple

Expand Down

0 comments on commit 8d63045

Please sign in to comment.