-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
66 lines (57 loc) · 1.17 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
# Global variables
GOCMD = go
BINARY_NAME = pdpapp
EXTENSION = exe
# List of usual golang commands
GOBUILD = $(GOCMD) build
GOCLEAN = $(GOCMD) clean
GOTIDY = $(GOCMD) mod tidy
GOTEST = $(GOCMD) test
GOGET = $(GOCMD) get
GOFMT = $(GOCMD) fmt
# Default task
.PHONY: all
all: build
# Build task
.PHONY: build
build:
$(GOBUILD) -o $(BINARY_NAME).$(EXTENSION) -v
# Test task
.PHONY: test
test:
$(GOTEST) -v ./...
# Target with to execute command from specific task
# Note: not really necessary (cause we have been specific the shell name)
.PHONY: clean
# Clean task
clean:
ifneq ("$(wildcard *.exe)", "")
$(GOCLEAN)
$(GOTIDY)
powershell rm $(BINARY_NAME).$(EXTENSION)
else
$(GOCLEAN)
$(GOTIDY)
endif
# Format task
.PHONY: fmt
fmt:
$(GOFMT)
# Run task
.PHONY: run
run:
$(GOBUILD) -o $(BINARY_NAME).$(EXTENSION) -v ./...
./$(BINARY_NAME).$(EXTENSION)
# Dependencies
.PHONY: deps
deps:
$(GOGET) github.com/urfave/cli
$(GOGET) github.com/boltdb/bolt
$(GOGET) github.com/google/go-cmp/cmp
$(GOGET) github.com/vrecan/death/v3
$(GOGET) golang.org/x/exp/constraints
$(GOGET) golang.org/x/crypto/ripemd160
# Update all dependencies
.PHONY: update
update:
$(GOGET) -u