-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
32 lines (25 loc) · 958 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
# VARIABLES
PACKAGE="github.com/Tendrl/tendrl2"
BINARY_NAME="tendrl2"
default: usage
clean: ## Trash binary files
@echo "--> cleaning..."
@go clean || (echo "Unable to clean project" && exit 1)
@rm -rf $(GOPATH)/bin/$(BINARY_NAME) 2> /dev/null
@echo "Clean OK"
test: ## Run all tests
@echo "--> testing..."
@go test -v $(PACKAGE)/...
install: clean ## Compile sources and build binary and install binary
@echo "--> installing..."
@go install $(PACKAGE) || (echo "Compilation error" && exit 1)
@echo "Install OK"
run: install ## Run your application
@echo "--> running application..."
@$(GOPATH)/bin/$(BINARY_NAME)
usage: ## List available targets
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
build: clean ## Compile sources and build binary
@echo "--> building..."
@go build $(PACKAGE) || (echo "Compilation error" && exit 1)
@echo "Build OK"