ocgo/Makefile
2026-05-07 09:27:49 +02:00

26 lines
593 B
Makefile

.PHONY: build run test clean install release
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
GOBIN := $(shell go env GOBIN)
GOPATH := $(shell go env GOPATH)
INSTALL_DIR := $(if $(GOBIN),$(GOBIN),$(GOPATH)/bin)
build:
go build -ldflags "-X main.version=$(VERSION)" -o bin/ocgo ./cmd/ocgo
run:
go run ./cmd/ocgo
test:
go test ./...
clean:
rm -rf bin
install: build
mkdir -p "$(INSTALL_DIR)"
install -m 0755 bin/ocgo "$(INSTALL_DIR)/ocgo"
release:
@[ -n "$(TAG)" ] || (echo "Usage: make release TAG=v0.1.0" && exit 1)
./scripts/release.sh "$(TAG)"