pgweb/Makefile

80 lines
2.8 KiB
Makefile
Raw Normal View History

2021-04-12 09:59:15 -05:00
TARGETS = darwin/amd64 darwin/arm64 linux/amd64 linux/386 windows/amd64 windows/386
GIT_COMMIT = $(shell git rev-parse HEAD)
BUILD_TIME = $(shell date -u +"%Y-%m-%dT%H:%M:%SZ" | tr -d '\n')
2019-11-29 13:59:50 -06:00
GO_VERSION = $(shell go version | awk {'print $$3'})
2015-03-16 23:59:46 -05:00
DOCKER_RELEASE_TAG = "sosedoff/pgweb:$(shell git describe --abbrev=0 --tags | sed 's/v//')"
DOCKER_LATEST_TAG = "sosedoff/pgweb:latest"
2014-12-26 20:50:15 -06:00
usage:
@echo ""
@echo "Task : Description"
@echo "----------------- : -------------------"
@echo "make setup : Install all necessary dependencies"
@echo "make dev : Generate development build"
@echo "make build : Generate production build for current OS"
2015-02-02 14:15:57 -06:00
@echo "make bootstrap : Install cross-compilation toolchain"
2014-12-26 20:50:15 -06:00
@echo "make release : Generate binaries for all supported OSes"
2015-04-30 12:10:25 -05:00
@echo "make test : Execute test suite"
2016-01-17 15:22:51 -06:00
@echo "make test-all : Execute test suite on multiple PG versions"
2014-12-26 20:50:15 -06:00
@echo "make clean : Remove all build files and reset assets"
2014-12-31 18:47:21 -06:00
@echo "make docker : Build docker image"
2015-03-17 00:01:28 -05:00
@echo "make docker-release : Build and tag docker image"
@echo "make docker-push : Push docker images to registry"
2014-12-26 20:50:15 -06:00
@echo ""
2014-12-17 21:39:03 -06:00
test:
go test -race -cover ./pkg/...
2014-12-17 21:39:03 -06:00
2016-01-17 15:22:51 -06:00
test-all:
@./script/test_all.sh
2018-06-05 18:20:58 -05:00
@./script/test_cockroach.sh
2016-01-17 15:22:51 -06:00
dev:
go build
@echo "You can now execute ./pgweb"
build:
go build
@echo "You can now execute ./pgweb"
release:
2015-05-06 21:24:15 -05:00
@echo "Building binaries..."
@gox \
2016-06-27 21:21:36 -05:00
-osarch "$(TARGETS)" \
-ldflags "-s -w -X github.com/sosedoff/pgweb/pkg/command.GitCommit=$(GIT_COMMIT) -X github.com/sosedoff/pgweb/pkg/command.BuildTime=$(BUILD_TIME) -X github.com/sosedoff/pgweb/pkg/command.GoVersion=$(GO_VERSION)" \
2016-06-27 21:21:36 -05:00
-output "./bin/pgweb_{{.OS}}_{{.Arch}}"
@echo "Building ARM binaries..."
GOOS=linux GOARCH=arm GOARM=5 go build \
-ldflags "-s -w -X github.com/sosedoff/pgweb/pkg/command.GitCommit=$(GIT_COMMIT) -X github.com/sosedoff/pgweb/pkg/command.BuildTime=$(BUILD_TIME) -X github.com/sosedoff/pgweb/pkg/command.GoVersion=$(GO_VERSION)" \
2016-06-27 21:21:36 -05:00
-o "./bin/pgweb_linux_arm_v5"
2014-10-25 12:55:12 -05:00
2020-12-05 15:26:57 -06:00
@echo "Building ARM64 binaries..."
GOOS=linux GOARCH=arm64 GOARM=7 go build \
2020-12-05 15:26:57 -06:00
-ldflags "-s -w -X github.com/sosedoff/pgweb/pkg/command.GitCommit=$(GIT_COMMIT) -X github.com/sosedoff/pgweb/pkg/command.BuildTime=$(BUILD_TIME) -X github.com/sosedoff/pgweb/pkg/command.GoVersion=$(GO_VERSION)" \
-o "./bin/pgweb_linux_arm64_v7"
2015-05-06 21:24:15 -05:00
@echo "\nPackaging binaries...\n"
@./script/package.sh
2015-02-02 14:15:57 -06:00
bootstrap:
gox -build-toolchain
setup:
go install github.com/mitchellh/gox@v1.0.1
2014-10-10 17:32:47 -05:00
clean:
2016-06-27 21:21:36 -05:00
@rm -f ./pgweb
@rm -rf ./bin/*
2014-11-05 18:27:14 -06:00
docker:
2019-12-16 17:26:23 -06:00
docker build --no-cache -t pgweb .
2015-03-16 23:59:46 -05:00
docker-release:
2019-07-24 17:28:15 -05:00
docker build --no-cache -t $(DOCKER_RELEASE_TAG) .
docker tag $(DOCKER_RELEASE_TAG) $(DOCKER_LATEST_TAG)
docker images $(DOCKER_RELEASE_TAG)
docker-push:
docker push $(DOCKER_RELEASE_TAG)
docker push $(DOCKER_LATEST_TAG)