Replaced build system.
This commit is contained in:
19
Makefile
Normal file
19
Makefile
Normal 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
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
git update-index --assume-unchanged version.go
|
|
||||||
@@ -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
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
var Version = "v0.4.0"
|
|
||||||
Reference in New Issue
Block a user