-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (30 loc) · 1.16 KB
/
Makefile
File metadata and controls
37 lines (30 loc) · 1.16 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
.PHONY: build install test clean release-local
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
LDFLAGS := -s -w -X main.version=$(VERSION)
build:
go build -ldflags "$(LDFLAGS)" -o gitea-robot .
install: build
cp gitea-robot ~/bin/gitea-robot
@echo "Installed gitea-robot to ~/bin/gitea-robot"
test:
go vet ./...
@echo "Tests passed"
clean:
rm -f gitea-robot
rm -rf dist/
release-local:
mkdir -p dist
GOOS=darwin GOARCH=arm64 go build -ldflags "$(LDFLAGS)" -o dist/gitea-robot-darwin-arm64 .
GOOS=darwin GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o dist/gitea-robot-darwin-amd64 .
GOOS=linux GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o dist/gitea-robot-linux-amd64 .
GOOS=linux GOARCH=arm64 go build -ldflags "$(LDFLAGS)" -o dist/gitea-robot-linux-arm64 .
@echo "Built binaries in dist/"
help:
@echo "gitea-robot Makefile"
@echo ""
@echo " build Build for current platform"
@echo " install Build and install to ~/bin/"
@echo " test Run go vet"
@echo " clean Remove build artifacts"
@echo " release-local Cross-compile for common platforms"
@echo " help Show this help"