-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
58 lines (44 loc) · 1.63 KB
/
makefile
File metadata and controls
58 lines (44 loc) · 1.63 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
BINARY_CLI := secret2es
BINARY_SERVER := secret2es-server
DOCKER_REPO=wangguohao/secret2es
# Build information
VERSION=$(shell git describe --tags --always --dirty)
BUILD_TIME=$(shell date +%FT%T%z)
LDFLAGS=-ldflags "-X main.version=${VERSION} -X main.buildTime=${BUILD_TIME}"
all: build-cli build-server
build: build-cli
build-cli:
@echo "Building CLI tool..."
@go build -v -o $(BINARY_CLI) $(LDFLAGS) ./cmd/cli
build-server:
@echo "Building HTTP server..."
@go build -v -o $(BINARY_SERVER) $(LDFLAGS) ./cmd/server
print-binary-name:
@echo $(BINARY_CLI)
test:
@go test -v ./...
lint:
@echo "Running golangci-lint..."
@golangci-lint run
lint-install:
@echo "Installing golangci-lint..."
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
lint-fix:
@echo "Running golangci-lint with auto-fix..."
@golangci-lint run --fix
clean:
@echo "Cleaning up..."
@rm -rf bin/*
docker-build:
docker build --build-arg VERSION=$(VERSION) --build-arg BUILD_TIME=$(BUILD_TIME) -t $(DOCKER_REPO):$(VERSION) .
help:
@echo "Available commands:"
@echo " make build - Build both CLI and server binaries for the current platform"
@echo " make build-cli - Build only the CLI binary"
@echo " make build-server- Build only the server binary"
@echo " make clean - Remove all binaries from the bin directory"
@echo " make test - Run tests"
@echo " make lint - Run golangci-lint"
@echo " make lint-install- Install golangci-lint"
@echo " make lint-fix - Run golangci-lint with auto-fix"
.PHONY: all build build-cli build-server print-binary-name test lint lint-install lint-fix clean docker-build help