-
-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathMakefile
More file actions
54 lines (43 loc) · 1.12 KB
/
Makefile
File metadata and controls
54 lines (43 loc) · 1.12 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
# Makefile for pphack
REPO := github.com/edoardottt/pphack
BINARY_NAME := pphack
CMD_DIR := ./cmd/$(BINARY_NAME)
BIN_PATH := /usr/local/bin/$(BINARY_NAME)
.PHONY: all remod update lint build clean test install uninstall
all: build
remod:
@echo "Reinitializing Go module..."
@rm -f go.mod go.sum
@go mod init $(REPO)
@go get ./...
@go mod tidy -v
@echo "Go module reinitialized."
update:
@echo "Updating dependencies..."
@go get -u ./...
@go mod tidy -v
@echo "Dependencies updated."
lint:
@echo "Running linter..."
@golangci-lint run
@echo "Linting complete."
build:
@echo "Building $(BINARY_NAME)..."
@go build -o $(BINARY_NAME) $(CMD_DIR)
@echo "Build complete."
install: build
@echo "Installing $(BINARY_NAME) to $(BIN_PATH)..."
@sudo mv $(BINARY_NAME) $(BIN_PATH)
@echo "Installed successfully."
uninstall:
@echo "Uninstalling $(BINARY_NAME) from $(BIN_PATH)..."
@sudo rm -f $(BIN_PATH)
@echo "Uninstalled."
test:
@echo "Running tests with race detector..."
@go test -race ./...
@echo "Tests complete."
clean:
@echo "Cleaning build artifacts..."
@rm -f $(BINARY_NAME)
@echo "Clean complete."