forked from flashmob/go-guerrilla
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
44 lines (36 loc) · 1.64 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
GIT ?= git
GO_VARS ?=
GO ?= go
COMMIT := $(shell $(GIT) rev-parse HEAD)
VERSION ?= $(shell $(GIT) describe --tags ${COMMIT} 2> /dev/null || echo "$(COMMIT)")
BUILD_TIME := $(shell LANG=en_US date +"%F_%T_%z")
ROOT := github.com/flashmob/go-guerrilla
LD_FLAGS := -X $(ROOT).Version=$(VERSION) -X $(ROOT).Commit=$(COMMIT) -X $(ROOT).BuildTime=$(BUILD_TIME)
.PHONY: help clean dependencies test
help:
@echo "Please use \`make <ROOT>' where <ROOT> is one of"
@echo " dependencies to go install the dependencies"
@echo " guerrillad to build the main binary for current platform"
@echo " test to run unittests"
clean:
rm -f guerrillad
dependencies:
$(GO_VARS) $(GO) list -f='{{ join .Deps "\n" }}' $(ROOT)/cmd/guerrillad | grep -v $(ROOT) | tr '\n' ' ' | $(GO_VARS) xargs $(GO) get -u -v
$(GO_VARS) $(GO) list -f='{{ join .Deps "\n" }}' $(ROOT)/cmd/guerrillad | grep -v $(ROOT) | tr '\n' ' ' | $(GO_VARS) xargs $(GO) install -v
guerrillad: *.go */*.go */*/*.go
$(GO_VARS) $(GO) build -o="guerrillad" -ldflags="$(LD_FLAGS)" $(ROOT)/cmd/guerrillad
guerrilladrace: *.go */*.go */*/*.go
$(GO_VARS) $(GO) build -o="guerrillad" -race -ldflags="$(LD_FLAGS)" $(ROOT)/cmd/guerrillad
test: *.go */*.go */*/*.go
$(GO_VARS) $(GO) test -v .
$(GO_VARS) $(GO) test -v ./tests
$(GO_VARS) $(GO) test -v ./cmd/guerrillad
$(GO_VARS) $(GO) test -v ./response
$(GO_VARS) $(GO) test -v ./backends
$(GO_VARS) $(GO) test -v ./mail
testrace: *.go */*.go */*/*.go
$(GO_VARS) $(GO) test -v . -race
$(GO_VARS) $(GO) test -v ./tests -race
$(GO_VARS) $(GO) test -v ./cmd/guerrillad -race
$(GO_VARS) $(GO) test -v ./response -race
$(GO_VARS) $(GO) test -v ./backends -race