-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathMakefile
30 lines (24 loc) · 1.18 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
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/maildiranasaurus
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 " maildiranasaurus to build the main binary for current platform"
@echo " test to run unittests"
clean:
rm -f maildiranasaurus
dependencies:
$(GO_VARS) $(GO) list -f='{{ join .Deps "\n" }}' $(ROOT)/cmd/maildiranasaurus | grep -v $(ROOT) | tr '\n' ' ' | $(GO_VARS) xargs $(GO) get -u -v
$(GO_VARS) $(GO) list -f='{{ join .Deps "\n" }}' $(ROOT)/cmd/maildiranasaurus | grep -v $(ROOT) | tr '\n' ' ' | $(GO_VARS) xargs $(GO) install -v
#maildiranasaurus: *.go */*.go */*/*.go
maildiranasaurus: */*/*.go
$(GO_VARS) $(GO) build -o="maildiranasaurus" -ldflags="$(LD_FLAGS)" $(ROOT)/cmd/maildiranasaurus
test: */*/*.go
$(GO_VARS) $(GO) test -v ./cmd/maildiranasaurus