diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-02-09 13:49:53 +0300 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-02-09 13:49:53 +0300 |
commit | 78de2cf5af7ba799590ec2c02c80276818d1aa36 (patch) | |
tree | 8b5a7cd3bbf183aec7f77b9ff94f61f3ce75624c /Makefile | |
parent | c45603a62842da51f241b61d25c4d4947d7a2652 (diff) |
Add Makefile with version
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..e356ef5c --- /dev/null +++ b/Makefile @@ -0,0 +1,21 @@ +REVISION := $(shell git rev-parse --short HEAD || echo unknown) +LAST_TAG := $(shell git describe --tags --abbrev=0) +COMMITS := $(shell echo `git log --oneline $(LAST_TAG)..HEAD | wc -l`) +VERSION := $(shell cat VERSION) + +ifneq ($(VERSION),$(LAST_TAG)) + VERSION := $(shell echo $(VERSION)~beta.$(COMMITS).g$(REVISION)) +endif + +GO_LDFLAGS ?= -X main.VERSION=$(VERSION) -X main.REVISION=$(REVISION) +GO_FILES ?= $(shell find . -name '*.go') + +export GO15VENDOREXPERIMENT := 1 + +all: gitlab-pages + +gitlab-pages: $(GO_FILES) + go build -o gitlab-pages --ldflags="$(GO_LDFLAGS)" + +update: + godep save ./... |