-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
43 lines (31 loc) · 919 Bytes
/
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
.PHONY: all clean-all build cleand-deps deps ver
DATE := $(shell git log -1 --format="%cd" --date=short | sed s/-//g)
COUNT := $(shell git rev-list --count HEAD)
COMMIT := $(shell git rev-parse --short HEAD)
BINARYNAME := kekerd
VERSION := "${DATE}.${COUNT}_${COMMIT}"
LDFLAGS := "-X main.version=${VERSION}"
default: all
all: clean-all deps build
ver:
@echo ${VERSION}
clean-all: clean-deps
@echo Clean builded binaries
rm -rf .out/
@echo Done
build:
@echo Build
ln -s ${PWD}/vendor/ ${PWD}/vendor/src
GOPATH="${PWD}/vendor" go build -v -o .out/${BINARYNAME} -ldflags ${LDFLAGS} *.go
@echo Done
build-race:
@echo Build with race detection
ln -s ${PWD}/vendor/ ${PWD}/vendor/src
GOPATH="${PWD}/vendor" go build -race -v -o .out/${BINARYNAME} -ldflags ${LDFLAGS} *.go
@echo Done
clean-deps:
@echo Clean dependencies
rm -rf vendor/*
deps:
@echo Fetch dependencies
git submodule update --init