Skip to content

Commit 9d372bc

Browse files
committed
Merge branch 'develop'
2 parents 6bcaf86 + e236d1c commit 9d372bc

File tree

3 files changed

+21
-10
lines changed

3 files changed

+21
-10
lines changed

Makefile

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
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

78
build:
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

args.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
377380
Author:
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": " ",

globals.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ import (
77
"path/filepath"
88
)
99

10-
const (
11-
version = "0.2"
12-
)
13-
1410
var (
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

1920
func init() {

0 commit comments

Comments
 (0)