-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
44 lines (35 loc) · 1.19 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
# Go parameters
GOCMD=go
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test -p 1
# PATHS
PROJECT_DIR = $(shell pwd -L)
TOOLSDIR = $(PROJECT_DIR)/tools
BIN_DIR = $(PROJECT_DIR)/bin
# tools needed for the project
TOOLS := github.com/golang/mock/mockgen
# ------------------------------------------------------------------------------
# tools
# ------------------------------------------------------------------------------
tools: $(TOOLSDIR) $(BIN_DIR) ## install tools
@ $(MAKE) $(BIN_DIR)
updatetools: $(TOOLSDIR) ## update all tools
@ cd $(TOOLSDIR) && GOFLAGS="-mod=" go get -u -v $(TOOLS)
@ $(MAKE) tools
all: test build
test:
$(GOTEST) ./...
clean:
$(GOCLEAN)
# ------------------------------------------------------------------------------
# cleanup
# ------------------------------------------------------------------------------
clean-tools: ## remove tooling
@ rm -rf $(BIN_DIR)
# ------------------------------------------------------------------------------
# directories
# ------------------------------------------------------------------------------
$(BIN_DIR):
@ cd $(TOOLSDIR) && GOBIN=$(BIN_DIR) GOFLAGS="-mod=" go install $(TOOLS)
$(TOOLSDIR):
@ mkdir -p $(TOOLSDIR)