2020-11-11 08:34:20 +00:00
|
|
|
TARGET_ARCH ?= amd64
|
|
|
|
BUILD_DIR ?= build
|
|
|
|
BIN_DIR := $(BUILD_DIR)/bbgo
|
|
|
|
DIST_DIR ?= dist
|
|
|
|
GIT_DESC = $$(git describe --long --tags)
|
|
|
|
|
|
|
|
all: bbgo
|
|
|
|
|
|
|
|
$(BIN_DIR):
|
|
|
|
mkdir -p $@
|
|
|
|
|
|
|
|
bin-dir: $(BIN_DIR)
|
|
|
|
|
|
|
|
bbgo-linux: $(BIN_DIR)
|
|
|
|
GOOS=linux GOARCH=$(TARGET_ARCH) go build -o $(BIN_DIR)/$@ ./cmd/bbgo
|
|
|
|
|
|
|
|
bbgo-darwin:
|
|
|
|
GOOS=darwin GOARCH=$(TARGET_ARCH) go build -o $(BIN_DIR)/$@ ./cmd/bbgo
|
|
|
|
|
|
|
|
bbgo:
|
|
|
|
go build -o $(BIN_DIR)/$@ ./cmd/$@
|
|
|
|
|
|
|
|
clean:
|
2020-11-12 08:55:26 +00:00
|
|
|
rm -rf $(BUILD_DIR) $(DIST_DIR)
|
2020-11-11 08:34:20 +00:00
|
|
|
|
|
|
|
dist: bin-dir bbgo-linux bbgo-darwin
|
|
|
|
mkdir -p $(DIST_DIR)
|
|
|
|
tar -C $(BUILD_DIR) -cvzf $(DIST_DIR)/bbgo-$$(git describe --tags).tar.gz .
|
|
|
|
|
2021-01-15 02:31:37 +00:00
|
|
|
migrations:
|
2021-02-06 01:51:11 +00:00
|
|
|
rockhopper compile --config rockhopper_mysql.yaml --output pkg/migrations/mysql
|
|
|
|
rockhopper compile --config rockhopper_sqlite.yaml --output pkg/migrations/sqlite3
|
|
|
|
git add -v pkg/migrations && git commit -m "compile and update migration package" pkg/migrations || true
|
2021-01-15 02:31:37 +00:00
|
|
|
|
2020-12-15 09:53:11 +00:00
|
|
|
docker:
|
2021-01-29 03:19:21 +00:00
|
|
|
GOPATH=$(PWD)/_mod go mod download
|
|
|
|
docker build --build-arg GO_MOD_CACHE=_mod --tag yoanlin/bbgo .
|
2020-12-17 08:19:31 +00:00
|
|
|
bash -c "[[ -n $(DOCKER_TAG) ]] && docker tag yoanlin/bbgo yoanlin/bbgo:$(DOCKER_TAG)"
|
2020-12-15 09:53:11 +00:00
|
|
|
|
2021-02-04 10:22:47 +00:00
|
|
|
|
2020-12-17 08:32:16 +00:00
|
|
|
docker-push:
|
|
|
|
docker push yoanlin/bbgo
|
|
|
|
bash -c "[[ -n $(DOCKER_TAG) ]] && docker push yoanlin/bbgo:$(DOCKER_TAG)"
|
|
|
|
|
2021-02-04 12:30:51 +00:00
|
|
|
frontend/out/index.html: .FORCE
|
2021-01-29 03:19:21 +00:00
|
|
|
(cd frontend && yarn export)
|
2021-02-04 12:30:51 +00:00
|
|
|
|
|
|
|
pkged.go: frontend/out/index.html
|
2021-01-29 03:19:21 +00:00
|
|
|
pkger
|
2021-02-04 12:34:51 +00:00
|
|
|
git commit pkged.go -m "pkger: update bundled static files"
|
2021-01-29 03:19:21 +00:00
|
|
|
|
2021-02-04 12:30:51 +00:00
|
|
|
static: frontend/out/index.html pkged.go
|
|
|
|
|
2021-02-04 12:36:34 +00:00
|
|
|
build/BBGO.app/Contents/MacOS/bbgo-desktop: .FORCE
|
2021-02-04 12:30:51 +00:00
|
|
|
mkdir -p $(dir $@)
|
|
|
|
go build -o $@ ./cmd/bbgo-desktop
|
|
|
|
|
|
|
|
desktop: static build/BBGO.app/Contents/MacOS/bbgo-desktop
|
2021-02-04 10:22:47 +00:00
|
|
|
# bash desktop/build-darwin.sh
|
|
|
|
|
2021-01-29 03:19:21 +00:00
|
|
|
tools:
|
|
|
|
GO111MODULES=off go get github.com/markbates/pkger/cmd/pkger
|
|
|
|
|
2021-02-04 12:30:51 +00:00
|
|
|
.PHONY: dist migrations static desktop .FORCE
|