Skip to content

Commit

Permalink
feat: enable gcflags (compiler flags) to be passed into 'go build' (#…
Browse files Browse the repository at this point in the history
…8896)

* feat: enable gcflags (compiler flags) to be passed into 'go build'

Signed-off-by: Julie Vogelman <[email protected]>

* fix: remove accidental commit

Signed-off-by: Julie Vogelman <[email protected]>
  • Loading branch information
juliev0 authored Jun 2, 2022
1 parent 7a626aa commit 8592e9c
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ SRC := $(GOPATH)/src/github.com/argoproj/argo-workflows

GREP_LOGS := ""


# docker image publishing options
IMAGE_NAMESPACE ?= quay.io/argoproj
DEV_IMAGE ?= $(shell [ `uname -s` = Darwin ] && echo true || echo false)
Expand Down Expand Up @@ -176,20 +177,20 @@ dist/argo-windows-%.gz: dist/argo-windows-%
gzip --force --keep dist/argo-windows-$*.exe

dist/argo-windows-%: server/static/files.go $(CLI_PKGS) go.sum
CGO_ENABLED=0 $(GOARGS) go build -v -ldflags '${LDFLAGS} -extldflags -static' -o $@.exe ./cmd/argo
CGO_ENABLED=0 $(GOARGS) go build -v -gcflags '${GCFLAGS}' -ldflags '${LDFLAGS} -extldflags -static' -o $@.exe ./cmd/argo

dist/argo-%.gz: dist/argo-%
gzip --force --keep dist/argo-$*

dist/argo-%: server/static/files.go $(CLI_PKGS) go.sum
CGO_ENABLED=0 $(GOARGS) go build -v -ldflags '${LDFLAGS} -extldflags -static' -o $@ ./cmd/argo
CGO_ENABLED=0 $(GOARGS) go build -v -gcflags '${GCFLAGS}' -ldflags '${LDFLAGS} -extldflags -static' -o $@ ./cmd/argo

dist/argo: server/static/files.go $(CLI_PKGS) go.sum
ifeq ($(shell uname -s),Darwin)
# if local, then build fast: use CGO and dynamic-linking
go build -v -ldflags '${LDFLAGS}' -o $@ ./cmd/argo
go build -v -gcflags '${GCFLAGS}' -ldflags '${LDFLAGS}' -o $@ ./cmd/argo
else
CGO_ENABLED=0 go build -v -ldflags '${LDFLAGS} -extldflags -static' -o $@ ./cmd/argo
CGO_ENABLED=0 go build -gcflags '${GCFLAGS}' -v -ldflags '${LDFLAGS} -extldflags -static' -o $@ ./cmd/argo
endif

argocli-image:
Expand All @@ -205,9 +206,9 @@ controller: dist/workflow-controller
dist/workflow-controller: $(CONTROLLER_PKGS) go.sum
ifeq ($(shell uname -s),Darwin)
# if local, then build fast: use CGO and dynamic-linking
go build -v -ldflags '${LDFLAGS}' -o $@ ./cmd/workflow-controller
go build -gcflags '${GCFLAGS}' -v -ldflags '${LDFLAGS}' -o $@ ./cmd/workflow-controller
else
CGO_ENABLED=0 go build -v -ldflags '${LDFLAGS} -extldflags -static' -o $@ ./cmd/workflow-controller
CGO_ENABLED=0 go build -gcflags '${GCFLAGS}' -v -ldflags '${LDFLAGS} -extldflags -static' -o $@ ./cmd/workflow-controller
endif

workflow-controller-image:
Expand All @@ -216,9 +217,9 @@ workflow-controller-image:

dist/argoexec: $(ARGOEXEC_PKGS) go.sum
ifeq ($(shell uname -s),Darwin)
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -ldflags '${LDFLAGS} -extldflags -static' -o $@ ./cmd/argoexec
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -gcflags '${GCFLAGS}' -v -ldflags '${LDFLAGS} -extldflags -static' -o $@ ./cmd/argoexec
else
CGO_ENABLED=0 go build -v -ldflags '${LDFLAGS} -extldflags -static' -o $@ ./cmd/argoexec
CGO_ENABLED=0 go build -v -gcflags '${GCFLAGS}' -ldflags '${LDFLAGS} -extldflags -static' -o $@ ./cmd/argoexec
endif

argoexec-image:
Expand Down

0 comments on commit 8592e9c

Please sign in to comment.