-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
41 lines (32 loc) · 789 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
# Go commands
GOCMD = go
GOCLEAN = $(GOCMD) clean
GODEPS = $(GOCMD) mod download
GOTEST = $(GOCMD) test
GOBUILD = $(GOCMD) build
# Filepaths
TEST_FOLDER = test
BUILD_FOLDER = bin
COVER_PKG = bot
BINARY_NAME = $(BUILD_FOLDER)/watchlist
COVERAGE_OUT = $(BUILD_FOLDER)/coverage.out
COVERAGE_HTML = $(BUILD_FOLDER)/coverage.html
# Default target
default: clean deps build
# Clean target
clean:
@$(GOCLEAN)
@rm -rf $(BUILD_FOLDER)
# Install dependencies
deps:
@$(GODEPS)
# Test target
test:
@$(GOTEST) ./$(TEST_FOLDER) -v -coverpkg=./$(COVER_PKG) -coverprofile=$(COVERAGE_OUT) ./...
@go tool cover -html=$(COVERAGE_OUT) -o $(COVERAGE_HTML)
# Build target
build:
@CGO_ENABLED=1 $(GOBUILD) -o $(BINARY_NAME)
# Development target with hot reloading
dev:
@air -c .air.toml