Replaced build system.

This commit is contained in:
2025-12-10 21:09:52 +01:00
parent 2ddd22631b
commit e3c812592b
4 changed files with 19 additions and 13 deletions

19
Makefile Normal file
View File

@@ -0,0 +1,19 @@
# Get version from git tags
VERSION := $(shell git describe --tags --always 2>/dev/null)
.PHONY: clean
build/lab-ca: main.go ca.go certdb.go
@mkdir -p build
ifneq ($(VERSION),)
@echo "Building version: $(VERSION)"
go build -o build/lab-ca -ldflags "-X main.Version=$(VERSION)"
else
@echo "Building without version information"
go build -o build/lab-ca .
endif
lab-ca: build/lab-ca
clean:
rm -f build/lab-ca

View File

@@ -1,3 +0,0 @@
#!/bin/bash
git update-index --assume-unchanged version.go

View File

@@ -1,7 +0,0 @@
#!/bin/bash
VERSION=${1:-$(git describe --tags --always --dirty 2>/dev/null || echo "dev")}
# Allow git to track changes to version.go
git update-index --no-assume-unchanged version.go
# Hardcode the version into main.go
sed -i '' "s/^var Version = .*/var Version = \"$VERSION\"/" version.go

View File

@@ -1,3 +0,0 @@
package main
var Version = "v0.4.0"