diff --git a/Makefile b/Makefile index 09a216f..ee6414f 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,10 @@ +GITREV=`git describe --tags | cut -c 2-` +LDFLAGS=-ldflags="-X 'github.com/writeas/writefreely.softwareVer=$(GITREV)'" + GOCMD=go -GOINSTALL=$(GOCMD) install -GOBUILD=$(GOCMD) build -GOTEST=$(GOCMD) test +GOINSTALL=$(GOCMD) install $(LDFLAGS) +GOBUILD=$(GOCMD) build $(LDFLAGS) +GOTEST=$(GOCMD) test $(LDFLAGS) GOGET=$(GOCMD) get BINARY_NAME=writefreely @@ -29,6 +32,6 @@ ui : force_look clean : cd less/; $(MAKE) clean $(MFLAGS) - + force_look : true diff --git a/app.go b/app.go index 0514f38..ada7392 100644 --- a/app.go +++ b/app.go @@ -33,10 +33,11 @@ const ( serverSoftware = "WriteFreely" softwareURL = "https://writefreely.org" - - softwareVer = "0.3" ) +// Software version can be set from git env using -ldflags +var softwareVer = "0.3" + var ( debugging bool