New make file

This commit is contained in:
Carlos Salguero
2017-01-30 21:30:53 -03:00
parent 8ad1b01750
commit e5dea1e0e3
3 changed files with 28 additions and 21 deletions

View File

@@ -3,6 +3,8 @@ Changelog for Percona Toolkit
* Fixed bug 1402776: Improved fix (protocol parser fix): error when parsing tcpdump capture with pt-query-digest
* Fixed bug 1632522: pt-osc: Fails with duplicate key in table for self-referencing (Thanks Amiel Marqeta)
* Fixed bug 1654668: pt-summary exists with an error (Thanks Marcelo Altmann)
* New tool : pt-mongodb-summary
* New tool : pt-mongodb-query-digest
v2.2.20 released 2016-12-09

View File

@@ -1,5 +1,5 @@
GO := go
pkgs = $(shell $(GO) list ./... | grep -v /vendor/)
pkgs = $(shell find . -type d -name "pt-mongodb*" -exec basename {} \;)
VERSION=$(shell git describe --tags)
BUILD=$(shell date +%FT%T%z)
GOVERSION=$(shell go version | cut --delimiter=" " -f3)
@@ -8,13 +8,22 @@ PREFIX=$(shell pwd)
BIN_DIR=$(shell git rev-parse --show-toplevel)/bin
LDFLAGS="-X main.Version=${VERSION} -X main.Build=${BUILD} -X main.GoVersion=${GOVERSION}"
.PHONY: all style format build test vet tarball linux-amd64
build-all:
@echo ">> building all binaries in ${BIN_DIR}. OS & platform will be appended to the file name"
@echo "LDFLAGS: ${LDFLAGS}"
@gox -ldflags=${LDFLAGS} -osarch="linux/amd64 linux/386 darwin/amd64" -output=${BIN_DIR}"/{{.Dir}}_{{.OS}}_{{.Arch}}" $(pkgs)
linux-amd64:
@echo "Building linux/amd64 binaries in ${BIN_DIR}"
@$(foreach pkg,$(pkgs),rm -f ${BIN_DIR}/$(pkg) 2> /dev/null;)
@$(foreach pkg,$(pkgs),GOOS=linux GOARCH=amd64 go build -ldflags ${LDFLAGS} -o ${BIN_DIR}/$(pkg) ./$(pkg);)
all: format gox test
linux-386:
@echo "Building linux/386 binaries in ${BIN_DIR}"
@$(foreach pkg,$(pkgs),rm -f ${BIN_DIR}/$(pkg) 2> /dev/null;)
@$(foreach pkg,$(pkgs),GOOS=linux GOARCH=386 go build -ldflags ${LDFLAGS} -o ${BIN_DIR}/$(pkg) ./$(pkg);)
darwin-amd64:
@echo "Building darwin/amd64 binaries in ${BIN_DIR}"
@$(foreach pkg,$(pkgs),rm -f ${BIN_DIR}/$(pkg) 2> /dev/null;)
@$(foreach pkg,$(pkgs),GOOS=darwin GOARCH=amd64 go build -ldflags ${LDFLAGS} -o ${BIN_DIR}/$(pkg) ./$(pkg);)
style:
@echo ">> checking code style"
@@ -32,16 +41,3 @@ vet:
@echo ">> vetting code"
@$(GO) vet $(pkgs)
linux-amd64:
@echo ">> building linux/amd64 binaries in $(BIN_DIR)"
gox -ldflags ${LDFLAGS} -osarch="linux/amd64" -output=${BIN_DIR}"/{{.Dir}}" $(pkgs)
linux-386:
@echo ">> building linux/386 binaries in $(BIN_DIR)"
gox -ldflags ${LDFLAGS} -osarch="linux/amd64" -output=${BIN_DIR}"/{{.Dir}}" $(pkgs)
darwin-amd64:
@echo ">> building darwin/amd64 binaries in $(BIN_DIR)"
gox -ldflags ${LDFLAGS} -osarch="darwin/amd64" -output=${BIN_DIR}"/{{.Dir}}" $(pkgs)
.PHONY: all style format build test vet tarball

View File

@@ -73,12 +73,13 @@ SPHINX_CONFIG_DIR=$BRANCH/config/sphinx-build
DEB_CONFIG_DIR=$BRANCH/config/deb
RPM_CONFIG_DIR=$BRANCH/config/rpm
RELEASE_DIR=$BRANCH/release
GO_SRC_DIR=$(git rev-parse --show-toplevel)/src/go
# ############################################################################
# Programs and their options
# ############################################################################
TAR=${TAR:-tar}
TAR=${TAR:-tar}
# ############################################################################
# Subroutines
@@ -422,10 +423,18 @@ build_deb() {
# ############################################################################
if [ $# -lt 2 ]; then
die "Usage: $0 VERSION RELEASE_NOTES"
echo "Usage: $0 VERSION RELEASE_NOTES OS-ARCH"
echo "Example: $0 3.1 docs/release_notes.rst linux-amd64"
echo "Valid OS-ARCH combinations are: linux-amd64, linux-386, darwin-amd64"
die "Please try again with different parameters"
fi
VERSION=$1
REL_NOTES=$2
OS_ARCH=${3:-linux-amd64}
if [ $OS_ARCH != "linux-amd64" && $OS_ARCH != "linux-386" && $OS_ARCH != "darwin-amd64" ]; then
die "Valid OS-ARCH combinations are: linux-amd64, linux-386, darwin-amd64"
fi
if [ ! -f $REL_NOTES ]; then
die "$REL_NOTES does not exist"