Merge pull request #592 from sosedoff/default-build-flags
Set LDFLAGS for make build/release commands
This commit is contained in:
commit
f493d0d04d
18
Makefile
18
Makefile
@ -1,10 +1,15 @@
|
|||||||
GIT_COMMIT = $(shell git rev-parse HEAD)
|
PKG = github.com/sosedoff/pgweb
|
||||||
BUILD_TIME = $(shell date -u +"%Y-%m-%dT%H:%M:%SZ" | tr -d '\n')
|
GIT_COMMIT ?= $(shell git rev-parse HEAD)
|
||||||
GO_VERSION = $(shell go version | awk {'print $$3'})
|
BUILD_TIME ?= $(shell date -u +"%Y-%m-%dT%H:%M:%SZ" | tr -d '\n')
|
||||||
|
GO_VERSION ?= $(shell go version | awk {'print $$3'})
|
||||||
|
|
||||||
DOCKER_RELEASE_TAG = "sosedoff/pgweb:$(shell git describe --abbrev=0 --tags | sed 's/v//')"
|
DOCKER_RELEASE_TAG = "sosedoff/pgweb:$(shell git describe --abbrev=0 --tags | sed 's/v//')"
|
||||||
DOCKER_LATEST_TAG = "sosedoff/pgweb:latest"
|
DOCKER_LATEST_TAG = "sosedoff/pgweb:latest"
|
||||||
|
|
||||||
LDFLAGS = -s -w
|
LDFLAGS = -s -w
|
||||||
PKG = github.com/sosedoff/pgweb
|
LDFLAGS += -X $(PKG)/pkg/command.GitCommit=$(GIT_COMMIT)
|
||||||
|
LDFLAGS += -X $(PKG)/pkg/command.BuildTime=$(BUILD_TIME)
|
||||||
|
LDFLAGS += -X $(PKG)/pkg/command.GoVersion=$(GO_VERSION)
|
||||||
|
|
||||||
usage:
|
usage:
|
||||||
@echo ""
|
@echo ""
|
||||||
@ -37,16 +42,13 @@ dev:
|
|||||||
@echo "You can now execute ./pgweb"
|
@echo "You can now execute ./pgweb"
|
||||||
|
|
||||||
build:
|
build:
|
||||||
go build
|
go build -ldflags '${LDFLAGS}'
|
||||||
@echo "You can now execute ./pgweb"
|
@echo "You can now execute ./pgweb"
|
||||||
|
|
||||||
install:
|
install:
|
||||||
go install
|
go install
|
||||||
@echo "You can now execute pgweb"
|
@echo "You can now execute pgweb"
|
||||||
|
|
||||||
release: LDFLAGS += -X $(PKG)/pkg/command.GitCommit=$(GIT_COMMIT)
|
|
||||||
release: LDFLAGS += -X $(PKG)/pkg/command.BuildTime=$(BUILD_TIME)
|
|
||||||
release: LDFLAGS += -X $(PKG)/pkg/command.GoVersion=$(GO_VERSION)
|
|
||||||
release: clean
|
release: clean
|
||||||
@echo "Building binaries..."
|
@echo "Building binaries..."
|
||||||
@LDFLAGS='${LDFLAGS}' ./script/build_all.sh
|
@LDFLAGS='${LDFLAGS}' ./script/build_all.sh
|
||||||
|
Loading…
x
Reference in New Issue
Block a user