-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·52 lines (40 loc) · 1.27 KB
/
Makefile
File metadata and controls
executable file
·52 lines (40 loc) · 1.27 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
.PHONY: all build clean test deps lint run
BINARY_NAME=pcap2file
BUILD_DIR=bin
GO=go
all: deps build
deps:
$(GO) mod tidy
$(GO) mod download
build:
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 $(GO) build -o $(BUILD_DIR)/$(BINARY_NAME) ./cmd/pcap2file
build-local:
CGO_ENABLED=1 $(GO) build -o $(BUILD_DIR)/$(BINARY_NAME) ./cmd/pcap2file
test:
$(GO) test -v -race ./...
test-cover:
$(GO) test -v -coverprofile=coverage.out ./...
$(GO) tool cover -html=coverage.out -o coverage.html
lint:
golangci-lint run ./...
clean:
rm -rf $(BUILD_DIR)
rm -f coverage.out coverage.html
run: build-local
sudo ./$(BUILD_DIR)/$(BINARY_NAME)
install-deps:
# Install libpcap development files (Ubuntu/Debian)
sudo apt-get update
sudo apt-get install -y libpcap-dev
help:
@echo "Available targets:"
@echo " all - Download dependencies and build"
@echo " deps - Download Go dependencies"
@echo " build - Build for Linux (cross-compile)"
@echo " build-local - Build for current platform"
@echo " test - Run tests"
@echo " test-cover - Run tests with coverage"
@echo " lint - Run linter"
@echo " clean - Remove build artifacts"
@echo " run - Build and run (requires sudo)"
@echo " install-deps - Install system dependencies"