robotfs/Makefile
2025-05-12 20:23:33 +08:00

21 lines
664 B
Makefile

VERSION := $(shell git describe --tags --abbrev=0 2>/dev/null || echo "dev")
COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "unknown")
BUILD_TIME := $(shell date "+%Y-%m-%d %H:%M:%S")
LDFLAGS := -X gosvc.setVersionNumber=$(VERSION) \
-X gosvc.setVersionRelease=$(BRANCH) \
-X gosvc.setVersionBuildTime=$(BUILD_TIME) \
-X gosvc.setVersionDescription="RobotFS Service (commit: $(COMMIT))"
.PHONY: build
build:
go build -ldflags "$(LDFLAGS)" -o robotfs main.go
.PHONY: run
run: build
./robotfs
.PHONY: clean
clean:
rm -f robotfs