-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
67 lines (51 loc) · 1.23 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
################################################################################
# Setup
SHELL = /bin/bash
.DEFAULT_GOAL := build
.SUFFIXES =
.SUFFIXES = .go
GOCMD = go
BINARY_LINUX = greg
BINARY_WINDOWS = greg.exe
ALL_FILES = ./...
BIN_DIR = ./bin
################################################################################
# Flags
ifneq ($(VERBOSE),)
VERBOSE = -v
endif
################################################################################
# Targets
.PHONY:lint
lint:
golangci-lint run --verbose
.PHONY:build
build: build-cli
.PHONY:build-cli
build-cli: clean lint
GOOS=linux GOARCH=amd64 \
$(GOCMD) build -o $(BIN_DIR)/$(BINARY_LINUX) ./cmd/cli/
GOOS=windows GOARCH=amd64 \
$(GOCMD) build -o $(BIN_DIR)/$(BINARY_WINDOWS) ./cmd/cli/
.PHONY:test
test: test-unit test-integration
.PHONY:test-unit
test-unit:
$(GOCMD) test $(VERBOSE) $(ALL_FILES)
.PHONY:test-integration
test-integration:
$(GOCMD) test $(VERBOSE) -tags integration $(ALL_FILES)
.PHONY:benchmark
benchmark:
# Use -run to exclude non-benchmark tests
$(GOCMD) test $(VERBOSE) -bench=. -benchmem -run=XXX ./pkg/...
.PHONY:clean
clean:
$(GOCMD) clean
rm -f ./bin/*
.PHONY:deps
deps:
$(GOCMD) get
.PHONY:generate
generate:
$(GOCMD) generate tools.go