v0.2.0 restructured to pipeline architecture, dirty

This commit is contained in:
2025-07-11 04:52:41 -04:00
parent 5936f82970
commit b503816de3
51 changed files with 4132 additions and 5936 deletions

View File

@ -1,31 +1,52 @@
# FILE: Makefile
BINARY_NAME := logwisp
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
GIT_COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
BUILD_TIME := $(shell date -u '+%Y-%m-%d_%H:%M:%S')
# LogWisp Makefile
# Compatible with GNU Make (Linux) and BSD Make (FreeBSD)
LDFLAGS := -ldflags "-X 'logwisp/src/internal/version.Version=$(VERSION)' \
-X 'logwisp/src/internal/version.GitCommit=$(GIT_COMMIT)' \
-X 'logwisp/src/internal/version.BuildTime=$(BUILD_TIME)'"
BINARY_NAME = logwisp
BUILD_DIR = bin
BINARY_PATH = $(BUILD_DIR)/$(BINARY_NAME)
VERSION != git describe --tags --always --dirty 2>/dev/null || echo "dev"
GIT_COMMIT != git rev-parse --short HEAD 2>/dev/null || echo "unknown"
BUILD_TIME != date -u '+%Y-%m-%d_%H:%M:%S'
.PHONY: build
# Go build variables
GO = go
GOFLAGS =
LDFLAGS = -X 'logwisp/src/internal/version.Version=$(VERSION)' \
-X 'logwisp/src/internal/version.GitCommit=$(GIT_COMMIT)' \
-X 'logwisp/src/internal/version.BuildTime=$(BUILD_TIME)'
# Installation directories
PREFIX ?= /usr/local
BINDIR = $(PREFIX)/bin
# Default target
all: build
# Build the binary
build:
go build $(LDFLAGS) -o $(BINARY_NAME) ./src/cmd/logwisp
mkdir -p $(BUILD_DIR)
$(GO) build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o $(BINARY_PATH) ./src/cmd/logwisp
.PHONY: install
# Install the binary
install: build
install -m 755 $(BINARY_NAME) /usr/local/bin/
install -m 755 $(BINARY_PATH) $(BINDIR)/
.PHONY: clean
# Uninstall the binary
uninstall:
rm -f $(BINDIR)/$(BINARY_PATH)
# Clean build artifacts
clean:
rm -f $(BINARY_NAME)
rm -f $(BINARY_PATH)
.PHONY: test
test:
go test -v ./...
# Development build with race detector
dev:
$(GO) build $(GOFLAGS) -race -ldflags "$(LDFLAGS)" -o $(BINARY_PATH) ./src/cmd/logwisp
.PHONY: release
release:
@if [ -z "$(TAG)" ]; then echo "TAG is required: make release TAG=v1.0.0"; exit 1; fi
git tag -a $(TAG) -m "Release $(TAG)"
git push origin $(TAG)
# Show current version
version:
@echo "Version: $(VERSION)"
@echo "Commit: $(GIT_COMMIT)"
@echo "Build Time: $(BUILD_TIME)"
.PHONY: all build install uninstall clean dev version