From c69cecbebee575dc901b3ea12a16675e2da1b1d1 Mon Sep 17 00:00:00 2001 From: Jiaxin Shan Date: Mon, 14 Mar 2022 11:31:20 +0800 Subject: [PATCH] Add Makefile for cli project (#192) --- cli/Makefile | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 cli/Makefile diff --git a/cli/Makefile b/cli/Makefile new file mode 100644 index 00000000000..dbbd67e4589 --- /dev/null +++ b/cli/Makefile @@ -0,0 +1,19 @@ +OUTPUT_NAME := kuberay +BUILD_GOOS = $(shell go env GOOS) + +COMMIT := $(shell git rev-parse --short HEAD) +VERSION := $(shell git describe --tags $(shell git rev-list --tags --max-count=1)) +DATE=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ') +REPO="github.com/ray-project/kuberay" + +BUILD_FLAGS = -ldflags="-X '${REPO}/cli/pkg/cmd/version.Version=$(VERSION)' \ + -X '${REPO}/cli/pkg/cmd/version.gitCommit=$(COMMIT)' \ + -X '${REPO}/cli/pkg/cmd/version.buildDate=$(DATE)'" + +build: + go build $(BUILD_FLAGS) -o $(OUTPUT_NAME) main.go + chmod +x $(OUTPUT_NAME) + +# GOOS=linux GOARCH=amd64 make build +# GOOS=darwin GOARCH=amd64 make build +