-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
75 lines (59 loc) · 3.22 KB
/
Copy pathmakefile
File metadata and controls
75 lines (59 loc) · 3.22 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
GOCLEAN=go clean
# -trimpath strips local filesystem paths (e.g. /home/<user>/...) from the
# binary — privacy + reproducibility. Used for every build.
BUILDFLAGS=-trimpath -ldflags="-s -w"
# the analysis suite, reused by `lint` (host) and `lint-windows` (GOOS=windows).
ANALYZE=go vet ./... && golangci-lint run ./... && govulncheck ./...
.DEFAULT_GOAL := help
help: ## Show this help (the default target)
@echo "99dps — make targets:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| sort \
| awk 'BEGIN {FS = ":.*?## "}; {printf " \033[1;33m%-16s\033[0m %s\n", $$1, $$2}'
all: build clean ## Build then clean (a quick compile check)
build: ## Build the Linux binary (./99dps)
go build $(BUILDFLAGS) -o 99dps ./cmd/99dps
# winres embeds Windows version metadata (ProductName/Version/Description, shown
# in Explorer → Properties and Task Manager) from versioninfo.json. The .syso
# must sit in the main package dir (cmd/99dps) for the linker to pick it up; the
# _windows_amd64 suffix scopes it to that target, so non-Windows builds ignore
# it. No-op (with a note) if goversioninfo isn't installed.
winres: ## (internal) Generate the Windows version+icon resource
@if command -v goversioninfo >/dev/null 2>&1; then \
goversioninfo -64 -o cmd/99dps/resource_windows_amd64.syso versioninfo.json && echo "embedded version metadata"; \
else \
echo "goversioninfo not found — building without version metadata (run 'make tools')"; \
fi
windows: winres ## Cross-compile the Windows binary (99dps.exe)
GOOS=windows GOARCH=amd64 go build $(BUILDFLAGS) -o 99dps.exe ./cmd/99dps
release-windows: windows ## Windows binary + SHA-256 (for your own VirusTotal/records)
@sha256sum 99dps.exe | tee 99dps.exe.sha256
@echo "Built 99dps.exe. Before sending: scan at https://www.virustotal.com and share the .sha256."
dist-windows: winres ## Friend-ready zip: exe + plain-language readme (send this)
@rm -rf dist 99dps-windows.zip 99dps.exe 99dps.exe.sha256 # clean slate first
GOOS=windows GOARCH=amd64 go build $(BUILDFLAGS) -o 99dps.exe ./cmd/99dps
@mkdir dist
@cp 99dps.exe dist/
@cp packaging/windows-readme.txt "dist/READ-ME-FIRST.txt"
@cd dist && zip -q -r ../99dps-windows.zip .
@echo "Created 99dps-windows.zip — scan 99dps.exe on virustotal.com, then send the zip."
clean: ## Remove all build artifacts
${GOCLEAN}
rm -rf dist 99dps-windows.zip
rm -f 99dps 99dps.exe 99dps.exe.sha256 cmd/99dps/resource_windows_amd64.syso
test: ## Run all tests
go test ./...
# static analysis + known-vuln scan. Requires the tools (run `make tools`).
# golangci-lint must be built with Go >= the go.mod version; `make tools`
# installs it with the local toolchain.
lint: ## Lint + vuln scan (host/Linux build)
gofmt -l .
$(ANALYZE)
lint-windows: export GOOS := windows
lint-windows: ## Lint + vuln scan the Windows build (host lint skips build-tagged files)
$(ANALYZE)
tools: ## Install the dev tools (golangci-lint, govulncheck, goversioninfo)
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
go install golang.org/x/vuln/cmd/govulncheck@latest
go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@latest
.PHONY: help all build winres windows release-windows dist-windows clean test lint lint-windows tools