From a6aa1ff2d2bfb51350a3f7aac6c688f70c006dce Mon Sep 17 00:00:00 2001 From: Antoine Date: Mon, 1 Jun 2020 21:22:11 +0200 Subject: [PATCH] :wrench: Update Makefile and .gitignore Add go compiler flag to makefile Add makefile target with debug compiler flag Exclude Idea project file --- .gitignore | 4 +++- Makefile | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 6f68fe36..ad35f9b9 100644 --- a/.gitignore +++ b/.gitignore @@ -18,4 +18,6 @@ site/ # Editors .vscode/ -.local/ \ No newline at end of file +.local/ +.idea/ +*.iml \ No newline at end of file diff --git a/Makefile b/Makefile index f108f7b9..8eea3767 100644 --- a/Makefile +++ b/Makefile @@ -33,6 +33,7 @@ TAGS := TESTS := . TESTFLAGS := LDFLAGS := -w -s -X github.com/rancher/k3d/version.Version=${GIT_TAG} -X github.com/rancher/k3d/version.K3sVersion=${K3S_TAG} +GCFLAGS := GOFLAGS := BINDIR := $(CURDIR)/bin BINARIES := k3d @@ -68,8 +69,11 @@ LINT_DIRS := $(DIRS) $(foreach dir,$(REC_DIRS),$(dir)/...) all: clean fmt check build +build-debug: GCFLAGS+="all=-N -l" +build-debug: build + build: - CGO_ENABLED=0 $(GO) build $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -o '$(BINDIR)/$(BINARIES)' + CGO_ENABLED=0 $(GO) build $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -gcflags '$(GCFLAGS)' -o '$(BINDIR)/$(BINARIES)' build-cross: LDFLAGS += -extldflags "-static" build-cross: