Add build.go

This commit is contained in:
Alexander Neumann
2015-06-24 17:59:31 +02:00
parent c6db8eb19c
commit 9e9177ab73
6 changed files with 262 additions and 36 deletions

View File

@@ -1,18 +0,0 @@
.PHONY: all clean debug
# include config file if it exists
-include $(CURDIR)/config.mk
all: restic
debug: restic.debug
restic: $(wildcard *.go) $(wildcard ../../*.go) $(wildcard ../../*/*.go)
go build -a
restic.debug: $(wildcard *.go) $(wildcard ../../*.go) $(wildcard ../../*/*.go)
go build -a -tags debug -o restic.debug
clean:
go clean
rm -f restic restic.debug

View File

@@ -18,7 +18,8 @@ func init() {
}
func (cmd CmdVersion) Execute(args []string) error {
fmt.Printf("restic %s on %v\n", version, runtime.Version())
fmt.Printf("restic %s\ncompiled at %s with %v\n",
version, compiledAt, runtime.Version())
return nil
}

View File

@@ -17,6 +17,7 @@ import (
)
var version = "compiled manually"
var compiledAt = "unknown time"
type GlobalOptions struct {
Repo string `short:"r" long:"repo" description:"Repository directory to backup to/restore from"`

View File

@@ -1,13 +0,0 @@
#!/bin/sh
VERSION=$(git log --max-count=1 --pretty='%ad-%h' --date=short HEAD 2>/dev/null)
if [ -n "$VERSION" ]; then
if ! sh -c "git diff -s --exit-code && git diff --cached -s --exit-code"; then
VERSION+="+"
fi
else
VERSION="unknown version"
fi
echo $VERSION