-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
31 lines (24 loc) · 1.01 KB
/
Makefile
File metadata and controls
31 lines (24 loc) · 1.01 KB
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
VERSION=$(git describe --tags --always 2>/dev/null || echo "dev")
COMMIT=$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")
BUILD_TIME=$(date -u '+%Y-%m-%d_%H:%M:%S')
BUILD_MAIN=cmd/squarecloud/main.go
BUILD_DIR=bin
BUILD_LDFLAGS=-ldflags="\
-s -w \
-X github.com/squarecloudofc/cli/internal/build.Version=$(VERSION) \
-X github.com/squarecloudofc/cli/internal/build.Commit=$(COMMIT) \
-X github.com/squarecloudofc/cli/internal/build.CommitDate=$(BUILD_TIME) \
"
INSTALL_DIR=$(HOME)/.squarecloud/bin
build:
CGO_ENABLED=0 @go build $(BUILD_LDFLAGS) -o $(BUILD_DIR)/squarecloud $(BUILD_MAIN)
completions:
mkdir -p $(BUILD_DIR)/completions
@go run $(BUILD_MAIN) completion bash >"$(BUILD_DIR)/completions/completions-bash.bash"
@go run $(BUILD_MAIN) completion fish >"$(BUILD_DIR)/completions/completions-fish.fish"
@go run $(BUILD_MAIN) completion zsh >"$(BUILD_DIR)/completions/completions-zsh.zsh"
install: build
@mkdir -p $(INSTALL_DIR)
install bin/squarecloud $(INSTALL_DIR)
clean:
rm -r bin/