-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
70 lines (53 loc) · 1.53 KB
/
Makefile
File metadata and controls
70 lines (53 loc) · 1.53 KB
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
68
69
70
# Sources (package paths)
GLCORE_PKG=./cmd/glcore
GLCLI_PKG=./cmd/glcli
# Destionations
DIR_DEST=bin/
GLCORE_NAME=$(DIR_DEST)glcore
GLCLI_NAME=$(DIR_DEST)glcli
# Install destination
INSTALL_PATH=/usr/local/bin
INSTALLED_GLCORE=$(INSTALL_PATH)/glcore
INSTALLED_GLCLI=$(INSTALL_PATH)/glcli
# Compiler flags
GO_FLAGS=-o
.PHONY: all build-glcore build-glcli run-glcore run-glcli clean clean-glcore clean-glcli fclean re install uninstall test test-coverage test-verbose test-race
all: build-glcore build-glcli
$(DIR_DEST):
mkdir -p $(DIR_DEST)
build-glcore:
go build $(GO_FLAGS) $(GLCORE_NAME) $(GLCORE_PKG)
build-glcli:
go build $(GO_FLAGS) $(GLCLI_NAME) $(GLCLI_PKG)
run-glcore: build-glcore
./$(GLCORE_NAME)
run-glcli: build-glcli
./$(GLCLI_NAME)
clean: clean-glcore clean-glcli
clean-glcore:
rm -f $(GLCORE_NAME)
clean-glcli:
rm -f $(GLCLI_NAME)
fclean: clean
rm -fr $(DIR_DEST)
install: build-glcore build-glcli
sudo mkdir -p $(INSTALL_PATH)
sudo install -m 755 $(GLCORE_NAME) $(INSTALLED_GLCORE)
sudo install -m 755 $(GLCLI_NAME) $(INSTALLED_GLCLI)
@echo "glcore and glcli installed in $(INSTALL_PATH)"
uninstall:
sudo rm -f $(INSTALLED_GLCORE) $(INSTALLED_GLCLI)
@echo "glcore and glcli removed from $(INSTALL_PATH)"
reinstall: uninstall install
# Test targets
test:
go test ./internal/...
test-coverage:
go test -cover ./internal/...
go test -coverprofile=coverage.out ./internal/...
go tool cover -html=coverage.out -o coverage.html
test-verbose:
go test -v ./internal/...
test-race:
go test -race ./internal/...
re: fclean all