Merge pull request #2456 from ismaell/build-flags

Simplify build flags setup
This commit is contained in:
Mislav Marohnić 2020-12-01 20:52:32 +01:00 committed by GitHub
commit a84b9f09d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,15 +9,12 @@ else
BUILD_DATE ?= $(shell date "$(DATE_FMT)")
endif
ifndef CGO_CPPFLAGS
export CGO_CPPFLAGS := $(CPPFLAGS)
endif
ifndef CGO_CFLAGS
export CGO_CFLAGS := $(CFLAGS)
endif
ifndef CGO_LDFLAGS
export CGO_LDFLAGS := $(LDFLAGS)
endif
CGO_CPPFLAGS ?= ${CPPFLAGS}
export CGO_CPPFLAGS
CGO_CFLAGS ?= ${CFLAGS}
export CGO_CFLAGS
CGO_LDFLAGS ?= ${LDFLAGS}
export CGO_LDFLAGS
GO_LDFLAGS := -X github.com/cli/cli/internal/build.Version=$(GH_VERSION) $(GO_LDFLAGS)
GO_LDFLAGS := -X github.com/cli/cli/internal/build.Date=$(BUILD_DATE) $(GO_LDFLAGS)
@ -27,7 +24,7 @@ ifdef GH_OAUTH_CLIENT_SECRET
endif
bin/gh: $(BUILD_FILES)
@go build -trimpath -ldflags "$(GO_LDFLAGS)" -o "$@" ./cmd/gh
go build -trimpath -ldflags "${GO_LDFLAGS}" -o "$@" ./cmd/gh
clean:
rm -rf ./bin ./share