File tree Expand file tree Collapse file tree 3 files changed +21
-10
lines changed
Expand file tree Collapse file tree 3 files changed +21
-10
lines changed Original file line number Diff line number Diff line change 1- OS := $(shell uname -a | cut -f 1 -d ' ' | tr [:upper:] [:lower:])
2- ARCH := $(shell uname -m)
3- TAG := $(shell git describe master --tag | cut -f 1 -d '-')
1+ OS := $(shell uname -a | cut -f 1 -d ' ' | tr [:upper:] [:lower:])
2+ ARCH := $(shell uname -m)
3+ TAG := $(shell git describe master --tags)
4+ TIMESTAMP := $(shell date -u '+% Y-% m-% dT% H:% M:% SZ')
45
5- all : build release
6+ all : build
67
78build :
8- @go build
9+ @go build -ldflags= " -X main.buildTime ' $( TIMESTAMP ) ' -X main.version ' $( TAG ) ' "
910
10- release :
11+ release : build
1112 @echo " Packaging cluefs ${TAG} for ${OS} "
1213 @tar -czf cluefs-${TAG} -${OS} -${ARCH} .tar.gz cluefs
14+
15+ clean :
16+ @rm cluefs cluefs-* .tar.gz
17+
18+ buildall : clean build
Original file line number Diff line number Diff line change @@ -374,6 +374,9 @@ func printVersionInfo(f *os.File) {
374374 const versionTempl = `
375375{{.AppName}} version {{.AppVersion}} ({{.Os}},{{.Arch}})
376376
377+ Built on:
378+ {{.Sp3}}{{.BuildTime}}
379+
377380Author:
378381{{.Sp3}}Fabio Hernandez
379382{{.Sp3}}IN2P3/CNRS computing center, Lyon (France)
@@ -384,6 +387,7 @@ Source code and documentation:
384387 fields := map [string ]string {
385388 "AppName" : programName ,
386389 "AppVersion" : version ,
390+ "BuildTime" : buildTime ,
387391 "Os" : runtime .GOOS ,
388392 "Arch" : runtime .GOARCH ,
389393 "Sp3" : " " ,
Original file line number Diff line number Diff line change @@ -7,13 +7,14 @@ import (
77 "path/filepath"
88)
99
10- const (
11- version = "0.2"
12- )
13-
1410var (
1511 programName string
1612 errlog * log.Logger
13+
14+ // The two variables below are set at build time for official releases
15+ // (see Makefile)
16+ version = "unknown"
17+ buildTime = "unknown"
1718)
1819
1920func init () {
You can’t perform that action at this time.
0 commit comments