From 02a8b5ec16dfcec85bf995eac23b5837c6b46a53 Mon Sep 17 00:00:00 2001 From: c9s Date: Wed, 11 Nov 2020 16:34:20 +0800 Subject: [PATCH] add Makefile for building dist files --- Makefile | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..acc7d31da --- /dev/null +++ b/Makefile @@ -0,0 +1,30 @@ +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: bin-dir bbgo-linux bbgo-darwin + mkdir -p $(DIST_DIR) + tar -C $(BUILD_DIR) -cvzf $(DIST_DIR)/bbgo-$$(git describe --tags).tar.gz . + +.PHONY: dist