-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
53 lines (41 loc) · 1.16 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
# gourl - Extract URLs from STDIN
# See LICENSE file for copyright and license details.
NAME=gourl
SRC=./main.go
GOBIN=./bin
BIN=$(GOBIN)/$(NAME)
PREFIX?=/usr/local
INSTALL_DIR=$(PREFIX)/bin
.PHONY: all build run vet clean test full
all: full
full: vet build
build: vet ## Generate bin
@echo '>> Building $(NAME)'
go build -ldflags "-s -w" -o $(BIN) $(SRC)
debug: vet ## Generate bin with debugger
@echo '>> Building $(NAME) with debugger'
@go build -gcflags="all=-N -l" -o $(BIN)-debug $(SRC)
run: build ## Run
@echo '>> Running $(NAME)'
$(BIN)
vet: ## Lint
@echo '>> Checking code with go vet'
@go vet ./...
clean: ## Clean
@echo '>> Cleaning up'
rm -rf $(GOBIN)
go clean -cache
.PHONY: check
check: ## Lint code with 'golangci-lint' and 'codespell'
@echo '>> Checking code with linters'
golangci-lint run -p bugs -p error
codespell ./main.go
install: ## Install on system
mkdir -p $(INSTALL_DIR)
cp $(BIN) $(INSTALL_DIR)/$(NAME)
chmod 755 $(INSTALL_DIR)/$(NAME)
@echo '>> $(NAME) has been installed on your device'
uninstall: ## Uninstall from system
rm -rf $(GOBIN)
rm -rf $(INSTALL_DIR)/$(NAME)
@echo '>> $(NAME) has been removed from your device'