2015-05-01 04:40:06 +03:00
|
|
|
TARGETS = darwin/amd64 darwin/386 linux/amd64 linux/386 windows/amd64 windows/386
|
|
|
|
GIT_COMMIT = $(shell git rev-parse HEAD)
|
2015-05-05 08:34:23 +03:00
|
|
|
BUILD_TIME = $(shell date -u +"%Y-%m-%dT%H:%M:%SZ" | tr -d '\n')
|
2015-03-17 07:59:46 +03:00
|
|
|
DOCKER_RELEASE_TAG = "sosedoff/pgweb:$(shell git describe --abbrev=0 --tags | sed 's/v//')"
|
2016-06-28 04:54:29 +03:00
|
|
|
DOCKER_LATEST_TAG = "sosedoff/pgweb:latest"
|
2014-11-26 15:48:41 +03:00
|
|
|
BINDATA_IGNORE = $(shell git ls-files -io --exclude-standard $< | sed 's/^/-ignore=/;s/[.]/[.]/g')
|
2014-10-31 08:02:58 +03:00
|
|
|
|
2014-12-27 05:50:15 +03: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 23:15:57 +03:00
|
|
|
@echo "make bootstrap : Install cross-compilation toolchain"
|
2014-12-27 05:50:15 +03:00
|
|
|
@echo "make release : Generate binaries for all supported OSes"
|
2015-04-30 20:10:25 +03:00
|
|
|
@echo "make test : Execute test suite"
|
2016-01-18 00:22:51 +03:00
|
|
|
@echo "make test-all : Execute test suite on multiple PG versions"
|
2014-12-27 05:50:15 +03:00
|
|
|
@echo "make clean : Remove all build files and reset assets"
|
|
|
|
@echo "make assets : Generate production assets file"
|
|
|
|
@echo "make dev-assets : Generate development assets file"
|
2015-01-01 03:47:21 +03:00
|
|
|
@echo "make docker : Build docker image"
|
2015-03-17 08:01:28 +03:00
|
|
|
@echo "make docker-release : Build and tag docker image"
|
2016-06-28 04:54:29 +03:00
|
|
|
@echo "make docker-push : Push docker images to registry"
|
2014-12-27 05:50:15 +03:00
|
|
|
@echo ""
|
|
|
|
|
2014-12-18 06:39:03 +03:00
|
|
|
test:
|
2018-04-26 08:05:32 +03:00
|
|
|
go test -race -cover ./pkg/...
|
2014-12-18 06:39:03 +03:00
|
|
|
|
2016-01-18 00:22:51 +03:00
|
|
|
test-all:
|
|
|
|
@./script/test_all.sh
|
|
|
|
|
2014-11-26 15:48:41 +03:00
|
|
|
assets: static/
|
2015-04-30 19:47:07 +03:00
|
|
|
go-bindata -o pkg/data/bindata.go -pkg data $(BINDATA_OPTS) $(BINDATA_IGNORE) -ignore=[.]gitignore -ignore=[.]gitkeep $<...
|
2014-10-31 08:02:58 +03:00
|
|
|
|
2014-11-12 03:13:23 +03:00
|
|
|
dev-assets:
|
2014-11-26 15:41:25 +03:00
|
|
|
@$(MAKE) --no-print-directory assets BINDATA_OPTS="-debug"
|
2014-10-31 08:02:58 +03:00
|
|
|
|
2014-12-14 05:43:07 +03:00
|
|
|
dev: dev-assets
|
2016-05-26 22:32:08 +03:00
|
|
|
go build
|
2014-12-14 05:43:07 +03:00
|
|
|
@echo "You can now execute ./pgweb"
|
|
|
|
|
2014-11-12 03:13:23 +03:00
|
|
|
build: assets
|
2016-05-26 22:32:08 +03:00
|
|
|
go build
|
2014-12-14 05:43:07 +03:00
|
|
|
@echo "You can now execute ./pgweb"
|
|
|
|
|
2016-06-28 05:21:36 +03:00
|
|
|
release: clean assets
|
2015-05-07 05:24:15 +03:00
|
|
|
@echo "Building binaries..."
|
|
|
|
@gox \
|
2016-06-28 05:21:36 +03:00
|
|
|
-osarch "$(TARGETS)" \
|
2016-10-02 04:32:05 +03:00
|
|
|
-ldflags "-X github.com/sosedoff/pgweb/pkg/command.GitCommit=$(GIT_COMMIT) -X github.com/sosedoff/pgweb/pkg/command.BuildTime=$(BUILD_TIME)" \
|
2016-06-28 05:21:36 +03:00
|
|
|
-output "./bin/pgweb_{{.OS}}_{{.Arch}}"
|
|
|
|
|
|
|
|
@echo "Building ARM binaries..."
|
|
|
|
GOOS=linux GOARCH=arm GOARM=5 go build \
|
2016-10-02 04:32:05 +03:00
|
|
|
-ldflags "-X github.com/sosedoff/pgweb/pkg/command.GitCommit=$(GIT_COMMIT) -X github.com/sosedoff/pgweb/pkg/command.BuildTime=$(BUILD_TIME)" \
|
2016-06-28 05:21:36 +03:00
|
|
|
-o "./bin/pgweb_linux_arm_v5"
|
2014-10-25 21:55:12 +04:00
|
|
|
|
2015-05-07 05:24:15 +03:00
|
|
|
@echo "\nPackaging binaries...\n"
|
|
|
|
@./script/package.sh
|
|
|
|
|
2015-02-02 23:15:57 +03:00
|
|
|
bootstrap:
|
|
|
|
gox -build-toolchain
|
|
|
|
|
2014-10-25 05:52:15 +04:00
|
|
|
setup:
|
2018-04-26 08:04:48 +03:00
|
|
|
go get -u github.com/tools/godep
|
|
|
|
go get -u golang.org/x/tools/cmd/cover
|
|
|
|
go get -u github.com/mitchellh/gox
|
|
|
|
go get -u github.com/jteeuwen/go-bindata/...
|
2014-11-06 07:04:47 +03:00
|
|
|
godep restore
|
2014-10-11 02:32:47 +04:00
|
|
|
|
|
|
|
clean:
|
2016-06-28 05:21:36 +03:00
|
|
|
@rm -f ./pgweb
|
|
|
|
@rm -rf ./bin/*
|
|
|
|
@rm -f bindata.go
|
2014-11-06 03:27:14 +03:00
|
|
|
|
|
|
|
docker:
|
2015-03-17 07:59:46 +03:00
|
|
|
docker build -t pgweb .
|
|
|
|
|
|
|
|
docker-release:
|
2016-06-28 03:52:26 +03:00
|
|
|
docker build -t $(DOCKER_RELEASE_TAG) .
|
2016-06-28 04:54:29 +03:00
|
|
|
docker build -t $(DOCKER_LATEST_TAG) .
|
|
|
|
|
|
|
|
docker-push:
|
|
|
|
docker push $(DOCKER_RELEASE_TAG)
|
2017-04-27 12:16:10 +03:00
|
|
|
docker push $(DOCKER_LATEST_TAG)
|