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 .
|
|
|
|
|
2020-12-15 09:53:11 +00:00
|
|
|
docker:
|
2020-12-15 10:57:46 +00:00
|
|
|
GOPATH=$(PWD)/.mod go mod download
|
2020-12-17 06:44:19 +00:00
|
|
|
docker build --build-arg GO_MOD_CACHE=.mod --tag yoanlin/bbgo .
|
2020-12-15 09:53:11 +00:00
|
|
|
|
2020-11-11 08:34:20 +00:00
|
|
|
.PHONY: dist
|