-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathMakefile
More file actions
87 lines (72 loc) · 2.11 KB
/
Makefile
File metadata and controls
87 lines (72 loc) · 2.11 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Makefile for tls-scanner
# Binary name
BINARY_NAME=tls-scanner
# Build directory
BUILD_DIR=bin
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
GOMOD=$(GOCMD) mod
# Version info — injected at build time, no .git/ needed in container
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
LDFLAGS := -s -w -X main.version=$(VERSION) -X main.commit=$(COMMIT)
# Default target
.PHONY: all
all: build
# Build the binary
.PHONY: build
build:
mkdir -p $(BUILD_DIR)
CGO_ENABLED=0 $(GOBUILD) -mod=readonly -ldflags="$(LDFLAGS)" -o $(BUILD_DIR)/$(BINARY_NAME) ./cmd/tls-scanner
# Clean build artifacts
.PHONY: clean
clean:
$(GOCLEAN)
rm -rf $(BUILD_DIR)
# Download dependencies
.PHONY: deps
deps:
$(GOMOD) download
$(GOMOD) tidy
# Run tests (skips integration tests that hit live endpoints)
.PHONY: test
test:
$(GOTEST) -v -short ./...
# Run benchmarks (parsing only, no network)
.PHONY: bench
bench:
$(GOTEST) -bench=. -benchmem -short ./internal/...
# Run integration benchmarks against live TLS endpoints (requires testssl.sh)
.PHONY: bench-integration
bench-integration:
$(GOTEST) -v -run Integration -count=1 -timeout=600s ./internal/scanner/
# Vet
.PHONY: vet
vet:
$(GOCMD) vet ./...
# Install the binary to GOPATH/bin
.PHONY: install
install:
$(GOCMD) install ./cmd/tls-scanner
# Run the program with default parameters
.PHONY: run
run: build
./$(BUILD_DIR)/$(BINARY_NAME)
# Help target
.PHONY: help
help:
@echo "Available targets:"
@echo " build - Build the binary"
@echo " clean - Clean build artifacts"
@echo " deps - Download and tidy dependencies"
@echo " test - Run tests"
@echo " bench - Run benchmarks (parsing, no network)"
@echo " bench-integ - Run integration benchmarks (requires testssl.sh)"
@echo " vet - Run go vet"
@echo " install - Install binary to GOPATH/bin"
@echo " run - Build and run with default parameters"
@echo " help - Show this help message"