-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
28 lines (27 loc) · 1.14 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
export ROOT=$(realpath $(dir $(firstword $(MAKEFILE_LIST))))
export APPNAME=cluster-tools
export DEFAULT_PASS=bita123
export GO=$(shell which go)
export NODE=$(shell which nodejs)
export GIT=$(shell which git)
export BIN=$(ROOT)/bin
export GOPATH=$(abspath $(ROOT)/../../..)
export GOBIN?=$(BIN)
export DIFF=$(shell which diff)
export WATCH?=hello
export ORIGIN_GIT_DIR?=$(ROOT)/.git
export LONGHASH?=$(shell git log -n1 --pretty="format:%H" | cat)
export SHORTHASH?=$(shell git log -n1 --pretty="format:%h"| cat)
export COMMITDATE?=$(shell git log -n1 --date="format:%D-%H-%I-%S" --pretty="format:%cd"| sed -e "s/\//-/g")
export IMPDATE=$(shell date +%Y%m%d)
export COMMITCOUNT?=$(shell git rev-list HEAD --count| cat)
export BUILDDATE=$(shell date "+%D/%H/%I/%S"| sed -e "s/\//-/g")
export FLAGS="-X version.hash=$(LONGHASH) -X version.short=$(SHORTHASH) -X version.date=$(COMMITDATE) -X version.count=$(COMMITCOUNT) -X version.build=$(BUILDDATE)"
export LDARG=-ldflags $(FLAGS)
export BUILD=cd $(ROOT) && $(GO) install -v $(LDARG)
export RUSER?=$(APPNAME)
export RPASS?=$(DEFAULT_PASS)
export WORK_DIR=$(ROOT)/tmp
all:
$(BUILD) ./...
include $(ROOT)/bin/build/*.mk