-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathMakefile
More file actions
32 lines (23 loc) · 884 Bytes
/
Copy pathMakefile
File metadata and controls
32 lines (23 loc) · 884 Bytes
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
APP := opencode2api
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo none)
DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
LDFLAGS := -s -w -X github.com/6Kmfi6HP/opencode2api/internal/app.version=$(VERSION) -X github.com/6Kmfi6HP/opencode2api/internal/app.commit=$(COMMIT) -X github.com/6Kmfi6HP/opencode2api/internal/app.date=$(DATE)
.PHONY: fmt test vet build release-snapshot clean version release
version:
@echo $(VERSION)
release:
@./scripts/release.sh $(filter-out $@,$(MAKECMDGOALS))
fmt:
gofmt -w ./cmd ./internal
test:
go test ./...
vet:
go vet ./...
build:
mkdir -p bin
go build -trimpath -ldflags "$(LDFLAGS)" -o bin/$(APP) ./cmd/opencode2api
release-snapshot:
VERSION=$(VERSION) COMMIT=$(COMMIT) DATE=$(DATE) ./scripts/build-release.sh
clean:
rm -rf bin dist