-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
39 lines (28 loc) · 917 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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:
rm -rf $(BUILD_DIR) $(DIST_DIR)
dist: bin-dir bbgo-linux bbgo-darwin
mkdir -p $(DIST_DIR)
tar -C $(BUILD_DIR) -cvzf $(DIST_DIR)/bbgo-$$(git describe --tags).tar.gz .
docker:
GOPATH=$(PWD)/.mod go mod download
docker build --build-arg GO_MOD_CACHE=.mod --tag yoanlin/bbgo .
bash -c "[[ -n $(DOCKER_TAG) ]] && docker tag yoanlin/bbgo yoanlin/bbgo:$(DOCKER_TAG)"
docker-push:
docker push yoanlin/bbgo
bash -c "[[ -n $(DOCKER_TAG) ]] && docker push yoanlin/bbgo:$(DOCKER_TAG)"
.PHONY: dist